Skip to content

Commit 6b0a1ad

Browse files
committed
Improve visual snapshots stability and grouping
Normalize volatile UI for visual tests and reorganize snapshot suites. Switch admin notices from visibility:hidden to display:none to avoid layout shifts across runs, and hide block-editor modals. In tests, blur any focused element on page ready to avoid focus-ring diffs; group pages into section-based describe blocks for a nested report; update and add mask selectors (use .editor-visual-editor for block editor); warn when a mask selector matches no elements; and preserve per-test setup/teardown behavior. These changes reduce flaky diffs and make the HTML report easier to navigate.
1 parent a0a2a16 commit 6b0a1ad

2 files changed

Lines changed: 176 additions & 74 deletions

File tree

tests/visual-regression/config/screenshot.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,31 @@
5454
* Admin notices — various nags (PHP deprecation, updates, etc.).
5555
* `.error:not(#error)` excludes the `<div id="error">` database error
5656
* container from wpdb (wp-includes/class-wpdb.php) as a defensive measure.
57+
*
58+
* Uses `display: none` (not `visibility: hidden`) because notices may or
59+
* may not exist in the DOM between runs. If a notice is present in one run
60+
* but absent in another, `visibility: hidden` would reserve space only in
61+
* the first run, shifting all content below and causing a false diff.
62+
* Collapsing them entirely normalises the layout regardless.
5763
*/
5864
.notice,
5965
.update-nag,
6066
.updated,
6167
.error:not(#error),
6268
#message {
63-
visibility: hidden !important;
69+
display: none !important;
70+
}
71+
72+
/*
73+
* Block editor modals (welcome guide, preference panels).
74+
* The welcome guide appears on first visit and sets a user preference on
75+
* dismissal. Between test runs the preference state is non-deterministic,
76+
* so hide the modal entirely. `display: none` is safe here — modals are
77+
* overlays and do not participate in the underlying page layout.
78+
*/
79+
.components-modal__screen-overlay,
80+
.components-modal__frame {
81+
display: none !important;
6482
}
6583

6684
/* General Settings — live date/time preview changes on every run. */

0 commit comments

Comments
 (0)