-
Notifications
You must be signed in to change notification settings - Fork 0
/
cucumber.conf.js
49 lines (40 loc) · 1.23 KB
/
cucumber.conf.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
47
48
49
const fs = require('fs');
const path = require('path')
const { setDefaultTimeout, After, AfterAll, BeforeAll } = require('cucumber');
const {
client,
createSession,
closeSession,
startWebDriver,
stopWebDriver,
getNewScreenshots
} = require('nightwatch-api');
const reporter = require('cucumber-html-reporter');
setDefaultTimeout(60000);
BeforeAll(async () => {
await startWebDriver({ env: process.env.NIGHTWATCH_ENV || 'chromeHeadless' });
await createSession();
});
let count = 0;
AfterAll(async () => {
await closeSession();
await stopWebDriver();
setTimeout(() => {
reporter.generate({
theme: 'bootstrap',
jsonFile: 'report/cucumber_report.json',
output: 'report/cucumber_report.html',
reportSuiteAsScenarios: true,
launchReport: false,
metadata: {
'App Version': '0.3.2',
'Test Environment': 'POC'
}
});
}, 1000);
});
After(async function() {
let filename = path.resolve(__dirname, "testshot" + count++ + ".png")
await client.saveScreenshot(filename, () => {})
// getNewScreenshots().forEach(file => this.attach(fs.readFileSync(file), 'image/png'));
});