@argos-ci/playwright 0.0.6 → 0.0.7

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 +11 -3
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ const GLOBAL_STYLES = `
17
17
  font-family: monospace !important;
18
18
  opacity: 0 !important;
19
19
  }
20
-
20
+
21
21
  [data-visual-test="removed"] {
22
22
  display: none !important;
23
23
  }
@@ -32,6 +32,13 @@ function waitForImagesLoading() {
32
32
  allImages.forEach((img)=>img.loading = "eager");
33
33
  return allImages.every((img)=>img.complete);
34
34
  }
35
+ // Disable spellcheck to avoid red underlines
36
+ function disableSpellCheck() {
37
+ const query = "[contenteditable]:not([contenteditable=false]):not([spellcheck=false]), input:not([spellcheck=false]), textarea:not([spellcheck=false])";
38
+ const inputs = document.querySelectorAll(query);
39
+ inputs.forEach((input)=>input.setAttribute("spellcheck", "false"));
40
+ return true;
41
+ }
35
42
  async function argosScreenshot(page, name, { element , has , hasText , ...options } = {}) {
36
43
  if (!page) throw new Error("A Playwright `page` object is required.");
37
44
  if (!name) throw new Error("The `name` argument is required.");
@@ -50,10 +57,11 @@ async function argosScreenshot(page, name, { element , has , hasText , ...option
50
57
  await page.waitForSelector('[aria-busy="true"]', {
51
58
  state: "hidden"
52
59
  });
53
- // Wait for all images and fonts to be loaded
60
+ // Code injection to improve the screenshot stability
54
61
  await Promise.all([
55
62
  page.waitForFunction(waitForImagesLoading),
56
- page.waitForFunction(waitForFontLoading)
63
+ page.waitForFunction(waitForFontLoading),
64
+ page.waitForFunction(disableSpellCheck)
57
65
  ]);
58
66
  await handle.screenshot({
59
67
  path: resolve(screenshotFolder, `${name}.png`),
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": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": "github:argos-ci/argos-playwright",