Author: Sergey Panteleev (saundefined)
Date: 2024-08-20T10:07:15+03:00

Commit: 
https://github.com/php/web-php/commit/12e45386e88d19b8c7c65915bd3c64bf27429e29
Raw diff: 
https://github.com/php/web-php/commit/12e45386e88d19b8c7c65915bd3c64bf27429e29.diff

Add mask option to regression tests

Changed paths:
  M  tests/Visual/SmokeTest.spec.ts
  M  
tests/Visual/SmokeTest.spec.ts-snapshots/tests-screenshots-index-php-chromium.png


Diff:

diff --git a/tests/Visual/SmokeTest.spec.ts b/tests/Visual/SmokeTest.spec.ts
index c475e26d8c..06d0c9f776 100644
--- a/tests/Visual/SmokeTest.spec.ts
+++ b/tests/Visual/SmokeTest.spec.ts
@@ -4,6 +4,7 @@ export type TestPageOptions = {
     path: string
     options?: object
     evaluate?: () => any
+    mask?: string[]
 }
 
 const items: TestPageOptions[] = [
@@ -12,7 +13,12 @@ const items: TestPageOptions[] = [
         evaluate: () => {
             const selector = document.querySelector('.elephpants');
             selector.remove()
-        }
+        },
+        options: {
+            fullPage: true,
+            timeout: 10000,
+        },
+        mask: ['.hero-versions'],
     },
     {
         path: 'archive/1998.php',
@@ -52,6 +58,13 @@ for (const item of items) {
             await page.evaluate(item.evaluate)
         }
 
+        if (typeof item.mask === 'object') {
+            item.options = {
+                ...item.options,
+                mask: item.mask.map((selector) => page.locator(selector))
+            }
+        }
+
         await expect(page).toHaveScreenshot(
             `tests/screenshots/${item.path}.png`,
             item.options ?? {
diff --git 
a/tests/Visual/SmokeTest.spec.ts-snapshots/tests-screenshots-index-php-chromium.png
 
b/tests/Visual/SmokeTest.spec.ts-snapshots/tests-screenshots-index-php-chromium.png
index 6bbd63cf22..4a9929dc23 100644
Binary files 
a/tests/Visual/SmokeTest.spec.ts-snapshots/tests-screenshots-index-php-chromium.png
 and 
b/tests/Visual/SmokeTest.spec.ts-snapshots/tests-screenshots-index-php-chromium.png
 differ

Reply via email to