@bigbinary/neeto-playwright-reporter 1.3.18 → 1.3.20
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/index.cjs.js +31 -16
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +31 -16
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare class MyReporter implements Reporter {
|
|
|
23
23
|
heartbeatInterval: NodeJS.Timeout | null;
|
|
24
24
|
constructor(options: ReporterOptionParams);
|
|
25
25
|
onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
|
|
26
|
-
onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
|
|
26
|
+
onTestBegin: ({ id, title, repeatEachIndex }: TestCase, { retry }: TestResult) => Promise<void>;
|
|
27
27
|
onTestEnd: (testCase: TestCase, { status, duration, errors, error, retry, attachments }: TestResult) => Promise<void>;
|
|
28
28
|
onEnd: ({ status, duration }: FullResult) => Promise<void>;
|
|
29
29
|
}
|
package/index.js
CHANGED
|
@@ -18605,6 +18605,13 @@ const sendHeartBeatSignal = async (ciBuildId) => {
|
|
|
18605
18605
|
}
|
|
18606
18606
|
};
|
|
18607
18607
|
|
|
18608
|
+
const evaluateStatus = (outcome, status) => {
|
|
18609
|
+
if (outcome === "flaky")
|
|
18610
|
+
return outcome;
|
|
18611
|
+
else
|
|
18612
|
+
return status;
|
|
18613
|
+
};
|
|
18614
|
+
|
|
18608
18615
|
const setAuthHeaders = ({ projectKey, apiKey, }) => {
|
|
18609
18616
|
axios.defaults.headers = {
|
|
18610
18617
|
...axios.defaults.headers,
|
|
@@ -18627,11 +18634,11 @@ const testEntitiesApi = { create };
|
|
|
18627
18634
|
class MyReporter {
|
|
18628
18635
|
constructor(options) {
|
|
18629
18636
|
this.onBegin = async (config, rootSuite) => {
|
|
18630
|
-
var _a, _b;
|
|
18637
|
+
var _a, _b, _c;
|
|
18631
18638
|
const shard = config.shard;
|
|
18632
18639
|
this.config = config;
|
|
18633
18640
|
this.currentShard = shard === null || shard === void 0 ? void 0 : shard.current;
|
|
18634
|
-
let attempts;
|
|
18641
|
+
let attempts = {};
|
|
18635
18642
|
this.totalTestCount = rootSuite.allTests().length;
|
|
18636
18643
|
try {
|
|
18637
18644
|
const runDetails = {
|
|
@@ -18655,11 +18662,12 @@ class MyReporter {
|
|
|
18655
18662
|
}));
|
|
18656
18663
|
}
|
|
18657
18664
|
catch (error) {
|
|
18658
|
-
const
|
|
18659
|
-
|
|
18665
|
+
const axiosError = error;
|
|
18666
|
+
const data = (_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
18667
|
+
consoleLogFormatted.error((_b = data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : axiosError.message);
|
|
18660
18668
|
consoleLogFormatted.error(ERRORS.onBegin.failedToInitializeRun);
|
|
18661
18669
|
process.kill(process.pid, "SIGKILL");
|
|
18662
|
-
process.exit(1);
|
|
18670
|
+
((_c = axiosError.response) === null || _c === void 0 ? void 0 : _c.status) === 422 && process.exit(1);
|
|
18663
18671
|
}
|
|
18664
18672
|
consoleLogFormatted.underline(MESSAGES.onBegin.testStarted);
|
|
18665
18673
|
consoleLogFormatted.dim(MESSAGES.onBegin.ciBuildId(this.ciBuildId));
|
|
@@ -18671,21 +18679,21 @@ class MyReporter {
|
|
|
18671
18679
|
this.heartbeatInterval = setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 45000);
|
|
18672
18680
|
this.attempts = attempts;
|
|
18673
18681
|
};
|
|
18674
|
-
this.onTestBegin = async ({ id, title }, { retry }) => {
|
|
18682
|
+
this.onTestBegin = async ({ id, title, repeatEachIndex }, { retry }) => {
|
|
18675
18683
|
var _a, _b;
|
|
18676
18684
|
this.retryAttemptStartedAt = new Date();
|
|
18677
18685
|
this.unreportedAttemptCount++;
|
|
18678
18686
|
consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title));
|
|
18679
18687
|
try {
|
|
18680
|
-
while (!((_b = (_a = this.attempts) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b["0"]))
|
|
18688
|
+
while (!((_b = (_a = this.attempts) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b["0-0"]))
|
|
18681
18689
|
await waitUntilTimeout(100); // Poll every 100 milliseconds
|
|
18682
18690
|
const attemptsPayload = {
|
|
18683
18691
|
status: "running",
|
|
18684
18692
|
started_at: this.retryAttemptStartedAt.toString(),
|
|
18685
18693
|
shard: this.currentShard,
|
|
18686
18694
|
};
|
|
18687
|
-
if (retry === 0) {
|
|
18688
|
-
await attemptsApi.update(this.ciBuildId, id, this.attempts[id]["0"], attemptsPayload);
|
|
18695
|
+
if (retry === 0 && repeatEachIndex === 0) {
|
|
18696
|
+
await attemptsApi.update(this.ciBuildId, id, this.attempts[id]["0-0"], attemptsPayload);
|
|
18689
18697
|
}
|
|
18690
18698
|
else {
|
|
18691
18699
|
const { data: { history_id, attempt_id }, } = await attemptsApi.create(this.ciBuildId, id, attemptsPayload);
|
|
@@ -18693,7 +18701,7 @@ class MyReporter {
|
|
|
18693
18701
|
...this.attempts,
|
|
18694
18702
|
[history_id]: {
|
|
18695
18703
|
...this.attempts[history_id],
|
|
18696
|
-
[
|
|
18704
|
+
[`${retry}-${repeatEachIndex}`]: attempt_id,
|
|
18697
18705
|
},
|
|
18698
18706
|
};
|
|
18699
18707
|
this.testAttemptIds.push(`${history_id}-${attempt_id}`);
|
|
@@ -18706,13 +18714,20 @@ class MyReporter {
|
|
|
18706
18714
|
}
|
|
18707
18715
|
};
|
|
18708
18716
|
this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
|
|
18717
|
+
var _a;
|
|
18709
18718
|
const completedAt = new Date();
|
|
18710
18719
|
const errorLocation = error === null || error === void 0 ? void 0 : error.location;
|
|
18711
|
-
const { id, title,
|
|
18720
|
+
const { id, title, repeatEachIndex } = testCase;
|
|
18721
|
+
const testOutcome = testCase.outcome();
|
|
18722
|
+
const outcome = {
|
|
18723
|
+
shard: (_a = this.currentShard) !== null && _a !== void 0 ? _a : 0,
|
|
18724
|
+
is_expected: testOutcome === "expected",
|
|
18725
|
+
repeat_each_index: repeatEachIndex,
|
|
18726
|
+
status: evaluateStatus(testOutcome, status),
|
|
18727
|
+
};
|
|
18712
18728
|
try {
|
|
18713
18729
|
const testResult = {
|
|
18714
|
-
outcome
|
|
18715
|
-
expected_status: expectedStatus,
|
|
18730
|
+
outcome,
|
|
18716
18731
|
status,
|
|
18717
18732
|
duration,
|
|
18718
18733
|
log: errors.map(error => { var _a; return (_a = error.message) !== null && _a !== void 0 ? _a : ""; }).join("\n"),
|
|
@@ -18739,10 +18754,10 @@ class MyReporter {
|
|
|
18739
18754
|
return uploadToS3(file, direct_upload);
|
|
18740
18755
|
}
|
|
18741
18756
|
}));
|
|
18742
|
-
while (!(this.attempts[id][retry] ||
|
|
18743
|
-
this.testAttemptIds.includes(`${id}-${this.attempts[id][retry]}`)))
|
|
18757
|
+
while (!(this.attempts[id][`${retry}-${repeatEachIndex}`] ||
|
|
18758
|
+
this.testAttemptIds.includes(`${id}-${this.attempts[id][`${retry}-${repeatEachIndex}`]}`)))
|
|
18744
18759
|
await waitUntilTimeout(100);
|
|
18745
|
-
this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][retry], testResult));
|
|
18760
|
+
this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][`${retry}-${repeatEachIndex}`], testResult));
|
|
18746
18761
|
}
|
|
18747
18762
|
catch (error) {
|
|
18748
18763
|
consoleLogFormatted.error(error.message);
|