@argos-ci/playwright 3.6.0 → 3.6.2

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.
Files changed (2) hide show
  1. package/dist/index.mjs +12 -2
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -103,6 +103,16 @@ function getViewportSize(page) {
103
103
  }
104
104
  return viewportSize;
105
105
  }
106
+ /**
107
+ * Sets the viewport size and waits for the visual viewport to match the specified dimensions.
108
+ * @returns A promise that resolves when the viewport size has been successfully set and matched.
109
+ */ async function setViewportSize(page, viewportSize) {
110
+ await page.setViewportSize(viewportSize);
111
+ await page.waitForFunction(({ width, height })=>window.innerWidth === width && window.innerHeight === height, {
112
+ width: viewportSize.width,
113
+ height: viewportSize.height
114
+ });
115
+ }
106
116
  /**
107
117
  * Setup Argos for the screenshot process.
108
118
  * @returns A function to teardown Argos.
@@ -264,13 +274,13 @@ function getViewportSize(page) {
264
274
  // Take screenshots for each viewport
265
275
  for (const viewport of viewports){
266
276
  const viewportSize = resolveViewport(viewport);
267
- await page.setViewportSize(viewportSize);
277
+ await setViewportSize(page, viewportSize);
268
278
  await stabilizeAndScreenshot(getScreenshotName(name, {
269
279
  viewportWidth: viewportSize.width
270
280
  }));
271
281
  }
272
282
  // Restore the original viewport size
273
- await page.setViewportSize(originalViewportSize);
283
+ await setViewportSize(page, originalViewportSize);
274
284
  } else {
275
285
  await stabilizeAndScreenshot(name);
276
286
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/playwright",
3
3
  "description": "Visual testing solution to avoid visual regression. Playwright commands and utilities for Argos visual testing.",
4
- "version": "3.6.0",
4
+ "version": "3.6.2",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -42,14 +42,14 @@
42
42
  "node": ">=18.0.0"
43
43
  },
44
44
  "dependencies": {
45
- "@argos-ci/browser": "2.1.3",
46
- "@argos-ci/core": "2.8.0",
45
+ "@argos-ci/browser": "2.1.4",
46
+ "@argos-ci/core": "2.8.1",
47
47
  "@argos-ci/util": "2.1.1",
48
48
  "chalk": "^5.3.0",
49
49
  "debug": "^4.3.6"
50
50
  },
51
51
  "devDependencies": {
52
- "@argos-ci/cli": "2.4.2",
52
+ "@argos-ci/cli": "2.4.3",
53
53
  "@argos-ci/playwright": "workspace:.",
54
54
  "@playwright/test": "^1.46.1",
55
55
  "@types/debug": "^4.1.12",
@@ -61,5 +61,5 @@
61
61
  "test": "pnpm exec -- playwright test",
62
62
  "e2e": "UPLOAD_TO_ARGOS=true pnpm run test"
63
63
  },
64
- "gitHead": "682860bc510fc3c2afcdd3335236c463ccce2783"
64
+ "gitHead": "c109fcd4e295e7df202cc749cec2d91a6b0b5645"
65
65
  }