forked from Klaveness-Digital/cypress-cucumber-preprocessor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcucumber-html-reporter.js
More file actions
35 lines (31 loc) · 958 Bytes
/
Copy pathcucumber-html-reporter.js
File metadata and controls
35 lines (31 loc) · 958 Bytes
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
const reporter = require("cucumber-html-reporter");
const fs = require("fs");
const moment = require("moment");
const metadataFile = "./cypress/reports/metadata.json";
fs.readFile(metadataFile, "utf-8", (error, metadata) => {
if (error) {
throw new Error(`An error occurred while reading file: "${metadataFile}"!`);
} else {
const data = JSON.parse(metadata);
const options = {
theme: "hierarchy",
jsonDir: "cypress/reports",
output: `cypress/reports/${moment().format(
"YYYY-MM-DD_h-mm-ssa"
)}_cucumber-report.html`,
reportSuiteAsScenarios: true,
scenarioTimestamp: true,
launchReport: true,
ignoreBadJsonFile: true,
metadata: {
"App Version": "1.0.0",
"Test Environment": "QA",
Browser: data.browser,
Platform: data.platform,
Parallel: "Scenarios",
Executed: "Locally",
},
};
reporter.generate(options);
}
});