@argos-ci/playwright 3.9.4 → 3.10.0

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/dist/index.d.ts CHANGED
@@ -41,6 +41,16 @@ type ArgosScreenshotOptions = {
41
41
  * @default true
42
42
  */
43
43
  stabilize?: boolean | StabilizationOptions;
44
+ /**
45
+ * Run a function before taking the screenshot.
46
+ * When using viewports, this function will run before taking sreenshots on each viewport.
47
+ */
48
+ beforeScreenshot?: () => Promise<void> | void;
49
+ /**
50
+ * Run a function after taking the screenshot.
51
+ * When using viewports, this function will run after taking sreenshots on each viewport.
52
+ */
53
+ afterScreenshot?: () => Promise<void> | void;
44
54
  } & LocatorOptions & ScreenshotOptions<LocatorScreenshotOptions> & ScreenshotOptions<PageScreenshotOptions>;
45
55
  /**
46
56
  * Stabilize the UI and takes a screenshot of the application under test.
package/dist/index.js CHANGED
@@ -237,6 +237,7 @@ async function argosScreenshot(page, name, options = {}) {
237
237
  return metadata;
238
238
  };
239
239
  const stabilizeAndScreenshot = async (name2) => {
240
+ await options.beforeScreenshot?.();
240
241
  if (stabilize) {
241
242
  const stabilizationOptions = typeof stabilize === "object" ? stabilize : {};
242
243
  try {
@@ -296,6 +297,7 @@ ${reasons.map((reason) => `- ${reason}`).join("\n")}
296
297
  })
297
298
  ]);
298
299
  }
300
+ await options.afterScreenshot?.();
299
301
  };
300
302
  if (viewports) {
301
303
  for (const viewport of viewports) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/playwright",
3
3
  "description": "Playwright SDK for visual testing with Argos.",
4
- "version": "3.9.4",
4
+ "version": "3.10.0",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -47,16 +47,16 @@
47
47
  "node": ">=18.16.0"
48
48
  },
49
49
  "dependencies": {
50
- "@argos-ci/browser": "2.2.1",
51
- "@argos-ci/core": "2.12.0",
52
- "@argos-ci/util": "2.2.1",
53
- "chalk": "^5.3.0",
54
- "debug": "^4.3.7"
50
+ "@argos-ci/browser": "2.2.2",
51
+ "@argos-ci/core": "3.0.0",
52
+ "@argos-ci/util": "2.2.2",
53
+ "chalk": "^5.4.1",
54
+ "debug": "^4.4.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@argos-ci/cli": "2.5.3",
57
+ "@argos-ci/cli": "workspace:*",
58
58
  "@argos-ci/playwright": "workspace:.",
59
- "@playwright/test": "^1.48.2",
59
+ "@playwright/test": "^1.49.1",
60
60
  "@types/debug": "^4.1.12",
61
61
  "@types/node": "^18.19.44"
62
62
  },
@@ -65,5 +65,5 @@
65
65
  "test": "pnpm exec -- playwright test",
66
66
  "e2e": "UPLOAD_TO_ARGOS=true pnpm run test"
67
67
  },
68
- "gitHead": "88672d5cd06a792974844d1cb798641cec6e0562"
68
+ "gitHead": "0c91306ae0cb8bec5ef93db79565635e405086f7"
69
69
  }