@uuv/playwright 3.0.1 → 3.2.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/dist/lib/runner-playwright.d.ts +1 -1
- package/dist/lib/runner-playwright.js +6 -5
- package/dist/lib/watch-test-files.js +3 -3
- package/dist/reporter/uuv-playwright-reporter-helper.d.ts +2 -8
- package/dist/reporter/uuv-playwright-reporter-helper.js +31 -33
- package/dist/reporter/uuv-playwright-reporter.d.ts +1 -0
- package/dist/reporter/uuv-playwright-reporter.js +6 -2
- package/package.json +2 -2
- package/target-config/playwright.config.ts +2 -2
|
@@ -50,7 +50,7 @@ class UUVCliPlaywrightRunner {
|
|
|
50
50
|
projectDir;
|
|
51
51
|
tempDir;
|
|
52
52
|
name = "Playwright";
|
|
53
|
-
defaultBrowser = "
|
|
53
|
+
defaultBrowser = "chrome";
|
|
54
54
|
constructor(projectDir, tempDir) {
|
|
55
55
|
this.projectDir = projectDir;
|
|
56
56
|
this.tempDir = tempDir;
|
|
@@ -94,7 +94,8 @@ class UUVCliPlaywrightRunner {
|
|
|
94
94
|
}
|
|
95
95
|
return `${targetTestFile
|
|
96
96
|
.replaceAll("uuv/e2e/", ".uuv-features-gen/")
|
|
97
|
-
.replaceAll("
|
|
97
|
+
.replaceAll("e2e/", ".features-gen/")
|
|
98
|
+
.replaceAll(/\.feature$/g, ".feature.spec.js")}`;
|
|
98
99
|
}
|
|
99
100
|
runPlaywright(options) {
|
|
100
101
|
const configFile = `${this.projectDir}/playwright.config.ts`;
|
|
@@ -118,7 +119,7 @@ class UUVCliPlaywrightRunner {
|
|
|
118
119
|
"npx",
|
|
119
120
|
"playwright",
|
|
120
121
|
"test",
|
|
121
|
-
`--project
|
|
122
|
+
`--project="${options.browser}"`,
|
|
122
123
|
"-c",
|
|
123
124
|
configFile,
|
|
124
125
|
lodash_1.default.trimStart([
|
|
@@ -140,9 +141,9 @@ function executeSystemCommandHelper(command) {
|
|
|
140
141
|
console.log(chalk_1.default.gray(`Running command: ${command}`));
|
|
141
142
|
(0, child_process_1.execSync)(command, { stdio: "inherit" });
|
|
142
143
|
}
|
|
143
|
-
function executePreprocessor() {
|
|
144
|
+
function executePreprocessor(projectDir) {
|
|
144
145
|
console.log("running preprocessor...");
|
|
145
|
-
executeSystemCommandHelper(
|
|
146
|
+
executeSystemCommandHelper(`npx bddgen -c ${projectDir}/playwright.config.ts`);
|
|
146
147
|
console.log("preprocessor executed\n");
|
|
147
148
|
}
|
|
148
149
|
exports.executePreprocessor = executePreprocessor;
|
|
@@ -31,16 +31,16 @@ chokidar_1.default.watch(`${projectDir}/e2e/**/*.feature`, {
|
|
|
31
31
|
})
|
|
32
32
|
.on("change", () => {
|
|
33
33
|
console.log(chalk_1.default.yellowBright("\nRefreshing test files..."));
|
|
34
|
-
(0, runner_playwright_1.executePreprocessor)();
|
|
34
|
+
(0, runner_playwright_1.executePreprocessor)(projectDir);
|
|
35
35
|
console.log(chalk_1.default.yellowBright("Test files refreshed\n"));
|
|
36
36
|
})
|
|
37
37
|
.on("add", path => {
|
|
38
38
|
console.log(chalk_1.default.yellowBright(`\nFile ${path} has been added`));
|
|
39
|
-
(0, runner_playwright_1.executePreprocessor)();
|
|
39
|
+
(0, runner_playwright_1.executePreprocessor)(projectDir);
|
|
40
40
|
console.log(chalk_1.default.yellowBright("Test files refreshed\n"));
|
|
41
41
|
})
|
|
42
42
|
.on("unlink", path => {
|
|
43
43
|
console.log(chalk_1.default.yellowBright(`\nFile ${path} has been removed`));
|
|
44
|
-
(0, runner_playwright_1.executePreprocessor)();
|
|
44
|
+
(0, runner_playwright_1.executePreprocessor)(projectDir);
|
|
45
45
|
console.log(chalk_1.default.yellowBright("Test files refreshed\n"));
|
|
46
46
|
});
|
|
@@ -35,8 +35,8 @@ declare class UuvPlaywrightReporterHelper {
|
|
|
35
35
|
}): void;
|
|
36
36
|
private getTestStepKey;
|
|
37
37
|
createTestCaseFinishedEnvelope(test: TestCase, result: TestResult, featureFile: string, endTimestamp: any): void;
|
|
38
|
-
private
|
|
39
|
-
private
|
|
38
|
+
private handleTestEnd;
|
|
39
|
+
private handleTestSuiteFinishedIfNeeded;
|
|
40
40
|
private addResultErrors;
|
|
41
41
|
private createTestCaseErrorAttachmentsEnvelope;
|
|
42
42
|
private initConsoleReportIfNotExists;
|
|
@@ -68,12 +68,6 @@ declare class UuvPlaywrightReporterHelper {
|
|
|
68
68
|
logTestEnd(testCase: TestCase, result: TestResult): void;
|
|
69
69
|
private getResultIcon;
|
|
70
70
|
private getTestCaseTitle;
|
|
71
|
-
logTeamCity(line: any): void;
|
|
72
|
-
private teamcityFlowId;
|
|
73
|
-
private teamcityFlowIdAndParentFlowId;
|
|
74
|
-
private teamcityAddName;
|
|
75
|
-
private teamcityAddDuration;
|
|
76
|
-
private teamcityAddCustomField;
|
|
77
71
|
private getTagsParameter;
|
|
78
72
|
}
|
|
79
73
|
export default UuvPlaywrightReporterHelper;
|
|
@@ -15,6 +15,7 @@ const chalk_table_1 = __importDefault(require("chalk-table"));
|
|
|
15
15
|
const uuv_custom_formatter_1 = require("./uuv-custom-formatter");
|
|
16
16
|
const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const runner_commons_1 = require("@uuv/runner-commons");
|
|
18
19
|
const NANOS_IN_SECOND = 1000000000;
|
|
19
20
|
const NANOS_IN_MILLISSECOND = 1000000;
|
|
20
21
|
var GeneratedReportType;
|
|
@@ -87,7 +88,11 @@ class UuvPlaywrightReporterHelper {
|
|
|
87
88
|
this.testCasesAndTestCasesStartedIdMap.set(test.id, testCaseStartedId);
|
|
88
89
|
this.initConsoleReportIfNotExists(featureFile);
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitTestStarted({
|
|
92
|
+
testName: test.title,
|
|
93
|
+
testSuiteName: featureFile,
|
|
94
|
+
testSuitelocation: featureFile
|
|
95
|
+
});
|
|
91
96
|
}
|
|
92
97
|
createTestStepStartedEnvelope(test, step, featureFile, startTimestamp) {
|
|
93
98
|
const currentQuery = this.queries.get(featureFile);
|
|
@@ -180,7 +185,7 @@ class UuvPlaywrightReporterHelper {
|
|
|
180
185
|
return `${location.file.replaceAll("\\", "_")}-${location.line}-${location.column}`;
|
|
181
186
|
}
|
|
182
187
|
createTestCaseFinishedEnvelope(test, result, featureFile, endTimestamp) {
|
|
183
|
-
this.
|
|
188
|
+
this.handleTestEnd(result, test, featureFile);
|
|
184
189
|
this.updateTestcaseStatus(featureFile, test.id, "done");
|
|
185
190
|
const currentQuery = this.queries.get(featureFile);
|
|
186
191
|
if (currentQuery) {
|
|
@@ -201,26 +206,38 @@ class UuvPlaywrightReporterHelper {
|
|
|
201
206
|
this.addResultErrors(result, test, featureFile);
|
|
202
207
|
this.createTestCaseErrorAttachmentsEnvelope(testCaseStartedId, result);
|
|
203
208
|
}
|
|
204
|
-
this.
|
|
209
|
+
this.handleTestSuiteFinishedIfNeeded(featureFile);
|
|
205
210
|
}
|
|
206
|
-
|
|
211
|
+
handleTestEnd(result, test, featureFile) {
|
|
207
212
|
switch (result.status) {
|
|
208
213
|
case "passed":
|
|
209
|
-
|
|
214
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitTestFinished({
|
|
215
|
+
testName: test.title,
|
|
216
|
+
testSuiteName: featureFile,
|
|
217
|
+
duration: result.duration
|
|
218
|
+
});
|
|
210
219
|
break;
|
|
211
220
|
case "failed":
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitTestFailed({
|
|
222
|
+
testName: test.title,
|
|
223
|
+
testSuiteName: featureFile,
|
|
224
|
+
duration: result.duration
|
|
225
|
+
});
|
|
214
226
|
break;
|
|
215
227
|
default:
|
|
216
|
-
|
|
228
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitTestIgnored({
|
|
229
|
+
testName: test.title,
|
|
230
|
+
testSuiteName: featureFile
|
|
231
|
+
});
|
|
217
232
|
}
|
|
218
233
|
}
|
|
219
|
-
|
|
234
|
+
handleTestSuiteFinishedIfNeeded(featureFile) {
|
|
220
235
|
const featureTestCaseStatus = this.featureFileAndTestCaseStatusMap.get(featureFile);
|
|
221
236
|
if (featureTestCaseStatus) {
|
|
222
237
|
if (Object.entries(featureTestCaseStatus).find(([, value]) => value === "todo") === undefined) {
|
|
223
|
-
|
|
238
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitTestSuiteFinished({
|
|
239
|
+
testSuiteName: featureFile
|
|
240
|
+
});
|
|
224
241
|
}
|
|
225
242
|
}
|
|
226
243
|
}
|
|
@@ -255,7 +272,10 @@ class UuvPlaywrightReporterHelper {
|
|
|
255
272
|
}
|
|
256
273
|
initConsoleReportIfNotExists(featureFile) {
|
|
257
274
|
if (!this.consoleReportMap.get(featureFile)) {
|
|
258
|
-
|
|
275
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitTestSuiteStarted({
|
|
276
|
+
testSuiteName: featureFile,
|
|
277
|
+
testSuitelocation: featureFile
|
|
278
|
+
});
|
|
259
279
|
this.consoleReportMap.set(featureFile, new ReportOfFeature());
|
|
260
280
|
}
|
|
261
281
|
}
|
|
@@ -539,28 +559,6 @@ class UuvPlaywrightReporterHelper {
|
|
|
539
559
|
return chalk_1.default.redBright(message);
|
|
540
560
|
}
|
|
541
561
|
}
|
|
542
|
-
logTeamCity(line) {
|
|
543
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
544
|
-
// @ts-ignore
|
|
545
|
-
if (process.env.enableTeamcityLogging) {
|
|
546
|
-
console.log(line);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
teamcityFlowId(name) {
|
|
550
|
-
return "flowId='" + name.replaceAll("'", "|'") + "'";
|
|
551
|
-
}
|
|
552
|
-
teamcityFlowIdAndParentFlowId(name, parentName) {
|
|
553
|
-
return "flowId='" + name.replaceAll("'", "|'") + "' parent='" + parentName.replaceAll("'", "|'") + "'";
|
|
554
|
-
}
|
|
555
|
-
teamcityAddName(name) {
|
|
556
|
-
return "name='" + name.replaceAll("'", "|'") + "'";
|
|
557
|
-
}
|
|
558
|
-
teamcityAddDuration(result) {
|
|
559
|
-
return "duration='" + result.duration + "'";
|
|
560
|
-
}
|
|
561
|
-
teamcityAddCustomField(fieldName, value) {
|
|
562
|
-
return `${fieldName}='${value}'`;
|
|
563
|
-
}
|
|
564
562
|
getTagsParameter() {
|
|
565
563
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
566
564
|
// @ts-ignore
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, TestResult, TestStep } from "@playwright/test/reporter";
|
|
2
2
|
declare class UuvPlawrightReporter implements Reporter {
|
|
3
3
|
private helper;
|
|
4
|
+
constructor();
|
|
4
5
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
5
6
|
onError?(error: TestError): void;
|
|
6
7
|
onTestBegin(test: TestCase, result: TestResult): void;
|
|
@@ -5,13 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const uuv_playwright_reporter_helper_1 = __importDefault(require("./uuv-playwright-reporter-helper"));
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const runner_commons_1 = require("@uuv/runner-commons");
|
|
8
9
|
class UuvPlawrightReporter {
|
|
9
10
|
helper = new uuv_playwright_reporter_helper_1.default();
|
|
11
|
+
constructor() {
|
|
12
|
+
runner_commons_1.UUVListenerHelper.build();
|
|
13
|
+
}
|
|
10
14
|
onBegin(config, suite) {
|
|
11
15
|
const startTimestamp = this.helper.getTimestamp();
|
|
12
16
|
// console.log(`Starting the run with ${suite.allTests().length} tests`);
|
|
13
17
|
this.helper.createTestRunStartedEnvelope(config, suite, startTimestamp);
|
|
14
|
-
|
|
18
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitProgressStart();
|
|
15
19
|
console.info(chalk_1.default.yellow(`Starting the run with ${suite.allTests().length} tests`));
|
|
16
20
|
}
|
|
17
21
|
onError(error) {
|
|
@@ -66,7 +70,7 @@ class UuvPlawrightReporter {
|
|
|
66
70
|
else {
|
|
67
71
|
console.error(chalk_1.default.red(`Tests executed with status: ${result.status}`));
|
|
68
72
|
}
|
|
69
|
-
|
|
73
|
+
runner_commons_1.UUVEventEmitter.getInstance().emitProgressFinish();
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
exports.default = UuvPlawrightReporter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/playwright",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.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 playwright",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@cucumber/tag-expressions": "^6.0.0",
|
|
46
46
|
"@playwright/test": "^1.44.1",
|
|
47
|
-
"@uuv/runner-commons": "2.
|
|
47
|
+
"@uuv/runner-commons": "2.17.0",
|
|
48
48
|
"axe-core": "4.9.1",
|
|
49
49
|
"axe-playwright": "2.0.1",
|
|
50
50
|
"chalk-table": "^1.0.2",
|
|
@@ -46,11 +46,11 @@ export default defineConfig({
|
|
|
46
46
|
|
|
47
47
|
/* Test against branded browsers. */
|
|
48
48
|
{
|
|
49
|
-
name: "
|
|
49
|
+
name: "edge",
|
|
50
50
|
use: { ...devices["Desktop Edge"], channel: "msedge" },
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
name: "
|
|
53
|
+
name: "chrome",
|
|
54
54
|
use: { ...devices["Desktop Chrome"], channel: "chrome" },
|
|
55
55
|
},
|
|
56
56
|
],
|