-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestSpectron.js
More file actions
52 lines (41 loc) · 1.35 KB
/
testSpectron.js
File metadata and controls
52 lines (41 loc) · 1.35 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
// A simple test to verify a visible window is opened with a title
var Application = require('spectron').Application
var assert = require('assert')
describe('application launch', function () {
this.timeout(10000)
before(function () {
this.app = new Application({
path: 'c:\\application.exe',
})
return this.app.start()
})
after(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
})
it('wait for window to load', function () {
return this.app.client.waitForVisible('[aid=host]',10000).then(function (isVisible) {
assert.equal(isVisible, true)
})
})
it('authentication', function () {
this.app.client.pause(1000)
this.app.client.setValue('[aid=host]','16.186.77.33:8080')
this.app.client.pause(1000)
this.app.client.setValue('[aid=user]','xxx')
this.app.client.pause(1000)
this.app.client.setValue('[aid=password]','xxx')
this.app.client.pause(1000)
this.app.client.leftClick('[aid=authentication]')
return this.app.client.waitForVisible('[aid=login]',10000).then(function (isVisible) {
assert.equal(isVisible, true)
})
})
it('login', function () {
this.app.client.click('[aid=login]')
return this.app.client.waitForVisible('[aid=defect]',10000).then(function (isVisible) {
assert.equal(isVisible, true)
})
})
})