Skip to content

Commit 3b1097b

Browse files
committed
Build/Test Tools: Address visual regression test review feedback.
Add a 10 s safety timeout to the jQuery animation polling loop to prevent a stuck animation from hanging the suite. Remove the unused `masks`-as-function code path. Clarify comments for the Add New Plugin mask scope and the `.error:not(#error)` CSS selector. Note in the README that the Playwright `webServer` config auto-starts the environment.
1 parent c26d870 commit 3b1097b

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

tests/visual-regression/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ screens and compare them against baseline snapshots.
66
## How to Run the Tests Locally
77

88
1. Start the local environment: `npm run env:start`
9+
*(The Playwright `webServer` config starts the environment automatically
10+
when you run the tests, but running it first avoids the cold-start wait.)*
911
2. Generate baseline snapshots: `npm run test:visual -- --update-snapshots`
1012
3. Make your changes.
1113
4. Run `npm run test:visual` — any visual differences will fail and produce

tests/visual-regression/config/screenshot.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@
5050
visibility: hidden !important;
5151
}
5252

53-
/* Admin notices — various nags (PHP deprecation, updates, etc.). */
53+
/*
54+
* Admin notices — various nags (PHP deprecation, updates, etc.).
55+
* `.error:not(#error)` excludes the `#error` container on wp-login.php,
56+
* which displays user-facing login errors and is part of the intended UI.
57+
*/
5458
.notice,
5559
.update-nag,
5660
.updated,

tests/visual-regression/specs/visual-snapshots.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ async function waitForPageReady( page ) {
5555
resolve();
5656
}
5757
}, 100 );
58+
// Safety valve: resolve after 10 s so a stuck animation or
59+
// unresolved AJAX request doesn't hang the entire suite.
60+
setTimeout( () => {
61+
clearInterval( interval );
62+
resolve();
63+
}, 10000 );
5864
} );
5965
} );
6066
}
@@ -207,7 +213,10 @@ const pages = [
207213
name: 'Add New Plugin',
208214
path: '/plugin-install.php',
209215
masks: [
210-
// Plugin cards show external content that changes frequently.
216+
// Plugin cards show external content (descriptions, ratings,
217+
// download counts) that changes frequently. Masking all cards
218+
// means this test only verifies the page shell — search bar,
219+
// header tabs, and pagination layout.
211220
'.plugin-card',
212221
],
213222
},
@@ -291,8 +300,6 @@ test.describe( 'Admin Visual Snapshots', () => {
291300
}
292301

293302
screenshotOptions = { mask: locators };
294-
} else if ( typeof masks === 'function' ) {
295-
screenshotOptions = { mask: masks( page ) };
296303
}
297304

298305
await expect( page ).toHaveScreenshot(

0 commit comments

Comments
 (0)