Repository navigation
Expand file tree
/
Copy pathtest.js
More file actions
121 lines (101 loc) · 3.19 KB
/
Copy pathtest.js
File metadata and controls
121 lines (101 loc) · 3.19 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
const Application = require('spectron').Application
const assert = require('assert')
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const inkyPathsByPlatform = {
"darwin": "../Inky-darwin-x64/Inky.app/Contents/MacOS/Inky",
"linux": "../Inky-linux-x64/Inky",
"win32": "../Inky-win32-x64/Inky.exe"
};
chai.should();
chai.use(chaiAsPromised);
describe('application launch tests', function () {
this.timeout(10000)
beforeEach(function () {
this.app = new Application({
path: inkyPathsByPlatform[process.platform]
})
return this.app.start().then(function (app) {
chaiAsPromised.transferPromiseness = app.transferPromiseness;
return app;
});
})
afterEach(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
})
it('shows an initial window', function () {
return this.app.client.getWindowCount().then(function (count) {
assert.equal(count, 1)
})
})
it('reads the title', function () {
const title = "Untitled.ink";
return this.app.client.getText('.title')
.should.eventually.equal(title);
})
it('opens the menu', function () {
return this.app.client.click('.icon-menu')
.element('.sidebar')
.should.eventually.exist
})
})
describe('compiles hello world game', function () {
this.timeout(10000)
beforeEach(function () {
this.app = new Application({
path: inkyPathsByPlatform[process.platform]
})
return this.app.start().then(function (app) {
chaiAsPromised.transferPromiseness = app.transferPromiseness;
return app;
});
})
afterEach(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
})
it('writes and reads hello world', function () {
const input = "Hello World!";
return this.app.client
.setValue('.ace_text-input', input)
.pause(2000)
.getText('.storyText')
.should.eventually.equal(input)
})
it('writes and selects a choice', function () {
const input = "Hello World! \n * Hello back \n Nice to hear from you! \n -> END";
const resultChoice = "Hello back";
const resultAnswer = "Nice to hear from you!";
return this.app.client
.setValue('.ace_text-input', input)
.pause(2000)
.click('.choice')
.pause(2000)
.getText('.storyText:nth-of-type(2)')
.should.eventually.equal(resultChoice)
.getText('.storyText:nth-of-type(3)')
.should.eventually.equal(resultAnswer)
})
it('suppresses choice text', function () {
const input = "Hello World! \n * [Hello back] \n Nice to hear from you! \n -> END";
const resultAnswer = "Nice to hear from you!";
return this.app.client
.setValue('.ace_text-input', input)
.pause(2000)
.click('.choice')
.pause(2000)
.getText('.storyText:nth-of-type(2)')
.should.eventually.equal(resultAnswer)
})
it('shows TODOs', function() {
const input = "-\n * Rock\n * Paper\n * Scissors\nTODO: Make this more interesting"
return this.app.client
.setValue('.ace_text-input', input)
.pause(2000)
.getText('.issuesMessage')
.should.eventually.not.equal('No issues.')
})
})