@smoothdeploy/playwright 1.58.3 → 1.58.4

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/lib/index.js CHANGED
@@ -680,11 +680,36 @@ class ArtifactsRecorder {
680
680
  }
681
681
  }
682
682
  if (this._pauseOnFailure && this._testInfo._isFailure()) {
683
+ this._emitPauseOnFailure();
683
684
  const page = this._playwright._allPages()[0];
684
685
  if (page)
685
686
  await page.pause();
686
687
  }
687
688
  }
689
+ _emitPauseOnFailure() {
690
+ const findFailingPath = (steps) => {
691
+ for (let i = steps.length - 1; i >= 0; i--) {
692
+ const step = steps[i];
693
+ const childPath = findFailingPath(step.steps);
694
+ if (childPath.length > 0)
695
+ return [step.title, ...childPath];
696
+ if (step.error)
697
+ return [step.title];
698
+ }
699
+ return [];
700
+ };
701
+ const stepPath = findFailingPath(this._testInfo._steps);
702
+ const error = this._testInfo.errors[0];
703
+ process.stdout.write(`[SMOOTHDEPLOY_EVENT]${JSON.stringify({
704
+ event: "pauseOnFailure",
705
+ testId: this._testInfo.testId,
706
+ testTitle: this._testInfo.titlePath.slice(1).join(" > "),
707
+ stepPath,
708
+ error: error ? { message: error.message ?? String(error) } : null,
709
+ timestamp: Date.now()
710
+ })}
711
+ `);
712
+ }
688
713
  async didFinishTest() {
689
714
  await this.didFinishTestFunction();
690
715
  const leftoverContexts = this._playwright._allContexts();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothdeploy/playwright",
3
- "version": "1.58.3",
3
+ "version": "1.58.4",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "license": "Apache-2.0",
66
66
  "dependencies": {
67
- "playwright-core": "npm:@smoothdeploy/playwright-core@1.58.3"
67
+ "playwright-core": "npm:@smoothdeploy/playwright-core@1.58.4"
68
68
  },
69
69
  "optionalDependencies": {
70
70
  "fsevents": "2.3.2"
package/types/test.d.ts CHANGED
@@ -6895,6 +6895,7 @@ export interface PlaywrightWorkerOptions {
6895
6895
  *
6896
6896
  */
6897
6897
  resultScreenshots: boolean;
6898
+ pauseOnFailure: boolean;
6898
6899
  /**
6899
6900
  * Whether to record trace for each test. Defaults to `'off'`.
6900
6901
  * - `'off'`: Do not record trace.