@arghajit/dummy 0.1.2-beta-7 → 0.1.2-beta-8
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.
|
@@ -23,11 +23,11 @@ export declare class PlaywrightPulseReporter implements Reporter {
|
|
|
23
23
|
private _getBaseTestId;
|
|
24
24
|
private _getStatusOrder;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Fixed: Groups all run attempts for a single logical test case and determines flaky status.
|
|
27
27
|
* This ensures that tests with multiple retries are counted as single test case
|
|
28
28
|
* while preserving all retry data in the JSON report.
|
|
29
29
|
* @param allAttempts An array of all individual test run attempts.
|
|
30
|
-
* @returns
|
|
30
|
+
* @returns Summary statistics for the test run.
|
|
31
31
|
*/
|
|
32
32
|
private _getFinalizedResults;
|
|
33
33
|
onError(error: any): void;
|
|
@@ -39,10 +39,7 @@ const path = __importStar(require("path"));
|
|
|
39
39
|
const crypto_1 = require("crypto");
|
|
40
40
|
const ua_parser_js_1 = require("ua-parser-js");
|
|
41
41
|
const os = __importStar(require("os"));
|
|
42
|
-
const convertStatus = (status, testCase
|
|
43
|
-
if (status === "passed" && retryCount > 0) {
|
|
44
|
-
return "flaky";
|
|
45
|
-
}
|
|
42
|
+
const convertStatus = (status, testCase) => {
|
|
46
43
|
if ((testCase === null || testCase === void 0 ? void 0 : testCase.expectedStatus) === "failed") {
|
|
47
44
|
if (status === "passed")
|
|
48
45
|
return "flaky";
|
|
@@ -165,7 +162,7 @@ class PlaywrightPulseReporter {
|
|
|
165
162
|
}
|
|
166
163
|
return finalString.trim();
|
|
167
164
|
}
|
|
168
|
-
async processStep(step, testId, browserDetails, testCase
|
|
165
|
+
async processStep(step, testId, browserDetails, testCase) {
|
|
169
166
|
var _a, _b, _c, _d;
|
|
170
167
|
let stepStatus = "passed";
|
|
171
168
|
let errorMessage = ((_a = step.error) === null || _a === void 0 ? void 0 : _a.message) || undefined;
|
|
@@ -173,7 +170,7 @@ class PlaywrightPulseReporter {
|
|
|
173
170
|
stepStatus = "skipped";
|
|
174
171
|
}
|
|
175
172
|
else {
|
|
176
|
-
stepStatus = convertStatus(step.error ? "failed" : "passed", testCase
|
|
173
|
+
stepStatus = convertStatus(step.error ? "failed" : "passed", testCase);
|
|
177
174
|
}
|
|
178
175
|
const duration = step.duration;
|
|
179
176
|
const startTime = new Date(step.startTime);
|
|
@@ -206,13 +203,13 @@ class PlaywrightPulseReporter {
|
|
|
206
203
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
207
204
|
const project = (_a = test.parent) === null || _a === void 0 ? void 0 : _a.project();
|
|
208
205
|
const browserDetails = this.getBrowserDetails(test);
|
|
209
|
-
const testStatus = convertStatus(result.status, test
|
|
206
|
+
const testStatus = convertStatus(result.status, test);
|
|
210
207
|
const startTime = new Date(result.startTime);
|
|
211
208
|
const endTime = new Date(startTime.getTime() + result.duration);
|
|
212
209
|
const processAllSteps = async (steps) => {
|
|
213
210
|
let processed = [];
|
|
214
211
|
for (const step of steps) {
|
|
215
|
-
const processedStep = await this.processStep(step, test.id, browserDetails, test
|
|
212
|
+
const processedStep = await this.processStep(step, test.id, browserDetails, test);
|
|
216
213
|
processed.push(processedStep);
|
|
217
214
|
if (step.steps && step.steps.length > 0) {
|
|
218
215
|
processedStep.steps = await processAllSteps(step.steps);
|
|
@@ -244,9 +241,8 @@ class PlaywrightPulseReporter {
|
|
|
244
241
|
? JSON.stringify(this.config.metadata)
|
|
245
242
|
: undefined,
|
|
246
243
|
};
|
|
247
|
-
const testIdWithRetries = `${test.id}-${result.retry}`;
|
|
248
244
|
const pulseResult = {
|
|
249
|
-
id:
|
|
245
|
+
id: test.id, // Fixed: Use consistent test ID across all retries
|
|
250
246
|
runId: this.currentRunId, // Keep same runId for all retries of the same test
|
|
251
247
|
name: test.titlePath().join(" > "),
|
|
252
248
|
suiteName: (project === null || project === void 0 ? void 0 : project.name) || ((_e = this.config.projects[0]) === null || _e === void 0 ? void 0 : _e.name) || "Default Suite",
|
|
@@ -274,7 +270,7 @@ class PlaywrightPulseReporter {
|
|
|
274
270
|
if (!attachment.path)
|
|
275
271
|
continue;
|
|
276
272
|
try {
|
|
277
|
-
const testSubfolder =
|
|
273
|
+
const testSubfolder = `${test.id}-${result.retry}`.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
278
274
|
const safeAttachmentName = path
|
|
279
275
|
.basename(attachment.path)
|
|
280
276
|
.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
@@ -307,10 +303,6 @@ class PlaywrightPulseReporter {
|
|
|
307
303
|
this.results.push(pulseResult);
|
|
308
304
|
}
|
|
309
305
|
_getBaseTestId(testResultId) {
|
|
310
|
-
const parts = testResultId.split("-");
|
|
311
|
-
if (parts.length > 1 && !isNaN(parseInt(parts[parts.length - 1]))) {
|
|
312
|
-
return parts.slice(0, -1).join("-");
|
|
313
|
-
}
|
|
314
306
|
return testResultId;
|
|
315
307
|
}
|
|
316
308
|
_getStatusOrder(status) {
|
|
@@ -328,11 +320,11 @@ class PlaywrightPulseReporter {
|
|
|
328
320
|
}
|
|
329
321
|
}
|
|
330
322
|
/**
|
|
331
|
-
*
|
|
323
|
+
* Fixed: Groups all run attempts for a single logical test case and determines flaky status.
|
|
332
324
|
* This ensures that tests with multiple retries are counted as single test case
|
|
333
325
|
* while preserving all retry data in the JSON report.
|
|
334
326
|
* @param allAttempts An array of all individual test run attempts.
|
|
335
|
-
* @returns
|
|
327
|
+
* @returns Summary statistics for the test run.
|
|
336
328
|
*/
|
|
337
329
|
_getFinalizedResults(allAttempts) {
|
|
338
330
|
const groupedResults = new Map();
|
|
@@ -343,15 +335,18 @@ class PlaywrightPulseReporter {
|
|
|
343
335
|
}
|
|
344
336
|
groupedResults.get(baseTestId).push(attempt);
|
|
345
337
|
}
|
|
346
|
-
|
|
338
|
+
let passed = 0;
|
|
339
|
+
let failed = 0;
|
|
340
|
+
let skipped = 0;
|
|
341
|
+
let flaky = 0;
|
|
347
342
|
for (const [baseId, runs] of groupedResults.entries()) {
|
|
348
343
|
let overallStatus = "passed";
|
|
349
344
|
if (runs.length > 1) {
|
|
350
|
-
const hasPassedRun = runs.some(run => run.status === "passed");
|
|
351
|
-
const hasFailedRun = runs.some(run => run.status === "failed");
|
|
345
|
+
const hasPassedRun = runs.some((run) => run.status === "passed");
|
|
346
|
+
const hasFailedRun = runs.some((run) => run.status === "failed");
|
|
352
347
|
if (hasPassedRun && hasFailedRun) {
|
|
353
348
|
overallStatus = "flaky";
|
|
354
|
-
runs.forEach(run => {
|
|
349
|
+
runs.forEach((run) => {
|
|
355
350
|
if (run.status === "passed" || run.status === "failed") {
|
|
356
351
|
run.status = "flaky";
|
|
357
352
|
}
|
|
@@ -360,34 +355,36 @@ class PlaywrightPulseReporter {
|
|
|
360
355
|
else if (hasFailedRun) {
|
|
361
356
|
overallStatus = "failed";
|
|
362
357
|
}
|
|
363
|
-
else if (runs.some(run => run.status === "skipped")) {
|
|
358
|
+
else if (runs.some((run) => run.status === "skipped")) {
|
|
364
359
|
overallStatus = "skipped";
|
|
365
360
|
}
|
|
366
361
|
}
|
|
367
362
|
else {
|
|
368
363
|
overallStatus = runs[0].status;
|
|
369
364
|
}
|
|
370
|
-
//
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
365
|
+
// Count each logical test once
|
|
366
|
+
switch (overallStatus) {
|
|
367
|
+
case "passed":
|
|
368
|
+
passed++;
|
|
369
|
+
break;
|
|
370
|
+
case "failed":
|
|
371
|
+
failed++;
|
|
372
|
+
break;
|
|
373
|
+
case "skipped":
|
|
374
|
+
skipped++;
|
|
375
|
+
break;
|
|
376
|
+
case "flaky":
|
|
377
|
+
flaky++;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
passed,
|
|
383
|
+
failed,
|
|
384
|
+
skipped,
|
|
385
|
+
flaky,
|
|
386
|
+
totalTests: groupedResults.size,
|
|
387
|
+
};
|
|
391
388
|
}
|
|
392
389
|
onError(error) {
|
|
393
390
|
var _a;
|
|
@@ -441,12 +438,12 @@ class PlaywrightPulseReporter {
|
|
|
441
438
|
}
|
|
442
439
|
}
|
|
443
440
|
}
|
|
444
|
-
const
|
|
445
|
-
finalRunData.passed =
|
|
446
|
-
finalRunData.failed =
|
|
447
|
-
finalRunData.skipped =
|
|
448
|
-
finalRunData.flaky =
|
|
449
|
-
finalRunData.totalTests =
|
|
441
|
+
const summaryStats = this._getFinalizedResults(allShardRawResults);
|
|
442
|
+
finalRunData.passed = summaryStats.passed;
|
|
443
|
+
finalRunData.failed = summaryStats.failed;
|
|
444
|
+
finalRunData.skipped = summaryStats.skipped;
|
|
445
|
+
finalRunData.flaky = summaryStats.flaky;
|
|
446
|
+
finalRunData.totalTests = summaryStats.totalTests;
|
|
450
447
|
const reviveDates = (key, value) => {
|
|
451
448
|
const isoDateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
|
|
452
449
|
if (typeof value === "string" && isoDateRegex.test(value)) {
|
|
@@ -458,7 +455,7 @@ class PlaywrightPulseReporter {
|
|
|
458
455
|
const properlyTypedResults = JSON.parse(JSON.stringify(allShardRawResults), reviveDates);
|
|
459
456
|
return {
|
|
460
457
|
run: finalRunData,
|
|
461
|
-
results: properlyTypedResults, //
|
|
458
|
+
results: properlyTypedResults, // Include ALL retry attempts
|
|
462
459
|
metadata: { generatedAt: new Date().toISOString() },
|
|
463
460
|
};
|
|
464
461
|
}
|
|
@@ -494,7 +491,7 @@ class PlaywrightPulseReporter {
|
|
|
494
491
|
}
|
|
495
492
|
let finalReport;
|
|
496
493
|
const allAttempts = this.results;
|
|
497
|
-
const
|
|
494
|
+
const summaryStats = this._getFinalizedResults(this.results);
|
|
498
495
|
const runEndTime = Date.now();
|
|
499
496
|
const duration = runEndTime - this.runStartTime;
|
|
500
497
|
const runId = this.currentRunId;
|
|
@@ -502,26 +499,21 @@ class PlaywrightPulseReporter {
|
|
|
502
499
|
const runData = {
|
|
503
500
|
id: runId,
|
|
504
501
|
timestamp: new Date(this.runStartTime),
|
|
505
|
-
totalTests:
|
|
506
|
-
passed:
|
|
507
|
-
failed:
|
|
508
|
-
skipped:
|
|
509
|
-
flaky:
|
|
502
|
+
totalTests: summaryStats.totalTests, // Fixed: Count each logical test once
|
|
503
|
+
passed: summaryStats.passed,
|
|
504
|
+
failed: summaryStats.failed,
|
|
505
|
+
skipped: summaryStats.skipped,
|
|
506
|
+
flaky: summaryStats.flaky,
|
|
510
507
|
duration,
|
|
511
508
|
environment: environmentDetails,
|
|
512
509
|
};
|
|
513
|
-
finalReport = {
|
|
514
|
-
run: runData,
|
|
515
|
-
results: allAttempts, // Include all retry attempts in the JSON
|
|
516
|
-
metadata: { generatedAt: new Date().toISOString() },
|
|
517
|
-
};
|
|
518
510
|
if (this.isSharded) {
|
|
519
511
|
finalReport = await this._mergeShardResults(runData);
|
|
520
512
|
}
|
|
521
513
|
else {
|
|
522
514
|
finalReport = {
|
|
523
515
|
run: runData,
|
|
524
|
-
results: allAttempts, //
|
|
516
|
+
results: allAttempts, // Include all retry attempts in the JSON
|
|
525
517
|
metadata: { generatedAt: new Date().toISOString() },
|
|
526
518
|
};
|
|
527
519
|
}
|
|
@@ -619,7 +611,7 @@ class PlaywrightPulseReporter {
|
|
|
619
611
|
console.warn(`Pulse Reporter: Could not parse report file ${filePath}. Skipping. Error: ${err.message}`);
|
|
620
612
|
}
|
|
621
613
|
}
|
|
622
|
-
const
|
|
614
|
+
const summaryStats = this._getFinalizedResults(allResultsFromAllFiles);
|
|
623
615
|
for (const res of allResultsFromAllFiles) {
|
|
624
616
|
if (res.startTime.getTime() < earliestStartTime)
|
|
625
617
|
earliestStartTime = res.startTime.getTime();
|
|
@@ -631,16 +623,16 @@ class PlaywrightPulseReporter {
|
|
|
631
623
|
id: `merged-${Date.now()}`,
|
|
632
624
|
timestamp: latestTimestamp,
|
|
633
625
|
environment: lastRunEnvironment,
|
|
634
|
-
totalTests:
|
|
635
|
-
passed:
|
|
636
|
-
failed:
|
|
637
|
-
skipped:
|
|
638
|
-
flaky:
|
|
626
|
+
totalTests: summaryStats.totalTests, // Fixed: Count each logical test once
|
|
627
|
+
passed: summaryStats.passed,
|
|
628
|
+
failed: summaryStats.failed,
|
|
629
|
+
skipped: summaryStats.skipped,
|
|
630
|
+
flaky: summaryStats.flaky,
|
|
639
631
|
duration: totalDuration,
|
|
640
632
|
};
|
|
641
633
|
const finalReport = {
|
|
642
634
|
run: combinedRun,
|
|
643
|
-
results: allResultsFromAllFiles, //
|
|
635
|
+
results: allResultsFromAllFiles, // Include ALL retry attempts
|
|
644
636
|
metadata: {
|
|
645
637
|
generatedAt: new Date().toISOString(),
|
|
646
638
|
},
|
|
@@ -652,7 +644,7 @@ class PlaywrightPulseReporter {
|
|
|
652
644
|
return value;
|
|
653
645
|
}, 2));
|
|
654
646
|
if (this.printsToStdio()) {
|
|
655
|
-
console.log(`PlaywrightPulseReporter: ✅ Merged report with ${allResultsFromAllFiles.length} total retry attempts (${
|
|
647
|
+
console.log(`PlaywrightPulseReporter: ✅ Merged report with ${allResultsFromAllFiles.length} total retry attempts (${summaryStats.totalTests} unique tests) saved to ${finalOutputPath}`);
|
|
656
648
|
}
|
|
657
649
|
}
|
|
658
650
|
catch (err) {
|
package/package.json
CHANGED