|
1 |
| -const { outputBanner } = require('ci-utils'); |
2 |
| -const { tmpdir } = require('os'); |
3 |
| -const { join } = require('path'); |
4 |
| -const { readFileSync, writeFileSync } = require('fs'); |
| 1 | +// Global afterEach and reporter for all nightwatch tests |
| 2 | +// Commented out code provides the ability to collect all nightwatch results to one json file |
| 3 | +// Commented out code to be used if nightwatch results reporting needs to be consolidated in Github Checks |
| 4 | + |
| 5 | +// const { outputBanner } = require('ci-utils'); |
| 6 | +// const { tmpdir } = require('os'); |
| 7 | +// const { join } = require('path'); |
| 8 | +// const { readFileSync, writeFileSync } = require('fs'); |
5 | 9 | const sauce = require('./scripts/nightwatch-sauce');
|
6 | 10 |
|
7 |
| -const dataFilePath = join(tmpdir(), 'nightwatch-results.json'); |
8 |
| -const read = () => JSON.parse(readFileSync(dataFilePath, 'utf8')); |
9 |
| -const write = data => writeFileSync(dataFilePath, JSON.stringify(data), 'utf8'); |
| 11 | +// const dataFilePath = join(tmpdir(), 'nightwatch-results.json'); |
10 | 12 |
|
11 |
| -console.log({ dataFilePath }); |
| 13 | +// const read = () => JSON.parse(readFileSync(dataFilePath, 'utf8')); |
| 14 | +// const write = data => writeFileSync(dataFilePath, JSON.stringify(data), 'utf8'); |
12 | 15 |
|
13 |
| -write({ |
14 |
| - testCount: 0, |
15 |
| - results: [], |
16 |
| -}); |
| 16 | +// console.log({ dataFilePath }); |
| 17 | + |
| 18 | +// write({ |
| 19 | +// testCount: 0, |
| 20 | +// results: [], |
| 21 | +// }); |
17 | 22 |
|
18 | 23 | const theGlobals = {
|
19 | 24 | testingUrl: 'https://boltdesignsystem.com',
|
20 | 25 | results: [],
|
21 | 26 | testCount: 0,
|
22 | 27 |
|
23 | 28 | afterEach(browser, cb) {
|
24 |
| - const data = read(); |
25 |
| - data.testCount += 1; |
26 |
| - write(data); |
27 |
| - // theGlobals.testCount += 1; |
28 |
| - outputBanner(`global afterEach called, testCount at ${data.testCount}`); |
| 29 | + // const data = read(); |
| 30 | + // data.testCount += 1; |
| 31 | + // write(data); |
| 32 | + // // theGlobals.testCount += 1; |
| 33 | + // outputBanner(`global afterEach called, testCount at ${data.testCount}`); |
29 | 34 | sauce(browser, cb);
|
30 | 35 | },
|
31 | 36 |
|
32 | 37 | reporter(results, cb) {
|
33 | 38 | // totalReports += 1;
|
34 |
| - const data = read(); |
35 |
| - data.results.push(results); |
36 |
| - write(data); |
37 |
| - console.log(`global reporter called; have total of ${data.results.length}`); |
| 39 | + // const data = read(); |
| 40 | + // data.results.push(results); |
| 41 | + // write(data); |
| 42 | + // console.log(`global reporter called; have total of ${data.results.length}`); |
38 | 43 | console.log(results);
|
39 | 44 | cb();
|
40 | 45 | },
|
|
0 commit comments