@uuv/playwright 3.2.0 → 3.2.1
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.
|
@@ -16,6 +16,8 @@ declare class UuvPlaywrightReporterHelper {
|
|
|
16
16
|
private consoleReportMap;
|
|
17
17
|
private errors;
|
|
18
18
|
private currentFeatureFile;
|
|
19
|
+
private foundConf;
|
|
20
|
+
constructor();
|
|
19
21
|
createTestRunStartedEnvelope(config: FullConfig, suite: Suite, startTimestamp: {
|
|
20
22
|
seconds: number;
|
|
21
23
|
nanos: number;
|
|
@@ -48,6 +50,7 @@ declare class UuvPlaywrightReporterHelper {
|
|
|
48
50
|
nanos: number;
|
|
49
51
|
};
|
|
50
52
|
getOriginalFeatureFile(generatedFile: string): string | undefined;
|
|
53
|
+
getTestSuiteName(featureFile: string): string;
|
|
51
54
|
getCurrentRunningScenario(test: TestCase, featureFile: string): string;
|
|
52
55
|
private addError;
|
|
53
56
|
private getStatus;
|
|
@@ -51,6 +51,19 @@ class UuvPlaywrightReporterHelper {
|
|
|
51
51
|
consoleReportMap = new Map();
|
|
52
52
|
errors = [];
|
|
53
53
|
currentFeatureFile;
|
|
54
|
+
foundConf;
|
|
55
|
+
constructor() {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
const bddgenConfAsString = process.env.PLAYWRIGHT_BDD_CONFIGS;
|
|
59
|
+
if (bddgenConfAsString) {
|
|
60
|
+
const bddgenConf = JSON.parse(bddgenConfAsString);
|
|
61
|
+
if (Object.keys.length > 0) {
|
|
62
|
+
const foundPath = Object.keys(bddgenConf)[0];
|
|
63
|
+
this.foundConf = bddgenConf[foundPath];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
54
67
|
createTestRunStartedEnvelope(config, suite, startTimestamp) {
|
|
55
68
|
this.testDir = config.projects[0].testDir;
|
|
56
69
|
const featureFiles = this.getFeatureFiles(suite);
|
|
@@ -90,7 +103,7 @@ class UuvPlaywrightReporterHelper {
|
|
|
90
103
|
}
|
|
91
104
|
runner_commons_1.UUVEventEmitter.getInstance().emitTestStarted({
|
|
92
105
|
testName: test.title,
|
|
93
|
-
testSuiteName: featureFile,
|
|
106
|
+
testSuiteName: this.getTestSuiteName(featureFile),
|
|
94
107
|
testSuitelocation: featureFile
|
|
95
108
|
});
|
|
96
109
|
}
|
|
@@ -213,21 +226,21 @@ class UuvPlaywrightReporterHelper {
|
|
|
213
226
|
case "passed":
|
|
214
227
|
runner_commons_1.UUVEventEmitter.getInstance().emitTestFinished({
|
|
215
228
|
testName: test.title,
|
|
216
|
-
testSuiteName: featureFile,
|
|
229
|
+
testSuiteName: this.getTestSuiteName(featureFile),
|
|
217
230
|
duration: result.duration
|
|
218
231
|
});
|
|
219
232
|
break;
|
|
220
233
|
case "failed":
|
|
221
234
|
runner_commons_1.UUVEventEmitter.getInstance().emitTestFailed({
|
|
222
235
|
testName: test.title,
|
|
223
|
-
testSuiteName: featureFile,
|
|
236
|
+
testSuiteName: this.getTestSuiteName(featureFile),
|
|
224
237
|
duration: result.duration
|
|
225
238
|
});
|
|
226
239
|
break;
|
|
227
240
|
default:
|
|
228
241
|
runner_commons_1.UUVEventEmitter.getInstance().emitTestIgnored({
|
|
229
242
|
testName: test.title,
|
|
230
|
-
testSuiteName: featureFile
|
|
243
|
+
testSuiteName: this.getTestSuiteName(featureFile)
|
|
231
244
|
});
|
|
232
245
|
}
|
|
233
246
|
}
|
|
@@ -236,7 +249,7 @@ class UuvPlaywrightReporterHelper {
|
|
|
236
249
|
if (featureTestCaseStatus) {
|
|
237
250
|
if (Object.entries(featureTestCaseStatus).find(([, value]) => value === "todo") === undefined) {
|
|
238
251
|
runner_commons_1.UUVEventEmitter.getInstance().emitTestSuiteFinished({
|
|
239
|
-
testSuiteName: featureFile
|
|
252
|
+
testSuiteName: this.getTestSuiteName(featureFile)
|
|
240
253
|
});
|
|
241
254
|
}
|
|
242
255
|
}
|
|
@@ -273,7 +286,7 @@ class UuvPlaywrightReporterHelper {
|
|
|
273
286
|
initConsoleReportIfNotExists(featureFile) {
|
|
274
287
|
if (!this.consoleReportMap.get(featureFile)) {
|
|
275
288
|
runner_commons_1.UUVEventEmitter.getInstance().emitTestSuiteStarted({
|
|
276
|
-
testSuiteName: featureFile,
|
|
289
|
+
testSuiteName: this.getTestSuiteName(featureFile),
|
|
277
290
|
testSuitelocation: featureFile
|
|
278
291
|
});
|
|
279
292
|
this.consoleReportMap.set(featureFile, new ReportOfFeature());
|
|
@@ -311,24 +324,19 @@ class UuvPlaywrightReporterHelper {
|
|
|
311
324
|
};
|
|
312
325
|
}
|
|
313
326
|
getOriginalFeatureFile(generatedFile) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
// @ts-ignore
|
|
319
|
-
const projectDir = process.env.CONFIG_DIR;
|
|
320
|
-
if (bddgenConfAsString && projectDir) {
|
|
321
|
-
const bddgenConf = JSON.parse(bddgenConfAsString);
|
|
322
|
-
const foundPath = Object.keys(bddgenConf).find(key => generatedFile.startsWith(key));
|
|
323
|
-
if (foundPath) {
|
|
324
|
-
const foundConf = bddgenConf[foundPath];
|
|
325
|
-
return path_1.default.relative(process.cwd(), generatedFile
|
|
326
|
-
.replaceAll(foundConf.outputDir, foundConf.featuresRoot)
|
|
327
|
-
.replaceAll(".feature.spec.js", ".feature"));
|
|
328
|
-
}
|
|
327
|
+
if (this.foundConf) {
|
|
328
|
+
return path_1.default.relative(process.cwd(), generatedFile
|
|
329
|
+
.replaceAll(this.foundConf.outputDir, this.foundConf.featuresRoot)
|
|
330
|
+
.replaceAll(".feature.spec.js", ".feature"));
|
|
329
331
|
}
|
|
330
332
|
return;
|
|
331
333
|
}
|
|
334
|
+
getTestSuiteName(featureFile) {
|
|
335
|
+
if (this.foundConf) {
|
|
336
|
+
return path_1.default.relative(this.foundConf.featuresRoot, path_1.default.join(process.cwd(), featureFile));
|
|
337
|
+
}
|
|
338
|
+
return featureFile;
|
|
339
|
+
}
|
|
332
340
|
getCurrentRunningScenario(test, featureFile) {
|
|
333
341
|
const counter = `[${test.parent.allTests().filter(test => test.results.length > 0).length}/${test.parent.allTests().length}]`;
|
|
334
342
|
return `File ${featureFile} > Scenario ${counter} - ${test.title}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/playwright",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
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",
|