-
-
Notifications
You must be signed in to change notification settings - Fork 6k
/
keystore-base.js
47 lines (40 loc) · 1.5 KB
/
keystore-base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"use strict";
var setup = require("./setup-base")
, env = require('../../helpers/env')
, exec = require('child_process').exec
, osType = require('os').type()
, rimraf = require('rimraf');
module.exports = function () {
var tmp = osType === 'Windows_NT' ? 'C:\\Windows\\Temp' : '/tmp';
var keystorePath = tmp + '/appiumtest.keystore';
var keyAlias = 'appiumtest';
var desired = {
app: "sample-code/apps/selendroid-test-app.apk",
appPackage: 'io.selendroid.testapp',
appActivity: '.HomeScreenActivity',
useKeystore: true,
keystorePath: keystorePath,
keyAlias: keyAlias
};
this.timeout(env.MOCHA_INIT_TIMEOUT);
before(function (done) {
rimraf(keystorePath, function (err) {
if (err) return done(err);
var cmd = 'keytool -genkey -v -keystore ' + keystorePath + ' -alias ' + keyAlias + ' -storepass android -keypass android -keyalg RSA -validity 14000';
var child = exec(cmd, done);
// answer the questions that `keytool` asks
child.stdin.write('Appium Testsuite\nAppium\nTest\nSan Francisco\nCalifornia\nUS\nyes\n');
});
});
// custom keystore doesn't make sense when running on Sauce
describe('brand-new custom keystore @skip-ci', function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });
it('should be able to launch an app with custom keystore', function (done) {
driver
.getCurrentActivity()
.should.eventually.include(desired.appActivity)
.nodeify(done);
});
});
};