@uuv/playwright 1.7.0 → 1.7.2
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/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
# @uuv/playwright
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://
|
|
4
|
+
<a href="https://orange-opensource.github.io/uuv/">
|
|
5
5
|
<picture>
|
|
6
|
-
<img alt="UUV Logo" src="https://
|
|
6
|
+
<img alt="UUV Logo" src="https://orange-opensource.github.io/uuv/img/uuv.png">
|
|
7
7
|
</picture>
|
|
8
8
|
</a>
|
|
9
9
|
</p>
|
|
@@ -62,7 +62,7 @@ we see that the sentence proposed by **UUV is the most understandable** of all
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
## Documentation
|
|
65
|
-
<a href="https://
|
|
65
|
+
<a href="https://orange-opensource.github.io/uuv/"><img src="https://img.shields.io/badge/documentation-black?&style=for-the-badge&logo=github&logoColor=white" alt="documentation"/></a>
|
|
66
66
|
|
|
67
67
|
## What is @uuv/playwright?
|
|
68
68
|
|
|
@@ -85,12 +85,12 @@ or
|
|
|
85
85
|
yarn add -D @uuv/playwright
|
|
86
86
|
```
|
|
87
87
|
## Configuration (optional)
|
|
88
|
-
<a href="https://
|
|
88
|
+
<a href="https://orange-opensource.github.io/uuv/docs/getting-started/configuration"><img src="https://img.shields.io/badge/Configure%20Playwright%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for configure uuv playwright"/></a>
|
|
89
89
|
|
|
90
90
|
## Usage
|
|
91
91
|
|
|
92
92
|
### Scenarios example
|
|
93
|
-
You can find test examples here : [weather-app.feature](https://github.com/
|
|
93
|
+
You can find test examples here : [weather-app.feature](https://github.com/Orange-OpenSource/uuv/blob/main/example/weather-app.feature)
|
|
94
94
|
|
|
95
95
|
### Write test
|
|
96
96
|
To write your first test, create the file `uuv/e2e/first-test.feature` in the project root with the following content :
|
|
@@ -104,7 +104,7 @@ To write your first test, create the file `uuv/e2e/first-test.feature` in the pr
|
|
|
104
104
|
|
|
105
105
|
For more details, please go to the documentation:
|
|
106
106
|
|
|
107
|
-
<a href="https://
|
|
107
|
+
<a href="https://orange-opensource.github.io/uuv/docs/test/first-test"><img src="https://img.shields.io/badge/Write%20test%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for write test"/></a>
|
|
108
108
|
|
|
109
109
|
### Run test
|
|
110
110
|
|
|
@@ -137,15 +137,15 @@ yarn uuv e2e --browser=edge --env="{'TAGS':'@mobile'}" --generateHtmlReport
|
|
|
137
137
|
|
|
138
138
|
For more details, please go to the documentation:
|
|
139
139
|
|
|
140
|
-
<a href="https://
|
|
140
|
+
<a href="https://orange-opensource.github.io/uuv/docs/test/running-test"><img src="https://img.shields.io/badge/Run%20test%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for run test"/></a>
|
|
141
141
|
|
|
142
142
|
## License
|
|
143
143
|
|
|
144
|
-
[<a href="https://github.com/
|
|
144
|
+
[<a href="https://github.com/Orange-OpenSource/uuv/blob/main/LICENSE">
|
|
145
145
|
<img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"/>
|
|
146
146
|
</a>](https://spdx.org/licenses/MIT.html)
|
|
147
147
|
|
|
148
|
-
This project is licensed under the terms of the [MIT license](https://github.com/
|
|
148
|
+
This project is licensed under the terms of the [MIT license](https://github.com/Orange-OpenSource/uuv/blob/main/LICENSE).
|
|
149
149
|
|
|
150
150
|
## Authors
|
|
151
151
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UuvCustomFormatter = void 0;
|
|
4
|
+
const cucumber_json_report_formatter_1 = require("cucumber-json-report-formatter");
|
|
5
|
+
// FIXME remove this class when the PR https://github.com/vrymar/cucumber-json-report-formatter/pull/20 will be merged
|
|
6
|
+
class UuvCustomFormatter extends cucumber_json_report_formatter_1.Formatter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
}
|
|
10
|
+
async parseCucumberJson(sourceFile, outputFile) {
|
|
11
|
+
console.info(`Start formatting file '${sourceFile}' into '${outputFile}'`);
|
|
12
|
+
const report = await this.helper.readFileIntoJson(sourceFile);
|
|
13
|
+
const gherkinDocumentJson = this.helper.getJsonFromArray(report, "gherkinDocument");
|
|
14
|
+
const cucumberReport = [];
|
|
15
|
+
gherkinDocumentJson.forEach(gherkinJson => {
|
|
16
|
+
let gherkinDocument;
|
|
17
|
+
try {
|
|
18
|
+
gherkinDocument = JSON.parse(gherkinJson).gherkinDocument;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
console.error("Error parsing JSON string.", err);
|
|
22
|
+
}
|
|
23
|
+
const feature = gherkinDocument.feature;
|
|
24
|
+
const featureChildren = feature.children;
|
|
25
|
+
const scenariosJson = [];
|
|
26
|
+
const background = {};
|
|
27
|
+
featureChildren.forEach(featureChild => {
|
|
28
|
+
if (featureChild.rule) {
|
|
29
|
+
featureChild.rule.steps = [];
|
|
30
|
+
featureChild.rule.children.forEach(ruleChildren => {
|
|
31
|
+
this.buildAndAddScenario(ruleChildren, report, background, feature, scenariosJson, featureChild.rule);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.buildAndAddScenario(featureChild, report, background, feature, scenariosJson, undefined);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const rootJson = {
|
|
39
|
+
comments: this.getComments(gherkinDocument.comments),
|
|
40
|
+
description: gherkinDocument.feature.description,
|
|
41
|
+
elements: scenariosJson,
|
|
42
|
+
id: feature.name,
|
|
43
|
+
keyword: feature.keyword,
|
|
44
|
+
line: feature.location.line,
|
|
45
|
+
name: feature.name,
|
|
46
|
+
uri: gherkinDocument.uri,
|
|
47
|
+
tags: this.getTags(gherkinDocument.feature.tags)
|
|
48
|
+
};
|
|
49
|
+
cucumberReport.push(rootJson);
|
|
50
|
+
});
|
|
51
|
+
await this.validateReportSchema(report);
|
|
52
|
+
const reportString = JSON.stringify(cucumberReport);
|
|
53
|
+
console.info(`Finished formatting file '${sourceFile}'`);
|
|
54
|
+
this.helper.writeFile(outputFile, reportString);
|
|
55
|
+
}
|
|
56
|
+
buildAndAddScenario(child, report, background, feature, scenariosJson, rule) {
|
|
57
|
+
let steps = [];
|
|
58
|
+
let stepJson = {};
|
|
59
|
+
// Background
|
|
60
|
+
if (child.scenario === undefined) {
|
|
61
|
+
child.background.steps.forEach(step => {
|
|
62
|
+
stepJson = this.createStepJson(step, report, 0);
|
|
63
|
+
steps.push(stepJson);
|
|
64
|
+
});
|
|
65
|
+
background = this.createScenarioJson(feature, child.background, steps, "background");
|
|
66
|
+
// eslint-disable-next-line brace-style
|
|
67
|
+
}
|
|
68
|
+
// Normal Scenario
|
|
69
|
+
else if (!child.scenario.keyword.includes("Outline")) {
|
|
70
|
+
child.scenario.steps.forEach(step => {
|
|
71
|
+
stepJson = this.createStepJson(step, report, 0);
|
|
72
|
+
steps.push(stepJson);
|
|
73
|
+
});
|
|
74
|
+
const scenario = this.createScenarioJson(feature, child.scenario, steps, "scenario");
|
|
75
|
+
if (rule) {
|
|
76
|
+
scenario.id = `${feature.name};${rule.name};${scenario.name}`;
|
|
77
|
+
}
|
|
78
|
+
if (Object.keys(background).length !== 0 && background !== undefined) {
|
|
79
|
+
scenariosJson.push(background);
|
|
80
|
+
}
|
|
81
|
+
scenariosJson.push(scenario);
|
|
82
|
+
} /* Scenario Outline */
|
|
83
|
+
else if (child.scenario.examples[0].tableBody !== undefined) {
|
|
84
|
+
const numberOfExecutions = child.scenario.examples[0].tableBody.length;
|
|
85
|
+
const numberOfStepsEachExecution = child.scenario.steps.length;
|
|
86
|
+
let scenarioIndex = 0;
|
|
87
|
+
while (scenarioIndex < numberOfExecutions) {
|
|
88
|
+
let currentStep = 0;
|
|
89
|
+
steps = [];
|
|
90
|
+
while (currentStep < numberOfStepsEachExecution) {
|
|
91
|
+
stepJson = this.createStepJson(child.scenario.steps[currentStep], report, scenarioIndex);
|
|
92
|
+
currentStep++;
|
|
93
|
+
steps.push(stepJson);
|
|
94
|
+
}
|
|
95
|
+
const scenario = this.createScenarioJson(feature, child.scenario, steps, "scenario", scenarioIndex);
|
|
96
|
+
if (rule) {
|
|
97
|
+
scenario.id = `${feature.name};${rule.name};${scenario.name}`;
|
|
98
|
+
}
|
|
99
|
+
if (Object.keys(background).length !== 0 && background !== undefined) {
|
|
100
|
+
scenariosJson.push(background);
|
|
101
|
+
}
|
|
102
|
+
scenariosJson.push(scenario);
|
|
103
|
+
scenarioIndex++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.UuvCustomFormatter = UuvCustomFormatter;
|
|
@@ -10,10 +10,10 @@ const messages_1 = require("@cucumber/messages");
|
|
|
10
10
|
const fs_1 = __importDefault(require("fs"));
|
|
11
11
|
const runner_playwright_1 = require("../lib/runner-playwright");
|
|
12
12
|
const multiple_cucumber_html_reporter_1 = __importDefault(require("multiple-cucumber-html-reporter"));
|
|
13
|
-
const cucumber_json_report_formatter_1 = require("cucumber-json-report-formatter");
|
|
14
13
|
const nanoid_1 = require("nanoid");
|
|
15
14
|
const chalk_1 = __importDefault(require("chalk"));
|
|
16
15
|
const chalk_table_1 = __importDefault(require("chalk-table"));
|
|
16
|
+
const uuv_custom_formatter_1 = require("./uuv-custom-formatter");
|
|
17
17
|
const NANOS_IN_SECOND = 1000000000;
|
|
18
18
|
const NANOS_IN_MILLISSECOND = 1000000;
|
|
19
19
|
var GeneratedReportType;
|
|
@@ -364,7 +364,7 @@ class UuvPlaywrightReporterHelper {
|
|
|
364
364
|
return [...new Set(suite.allTests().map(testCase => testCase.location?.file))];
|
|
365
365
|
}
|
|
366
366
|
async formatCucumberMessageFile(inputMessageFile, outputFormattedFileJson) {
|
|
367
|
-
const formatter = new
|
|
367
|
+
const formatter = new uuv_custom_formatter_1.UuvCustomFormatter();
|
|
368
368
|
await formatter.parseCucumberJson(inputMessageFile, outputFormattedFileJson);
|
|
369
369
|
}
|
|
370
370
|
generateHtmlReportFromJson(reportDirHtml, reportDirJson) {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/playwright",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
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 run E2E tests written in cucumber(BDD) with playwright.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "https://github.com/Orange-OpenSource/uuv"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://orange-opensource.github.io/uuv/",
|
|
13
13
|
"bin": {
|
|
14
14
|
"uuv": "bin/uuv"
|
|
15
15
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@cucumber/cucumber": "9.3.0",
|
|
48
48
|
"@playwright/test": "1.33.0",
|
|
49
|
-
"@uuv/runner-commons": "1.6.
|
|
49
|
+
"@uuv/runner-commons": "1.6.2",
|
|
50
50
|
"axe-core": "4.7.2",
|
|
51
51
|
"axe-playwright": "1.2.3",
|
|
52
52
|
"chalk": "4.1.2",
|