-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlocal.runner.js
More file actions
33 lines (27 loc) · 1 KB
/
local.runner.js
File metadata and controls
33 lines (27 loc) · 1 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
#!/usr/bin/env node
const Nightwatch = require('nightwatch-api');
const browserstack = require('browserstack-local');
try {
// Code to start browserstack local before start of test.
console.log('Connecting local'); // eslint-disable-line
Nightwatch.bs_local = new browserstack.Local();
Nightwatch.bs_local.start({ key: 'user_key' }, (error) => {
if (error) throw error;
console.log('Connected. Now testing...'); // eslint-disable-line
Nightwatch.cli((argv) => {
Nightwatch.CliRunner(argv)
.setup(null, () => {
// Code to stop browserstack local after end of parallel test.
Nightwatch.bs_local.stop(() => {});
})
.runTests(() => {
// Code to stop browserstack local after end of single test.
Nightwatch.bs_local.stop(() => {});
});
});
});
} catch (error) {
console.log('There was an error while starting the test runner:\n\n'); // eslint-disable-line
process.stderr.write(`${error.stack}\n`);
process.exit(2);
}