@bigbinary/neeto-playwright-reporter 1.3.19 → 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 CHANGED
@@ -18624,6 +18624,13 @@ const sendHeartBeatSignal = async (ciBuildId) => {
18624
18624
  }
18625
18625
  };
18626
18626
 
18627
+ const evaluateStatus = (outcome, status) => {
18628
+ if (outcome === "flaky")
18629
+ return outcome;
18630
+ else
18631
+ return status;
18632
+ };
18633
+
18627
18634
  const setAuthHeaders = ({ projectKey, apiKey, }) => {
18628
18635
  axios.defaults.headers = {
18629
18636
  ...axios.defaults.headers,
@@ -18691,21 +18698,21 @@ class MyReporter {
18691
18698
  this.heartbeatInterval = setInterval(async () => await sendHeartBeatSignal(this.ciBuildId), 45000);
18692
18699
  this.attempts = attempts;
18693
18700
  };
18694
- this.onTestBegin = async ({ id, title }, { retry }) => {
18701
+ this.onTestBegin = async ({ id, title, repeatEachIndex }, { retry }) => {
18695
18702
  var _a, _b;
18696
18703
  this.retryAttemptStartedAt = new Date();
18697
18704
  this.unreportedAttemptCount++;
18698
18705
  consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title));
18699
18706
  try {
18700
- while (!((_b = (_a = this.attempts) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b["0"]))
18707
+ while (!((_b = (_a = this.attempts) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b["0-0"]))
18701
18708
  await waitUntilTimeout(100); // Poll every 100 milliseconds
18702
18709
  const attemptsPayload = {
18703
18710
  status: "running",
18704
18711
  started_at: this.retryAttemptStartedAt.toString(),
18705
18712
  shard: this.currentShard,
18706
18713
  };
18707
- if (retry === 0) {
18708
- await attemptsApi.update(this.ciBuildId, id, this.attempts[id]["0"], attemptsPayload);
18714
+ if (retry === 0 && repeatEachIndex === 0) {
18715
+ await attemptsApi.update(this.ciBuildId, id, this.attempts[id]["0-0"], attemptsPayload);
18709
18716
  }
18710
18717
  else {
18711
18718
  const { data: { history_id, attempt_id }, } = await attemptsApi.create(this.ciBuildId, id, attemptsPayload);
@@ -18713,7 +18720,7 @@ class MyReporter {
18713
18720
  ...this.attempts,
18714
18721
  [history_id]: {
18715
18722
  ...this.attempts[history_id],
18716
- [String(retry)]: attempt_id,
18723
+ [`${retry}-${repeatEachIndex}`]: attempt_id,
18717
18724
  },
18718
18725
  };
18719
18726
  this.testAttemptIds.push(`${history_id}-${attempt_id}`);
@@ -18726,13 +18733,20 @@ class MyReporter {
18726
18733
  }
18727
18734
  };
18728
18735
  this.onTestEnd = async (testCase, { status, duration, errors, error, retry, attachments }) => {
18736
+ var _a;
18729
18737
  const completedAt = new Date();
18730
18738
  const errorLocation = error === null || error === void 0 ? void 0 : error.location;
18731
- const { id, title, expectedStatus } = testCase;
18739
+ const { id, title, repeatEachIndex } = testCase;
18740
+ const testOutcome = testCase.outcome();
18741
+ const outcome = {
18742
+ shard: (_a = this.currentShard) !== null && _a !== void 0 ? _a : 0,
18743
+ is_expected: testOutcome === "expected",
18744
+ repeat_each_index: repeatEachIndex,
18745
+ status: evaluateStatus(testOutcome, status),
18746
+ };
18732
18747
  try {
18733
18748
  const testResult = {
18734
- outcome: testCase.outcome(),
18735
- expected_status: expectedStatus,
18749
+ outcome,
18736
18750
  status,
18737
18751
  duration,
18738
18752
  log: errors.map(error => { var _a; return (_a = error.message) !== null && _a !== void 0 ? _a : ""; }).join("\n"),
@@ -18759,10 +18773,10 @@ class MyReporter {
18759
18773
  return uploadToS3(file, direct_upload);
18760
18774
  }
18761
18775
  }));
18762
- while (!(this.attempts[id][retry] ||
18763
- this.testAttemptIds.includes(`${id}-${this.attempts[id][retry]}`)))
18776
+ while (!(this.attempts[id][`${retry}-${repeatEachIndex}`] ||
18777
+ this.testAttemptIds.includes(`${id}-${this.attempts[id][`${retry}-${repeatEachIndex}`]}`)))
18764
18778
  await waitUntilTimeout(100);
18765
- this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][retry], testResult));
18779
+ this.testResultCalls.push(attemptsApi.update(this.ciBuildId, id, this.attempts[id][`${retry}-${repeatEachIndex}`], testResult));
18766
18780
  }
18767
18781
  catch (error) {
18768
18782
  consoleLogFormatted.error(error.message);