@uuv/cypress 2.9.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/lib/uuv-cli.d.ts +1 -1
- package/dist/lib/uuv-cli.js +49 -13
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [2.10.0](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v2.9.1...runner-cypress-v2.10.0) (2024-02-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add junit xml report option, [#491](https://github.com/Orange-OpenSource/uuv/issues/491) ([b64b0b2](https://github.com/Orange-OpenSource/uuv/commit/b64b0b2a60200269f558bcf7e0c75d8a74ffc226))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **runner-playwright:** update dependency @cucumber/tag-expressions to v6.1.0 ([47fb579](https://github.com/Orange-OpenSource/uuv/commit/47fb579ee50c26ed67af6390f4e678f8206b7226))
|
|
12
|
+
|
|
1
13
|
## [2.9.1](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v2.9.0...runner-cypress-v2.9.1) (2024-02-24)
|
|
2
14
|
|
|
3
15
|
|
package/dist/lib/uuv-cli.d.ts
CHANGED
package/dist/lib/uuv-cli.js
CHANGED
|
@@ -26,12 +26,15 @@ const minimist_1 = __importDefault(require("minimist"));
|
|
|
26
26
|
const fs_1 = __importDefault(require("fs"));
|
|
27
27
|
const cypress_1 = __importDefault(require("cypress"));
|
|
28
28
|
const uuv_custom_formatter_1 = require("../cucumber/uuv-custom-formatter");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
29
|
+
const path_1 = __importDefault(require("path"));
|
|
30
|
+
async function main(projectDir = "./uuv") {
|
|
31
|
+
const REPORT_DIR = path_1.default.join(projectDir, "reports");
|
|
32
|
+
const E2E_REPORT_DIR = path_1.default.join(projectDir, "reports/e2e");
|
|
33
|
+
const JSON_REPORT_DIR = path_1.default.join(projectDir, "reports/e2e/json");
|
|
34
|
+
const HTML_REPORT_DIR = path_1.default.join(projectDir, "reports/e2e/html");
|
|
35
|
+
const CYPRESS_JUNIT_REPORT = [`${projectDir}/reports/e2e/junit-report-*.xml`];
|
|
36
|
+
const JUNIT_UNIFIED_REPORT = `${projectDir}/reports/e2e/junit-report.xml`;
|
|
37
|
+
const CUCUMBER_MESSAGES_FILE = path_1.default.join(projectDir, "cucumber-messages.ndjson");
|
|
35
38
|
printBanner(getCurrentVersion);
|
|
36
39
|
const argv = (0, minimist_1.default)(process.argv.slice(2));
|
|
37
40
|
const command = findTargetCommand(argv);
|
|
@@ -39,6 +42,9 @@ async function main() {
|
|
|
39
42
|
if (!fs_1.default.existsSync(REPORT_DIR)) {
|
|
40
43
|
fs_1.default.mkdirSync(REPORT_DIR);
|
|
41
44
|
}
|
|
45
|
+
if (fs_1.default.existsSync(E2E_REPORT_DIR)) {
|
|
46
|
+
deleteAllFileOfDirectory(E2E_REPORT_DIR);
|
|
47
|
+
}
|
|
42
48
|
switch (command) {
|
|
43
49
|
case "open":
|
|
44
50
|
await openCypress(argv);
|
|
@@ -55,8 +61,12 @@ async function main() {
|
|
|
55
61
|
const browser = argv.browser ? argv.browser : "chrome";
|
|
56
62
|
const env = argv.env ? JSON.parse(argv.env.replace(/'/g, "\"")) : {};
|
|
57
63
|
const targetTestFile = argv.targetTestFile ? argv.targetTestFile : null;
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
if (argv.generateA11yReport) {
|
|
65
|
+
env.uuvA11yReportFilePath = `${process.cwd()}/${REPORT_DIR}/a11y-report.json`;
|
|
66
|
+
env.generateA11yReport = argv.generateA11yReport;
|
|
67
|
+
}
|
|
68
|
+
env.generateJunitReport = argv.generateJunitReport;
|
|
69
|
+
env.generateHtmlReport = argv.generateHtmlReport;
|
|
60
70
|
console.debug("Variables: ");
|
|
61
71
|
console.debug(` -> browser: ${browser}`);
|
|
62
72
|
console.debug(` -> env: ${JSON.stringify(env)}`);
|
|
@@ -68,17 +78,23 @@ async function main() {
|
|
|
68
78
|
function openCypress(argv) {
|
|
69
79
|
const { env } = extractArgs(argv);
|
|
70
80
|
return cypress_1.default.open({
|
|
71
|
-
project:
|
|
81
|
+
project: projectDir,
|
|
72
82
|
env,
|
|
73
83
|
});
|
|
74
84
|
}
|
|
75
85
|
function runE2ETests(argv) {
|
|
76
86
|
const { browser, env, targetTestFile } = extractArgs(argv);
|
|
77
87
|
const options = {
|
|
78
|
-
project:
|
|
88
|
+
project: projectDir,
|
|
79
89
|
browser,
|
|
80
90
|
env
|
|
81
91
|
};
|
|
92
|
+
if (env.generateJunitReport) {
|
|
93
|
+
options.reporter = "junit";
|
|
94
|
+
options.reporterOptions = {
|
|
95
|
+
mochaFile: "reports/e2e/junit-report-[hash].xml"
|
|
96
|
+
};
|
|
97
|
+
}
|
|
82
98
|
if (targetTestFile) {
|
|
83
99
|
options.spec = targetTestFile;
|
|
84
100
|
}
|
|
@@ -86,8 +102,11 @@ async function main() {
|
|
|
86
102
|
return cypress_1.default
|
|
87
103
|
.run(options)
|
|
88
104
|
.then(async (result) => {
|
|
89
|
-
if (
|
|
90
|
-
|
|
105
|
+
if (env.generateJunitReport) {
|
|
106
|
+
await mergeJunitReport(CYPRESS_JUNIT_REPORT, JUNIT_UNIFIED_REPORT);
|
|
107
|
+
}
|
|
108
|
+
if (env.generateHtmlReport) {
|
|
109
|
+
console.info(chalk_1.default.blueBright("Generating Html Test Report..."));
|
|
91
110
|
await generateHtmlReport(browser, argv);
|
|
92
111
|
}
|
|
93
112
|
if (fs_1.default.existsSync(CUCUMBER_MESSAGES_FILE)) {
|
|
@@ -99,8 +118,11 @@ async function main() {
|
|
|
99
118
|
}
|
|
100
119
|
process.exit();
|
|
101
120
|
})
|
|
102
|
-
.catch((err) => {
|
|
121
|
+
.catch(async (err) => {
|
|
103
122
|
console.error(chalk_1.default.red(err));
|
|
123
|
+
if (env.generateJunitReport) {
|
|
124
|
+
await mergeJunitReport(CYPRESS_JUNIT_REPORT, JUNIT_UNIFIED_REPORT);
|
|
125
|
+
}
|
|
104
126
|
process.exit(-1);
|
|
105
127
|
});
|
|
106
128
|
}
|
|
@@ -159,5 +181,19 @@ async function main() {
|
|
|
159
181
|
});
|
|
160
182
|
return JSON.parse(pJsonStr).version;
|
|
161
183
|
}
|
|
184
|
+
async function mergeJunitReport(inputFiles, outputFile) {
|
|
185
|
+
const { mergeFiles } = require("junit-report-merger");
|
|
186
|
+
console.info(chalk_1.default.blueBright("Generating Junit Test Report..."));
|
|
187
|
+
await mergeFiles(outputFile, inputFiles);
|
|
188
|
+
console.info(chalk_1.default.blueBright(`Junit Test Report generated: ${outputFile}`));
|
|
189
|
+
}
|
|
190
|
+
function deleteAllFileOfDirectory(dirPath) {
|
|
191
|
+
for (const file of fs_1.default.readdirSync(dirPath)) {
|
|
192
|
+
const filePath = path_1.default.join(dirPath, file);
|
|
193
|
+
if (fs_1.default.lstatSync(filePath).isFile()) {
|
|
194
|
+
fs_1.default.rmSync(filePath);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
162
198
|
}
|
|
163
199
|
exports.main = main;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/cypress",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
|
|
6
6
|
"description": "A solution to facilitate the writing and execution of E2E tests understandable by any human being using cucumber(BDD) and cypress",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"generate:step-definitions": "ts-node generate-step-definitions.ts",
|
|
37
37
|
"package": "npm pack --pack-destination=\"../../dist/packages\"",
|
|
38
38
|
"postinstall": "node postinstall.js",
|
|
39
|
-
"test:run": "node test.js
|
|
40
|
-
"test:open": "node test.js
|
|
39
|
+
"test:run": "node test.js e2e",
|
|
40
|
+
"test:open": "node test.js open",
|
|
41
41
|
"test": "npm run test:run",
|
|
42
42
|
"lint": "eslint -c .eslintrc.json"
|
|
43
43
|
},
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@badeball/cypress-cucumber-preprocessor": "16.0.3",
|
|
46
46
|
"@cypress/webpack-preprocessor": "5.17.1",
|
|
47
47
|
"@testing-library/cypress": "9.0.0",
|
|
48
|
-
"@uuv/a11y": "1.0.0-beta.
|
|
49
|
-
"@uuv/runner-commons": "2.
|
|
48
|
+
"@uuv/a11y": "1.0.0-beta.14",
|
|
49
|
+
"@uuv/runner-commons": "2.7.0",
|
|
50
50
|
"axe-core": "4.8.4",
|
|
51
51
|
"chai-subset": "^1.6.0",
|
|
52
52
|
"chalk": "4.1.2",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"cypress-real-events": "^1.10.0",
|
|
57
57
|
"figlet": "1.7.0",
|
|
58
58
|
"is-admin": "2.1.1",
|
|
59
|
+
"junit-report-merger": "^6.0.3",
|
|
59
60
|
"minimist": "1.2.8",
|
|
60
61
|
"multiple-cucumber-html-reporter": "3.6.2",
|
|
61
62
|
"path-browserify": "^1.0.1",
|