@arghajit/dummy 0.1.2-beta-8 → 0.1.2-beta-9
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,13 +23,16 @@ export declare class PlaywrightPulseReporter implements Reporter {
|
|
|
23
23
|
private _getBaseTestId;
|
|
24
24
|
private _getStatusOrder;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* This
|
|
28
|
-
* while preserving all retry data in the JSON report.
|
|
26
|
+
* Groups all run attempts for a single logical test case and creates consolidated test results.
|
|
27
|
+
* This matches Playwright's default structure where retry attempts are grouped under one test entry.
|
|
29
28
|
* @param allAttempts An array of all individual test run attempts.
|
|
30
|
-
* @returns
|
|
29
|
+
* @returns An array of ConsolidatedTestResult objects, where each object represents one logical test with all its retry attempts.
|
|
31
30
|
*/
|
|
32
31
|
private _getFinalizedResults;
|
|
32
|
+
/**
|
|
33
|
+
* Helper method to get summary statistics from consolidated results
|
|
34
|
+
*/
|
|
35
|
+
private _getSummaryStats;
|
|
33
36
|
onError(error: any): void;
|
|
34
37
|
private _getEnvDetails;
|
|
35
38
|
private _writeShardResults;
|
|
@@ -320,11 +320,10 @@ class PlaywrightPulseReporter {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
|
-
*
|
|
324
|
-
* This
|
|
325
|
-
* while preserving all retry data in the JSON report.
|
|
323
|
+
* Groups all run attempts for a single logical test case and creates consolidated test results.
|
|
324
|
+
* This matches Playwright's default structure where retry attempts are grouped under one test entry.
|
|
326
325
|
* @param allAttempts An array of all individual test run attempts.
|
|
327
|
-
* @returns
|
|
326
|
+
* @returns An array of ConsolidatedTestResult objects, where each object represents one logical test with all its retry attempts.
|
|
328
327
|
*/
|
|
329
328
|
_getFinalizedResults(allAttempts) {
|
|
330
329
|
const groupedResults = new Map();
|
|
@@ -335,10 +334,7 @@ class PlaywrightPulseReporter {
|
|
|
335
334
|
}
|
|
336
335
|
groupedResults.get(baseTestId).push(attempt);
|
|
337
336
|
}
|
|
338
|
-
|
|
339
|
-
let failed = 0;
|
|
340
|
-
let skipped = 0;
|
|
341
|
-
let flaky = 0;
|
|
337
|
+
const finalResults = [];
|
|
342
338
|
for (const [baseId, runs] of groupedResults.entries()) {
|
|
343
339
|
let overallStatus = "passed";
|
|
344
340
|
if (runs.length > 1) {
|
|
@@ -362,8 +358,38 @@ class PlaywrightPulseReporter {
|
|
|
362
358
|
else {
|
|
363
359
|
overallStatus = runs[0].status;
|
|
364
360
|
}
|
|
365
|
-
//
|
|
366
|
-
|
|
361
|
+
// Sort runs to find the best representative run for metadata
|
|
362
|
+
runs.sort((a, b) => this._getStatusOrder(a.status) - this._getStatusOrder(b.status));
|
|
363
|
+
const bestRun = runs[0];
|
|
364
|
+
// Calculate total duration from the earliest start to the latest end time of all runs
|
|
365
|
+
const startTimes = runs.map((run) => run.startTime.getTime());
|
|
366
|
+
const endTimes = runs.map((run) => run.endTime.getTime());
|
|
367
|
+
const overallDuration = Math.max(...endTimes) - Math.min(...startTimes);
|
|
368
|
+
finalResults.push({
|
|
369
|
+
id: baseId,
|
|
370
|
+
name: bestRun.name,
|
|
371
|
+
suiteName: bestRun.suiteName,
|
|
372
|
+
status: overallStatus,
|
|
373
|
+
duration: overallDuration,
|
|
374
|
+
startTime: new Date(Math.min(...startTimes)),
|
|
375
|
+
endTime: new Date(Math.max(...endTimes)),
|
|
376
|
+
browser: bestRun.browser,
|
|
377
|
+
tags: bestRun.tags,
|
|
378
|
+
runs: runs.sort((a, b) => a.retries - b.retries), // Sort runs chronologically for the report
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
return finalResults;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Helper method to get summary statistics from consolidated results
|
|
385
|
+
*/
|
|
386
|
+
_getSummaryStats(consolidatedResults) {
|
|
387
|
+
let passed = 0;
|
|
388
|
+
let failed = 0;
|
|
389
|
+
let skipped = 0;
|
|
390
|
+
let flaky = 0;
|
|
391
|
+
for (const result of consolidatedResults) {
|
|
392
|
+
switch (result.status) {
|
|
367
393
|
case "passed":
|
|
368
394
|
passed++;
|
|
369
395
|
break;
|
|
@@ -383,7 +409,7 @@ class PlaywrightPulseReporter {
|
|
|
383
409
|
failed,
|
|
384
410
|
skipped,
|
|
385
411
|
flaky,
|
|
386
|
-
totalTests:
|
|
412
|
+
totalTests: consolidatedResults.length,
|
|
387
413
|
};
|
|
388
414
|
}
|
|
389
415
|
onError(error) {
|
|
@@ -438,7 +464,8 @@ class PlaywrightPulseReporter {
|
|
|
438
464
|
}
|
|
439
465
|
}
|
|
440
466
|
}
|
|
441
|
-
const
|
|
467
|
+
const consolidatedResults = this._getFinalizedResults(allShardRawResults);
|
|
468
|
+
const summaryStats = this._getSummaryStats(consolidatedResults);
|
|
442
469
|
finalRunData.passed = summaryStats.passed;
|
|
443
470
|
finalRunData.failed = summaryStats.failed;
|
|
444
471
|
finalRunData.skipped = summaryStats.skipped;
|
|
@@ -452,10 +479,10 @@ class PlaywrightPulseReporter {
|
|
|
452
479
|
}
|
|
453
480
|
return value;
|
|
454
481
|
};
|
|
455
|
-
const properlyTypedResults = JSON.parse(JSON.stringify(
|
|
482
|
+
const properlyTypedResults = JSON.parse(JSON.stringify(consolidatedResults), reviveDates);
|
|
456
483
|
return {
|
|
457
484
|
run: finalRunData,
|
|
458
|
-
results: properlyTypedResults, //
|
|
485
|
+
results: properlyTypedResults, // Use consolidated results that group retry attempts
|
|
459
486
|
metadata: { generatedAt: new Date().toISOString() },
|
|
460
487
|
};
|
|
461
488
|
}
|
|
@@ -491,7 +518,8 @@ class PlaywrightPulseReporter {
|
|
|
491
518
|
}
|
|
492
519
|
let finalReport;
|
|
493
520
|
const allAttempts = this.results;
|
|
494
|
-
const
|
|
521
|
+
const consolidatedResults = this._getFinalizedResults(this.results);
|
|
522
|
+
const summaryStats = this._getSummaryStats(consolidatedResults);
|
|
495
523
|
const runEndTime = Date.now();
|
|
496
524
|
const duration = runEndTime - this.runStartTime;
|
|
497
525
|
const runId = this.currentRunId;
|
|
@@ -499,7 +527,7 @@ class PlaywrightPulseReporter {
|
|
|
499
527
|
const runData = {
|
|
500
528
|
id: runId,
|
|
501
529
|
timestamp: new Date(this.runStartTime),
|
|
502
|
-
totalTests: summaryStats.totalTests,
|
|
530
|
+
totalTests: summaryStats.totalTests,
|
|
503
531
|
passed: summaryStats.passed,
|
|
504
532
|
failed: summaryStats.failed,
|
|
505
533
|
skipped: summaryStats.skipped,
|
|
@@ -513,7 +541,7 @@ class PlaywrightPulseReporter {
|
|
|
513
541
|
else {
|
|
514
542
|
finalReport = {
|
|
515
543
|
run: runData,
|
|
516
|
-
results:
|
|
544
|
+
results: consolidatedResults, // Use consolidated results that group retry attempts
|
|
517
545
|
metadata: { generatedAt: new Date().toISOString() },
|
|
518
546
|
};
|
|
519
547
|
}
|
|
@@ -596,7 +624,7 @@ class PlaywrightPulseReporter {
|
|
|
596
624
|
const json = JSON.parse(content);
|
|
597
625
|
if (json.results) {
|
|
598
626
|
json.results.forEach((testResult) => {
|
|
599
|
-
// Check if the TestResult has a 'runs' array (
|
|
627
|
+
// Check if the TestResult has a 'runs' array (consolidated format)
|
|
600
628
|
if ("runs" in testResult && Array.isArray(testResult.runs)) {
|
|
601
629
|
allResultsFromAllFiles.push(...testResult.runs);
|
|
602
630
|
}
|
|
@@ -611,7 +639,8 @@ class PlaywrightPulseReporter {
|
|
|
611
639
|
console.warn(`Pulse Reporter: Could not parse report file ${filePath}. Skipping. Error: ${err.message}`);
|
|
612
640
|
}
|
|
613
641
|
}
|
|
614
|
-
const
|
|
642
|
+
const consolidatedResults = this._getFinalizedResults(allResultsFromAllFiles);
|
|
643
|
+
const summaryStats = this._getSummaryStats(consolidatedResults);
|
|
615
644
|
for (const res of allResultsFromAllFiles) {
|
|
616
645
|
if (res.startTime.getTime() < earliestStartTime)
|
|
617
646
|
earliestStartTime = res.startTime.getTime();
|
|
@@ -623,7 +652,7 @@ class PlaywrightPulseReporter {
|
|
|
623
652
|
id: `merged-${Date.now()}`,
|
|
624
653
|
timestamp: latestTimestamp,
|
|
625
654
|
environment: lastRunEnvironment,
|
|
626
|
-
totalTests: summaryStats.totalTests,
|
|
655
|
+
totalTests: summaryStats.totalTests,
|
|
627
656
|
passed: summaryStats.passed,
|
|
628
657
|
failed: summaryStats.failed,
|
|
629
658
|
skipped: summaryStats.skipped,
|
|
@@ -632,7 +661,7 @@ class PlaywrightPulseReporter {
|
|
|
632
661
|
};
|
|
633
662
|
const finalReport = {
|
|
634
663
|
run: combinedRun,
|
|
635
|
-
results:
|
|
664
|
+
results: consolidatedResults, // Use consolidated results that group retry attempts
|
|
636
665
|
metadata: {
|
|
637
666
|
generatedAt: new Date().toISOString(),
|
|
638
667
|
},
|
package/package.json
CHANGED