/
run-test.js
46 lines (38 loc) · 1.2 KB
/
run-test.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
const createTestCafe = require('testcafe');
const { connect } = require('hadouken-js-adapter');
let runner = null;
let testcafe = null;
(async () => {
//create Test Cafe Runner
testcafe = await createTestCafe('localhost', 1337, 1338);
runner = testcafe.createRunner();
const remoteConnection = await testcafe.createBrowserConnection();
console.log(`Launching test URL: ${remoteConnection.url}`);
// Connect to a runtime
const fin = await connect({
uuid: 'openfin-runtime-connection',
runtime: {
version: 'stable'
},
nonPersistent: true
});
fin.once('disconnected', process.exit);
// Create and run OpenFin application using test URL
const testApp = await fin.Application.create({
uuid: 'testcafe',
name: 'testcafe',
url: remoteConnection.url,
autoShow: true,
defaultHeight: 800,
defaultWidth: 1200,
saveWindowState: false
});
testApp.run();
remoteConnection.once('ready', async () => {
await runner.src('tests.js');
await runner.browsers(remoteConnection);
await runner.run();
testcafe.close();
testApp.terminate();
});
})();