@bigbinary/neeto-playwright-reporter 1.3.19 → 1.3.21
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 +29 -13
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +29 -13
- 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
|
@@ -18485,7 +18485,7 @@ const MESSAGES = {
|
|
|
18485
18485
|
startingTest: (titlePath) => `Starting ${titlePath}`,
|
|
18486
18486
|
},
|
|
18487
18487
|
onTestEnd: {
|
|
18488
|
-
reportedTest: (title) => `Reported ${title} to NeetoPlaydash`,
|
|
18488
|
+
reportedTest: ({ title, status, id }) => `Reported ${title} with id: ${id} to NeetoPlaydash with status ${status}`,
|
|
18489
18489
|
},
|
|
18490
18490
|
onEnd: {
|
|
18491
18491
|
runReported: "Run completed and reported to NeetoPlaydash 🎉",
|
|
@@ -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,
|
|
@@ -18672,21 +18679,21 @@ class MyReporter {
|
|
|
18672
18679
|
this.heartbeatInterval = setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 45000);
|
|
18673
18680
|
this.attempts = attempts;
|
|
18674
18681
|
};
|
|
18675
|
-
this.onTestBegin = async ({ id, title }, { retry }) => {
|
|
18682
|
+
this.onTestBegin = async ({ id, title, repeatEachIndex }, { retry }) => {
|
|
18676
18683
|
var _a, _b;
|
|
18677
18684
|
this.retryAttemptStartedAt = new Date();
|
|
18678
18685
|
this.unreportedAttemptCount++;
|
|
18679
18686
|
consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title));
|
|
18680
18687
|
try {
|
|
18681
|
-
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"]))
|
|
18682
18689
|
await waitUntilTimeout(100); // Poll every 100 milliseconds
|
|
18683
18690
|
const attemptsPayload = {
|
|
18684
18691
|
status: "running",
|
|
18685
18692
|
started_at: this.retryAttemptStartedAt.toString(),
|
|
18686
18693
|
shard: this.currentShard,
|
|
18687
18694
|
};
|
|
18688
|
-
if (retry === 0) {
|
|
18689
|
-
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);
|
|
18690
18697
|
}
|
|
18691
18698
|
else {
|
|
18692
18699
|
const { data: { history_id, attempt_id }, } = await attemptsApi.create(this.ciBuildId, id, attemptsPayload);
|
|
@@ -18694,7 +18701,7 @@ class MyReporter {
|
|
|
18694
18701
|
...this.attempts,
|
|
18695
18702
|
[history_id]: {
|
|
18696
18703
|
...this.attempts[history_id],
|
|
18697
|
-
[
|
|
18704
|
+
[`${retry}-${repeatEachIndex}`]: attempt_id,
|
|
18698
18705
|
},
|
|
18699
18706
|
};
|
|
18700
18707
|
this.testAttemptIds.push(`${history_id}-${attempt_id}`);
|
|
@@ -18707,13 +18714,20 @@ class MyReporter {
|
|
|
18707
18714
|
}
|
|
18708
18715
|
};
|
|
18709
18716
|
this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
|
|
18717
|
+
var _a;
|
|
18710
18718
|
const completedAt = new Date();
|
|
18711
18719
|
const errorLocation = error === null || error === void 0 ? void 0 : error.location;
|
|
18712
|
-
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
|
+
};
|
|
18713
18728
|
try {
|
|
18714
18729
|
const testResult = {
|
|
18715
|
-
outcome
|
|
18716
|
-
expected_status: expectedStatus,
|
|
18730
|
+
outcome,
|
|
18717
18731
|
status,
|
|
18718
18732
|
duration,
|
|
18719
18733
|
log: errors.map(error => { var _a; return (_a = error.message) !== null && _a !== void 0 ? _a : ""; }).join("\n"),
|
|
@@ -18740,10 +18754,13 @@ class MyReporter {
|
|
|
18740
18754
|
return uploadToS3(file, direct_upload);
|
|
18741
18755
|
}
|
|
18742
18756
|
}));
|
|
18743
|
-
while (!(this.attempts[id][retry] ||
|
|
18744
|
-
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}`]}`)))
|
|
18745
18759
|
await waitUntilTimeout(100);
|
|
18746
|
-
|
|
18760
|
+
const reportToNeetoPlaydash = attemptsApi.update(this.ciBuildId, id, this.attempts[id][`${retry}-${repeatEachIndex}`], testResult);
|
|
18761
|
+
this.testResultCalls.push(reportToNeetoPlaydash);
|
|
18762
|
+
await reportToNeetoPlaydash;
|
|
18763
|
+
consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest({ title, status, id }));
|
|
18747
18764
|
}
|
|
18748
18765
|
catch (error) {
|
|
18749
18766
|
consoleLogFormatted.error(error.message);
|
|
@@ -18752,7 +18769,6 @@ class MyReporter {
|
|
|
18752
18769
|
}
|
|
18753
18770
|
finally {
|
|
18754
18771
|
this.unreportedAttemptCount--;
|
|
18755
|
-
consoleLogFormatted.invertBackground(MESSAGES.onTestEnd.reportedTest(title));
|
|
18756
18772
|
}
|
|
18757
18773
|
};
|
|
18758
18774
|
this.onEnd = async ({ status, duration }) => {
|