This repository was archived by the owner on Apr 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathstatus_spec.ts
More file actions
84 lines (75 loc) · 2.65 KB
/
status_spec.ts
File metadata and controls
84 lines (75 loc) · 2.65 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import * as path from 'path';
import {Logger, WriteTo} from '../../lib/cli/logger';
import {program} from '../../lib/cmds/update';
import {spawnSync} from '../../lib/utils';
function getVersions(line: string): string[] {
return line.split(':')[3].split(',');
}
describe('status', () => {
Logger.writeTo = WriteTo.NONE;
let argv: any;
let tmpDir = path.resolve('selenium_test');
// chrome 2.20[last], 2.24
// geckodriver {{config version}} [last]
// standalone 2.24 [last], {{config version}}
beforeAll((done) => {
argv = {
'_': ['update'],
'gecko': 'false',
'versions': {'chrome': '2.24', 'standalone': '2.44.0'},
'out_dir': tmpDir
};
program.run(JSON.parse(JSON.stringify(argv)))
.then(() => {
argv['versions']['chrome'] = '2.20';
program.run(JSON.parse(JSON.stringify(argv))).then(() => {
done();
});
})
.catch(err => {
done.fail();
});
}, 30000);
it('should show the version number of the default and latest versions', () => {
let lines =
spawnSync(
process.execPath,
['built/lib/webdriver.js', 'status', '--out_dir', 'selenium_test', '--gecko', 'false'],
'pipe')
.output[1]
.toString()
.split('\n');
let seleniumLine: string = null;
let chromeLine: string = null;
// let geckodriverLine: string = null;
let androidSdkLine: string = null;
let appiumLine: string = null;
for (let line of lines) {
if (line.indexOf('selenium') >= 0) {
seleniumLine = line;
} else if (line.indexOf('chrome') >= 0) {
chromeLine = line;
// } else if (line.indexOf('geckodriver') >= 0) {
// geckodriverLine = line;
} else if (line.indexOf('android-sdk') >= 0) {
androidSdkLine = line;
} else if (line.indexOf('appium') >= 0) {
appiumLine = line;
}
}
expect(seleniumLine).not.toBeNull();
expect(getVersions(seleniumLine).length).toEqual(1);
expect(getVersions(seleniumLine)[0]).toContain('2.44.0 [last]');
expect(chromeLine).not.toBeNull();
expect(getVersions(chromeLine).length).toEqual(2);
expect(getVersions(chromeLine)[0]).toContain('2.20 [last]');
expect(getVersions(chromeLine)[1]).toContain('2.24');
// expect(geckodriverLine).not.toBeNull();
// expect(geckodriverLine).toContain('[last]');
// expect(getVersions(geckodriverLine).length).toEqual(1);
expect(androidSdkLine).not.toBeNull();
expect(androidSdkLine).toContain('not present');
expect(appiumLine).not.toBeNull();
expect(appiumLine).toContain('not present');
});
});