[Chore] Stabilize VRT flakes, update snapshots and fix local mobile timeout#9795
[Chore] Stabilize VRT flakes, update snapshots and fix local mobile timeout#9795weronikaolejniczak wants to merge 15 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
0dbdfd0 to
e7f28cd
Compare
There was a problem hiding this comment.
Pull request overview
This PR focuses on reducing Visual Regression Testing (VRT) flakes in EUI by improving local VRT execution (static Storybook build instead of the HMR dev server), updating Storybook stories to be more VRT-stable/correctly captured, and documenting stable story authoring patterns.
Changes:
- Switch local VRT to run against a served static Storybook build by default (with flags to opt out), plus add
serve-storybooktooling (http-server). - Update multiple stories to improve VRT capture stability (portal selectors, play functions that wait for overlays, avoid fragment root clipping, reduce oversized datasets, etc.).
- Expand VRT wiki docs with clearer local-running guidance, stability tips, and troubleshooting.
Reviewed changes
Copilot reviewed 24 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds http-server dependency resolution for the new static Storybook serving script. |
| wiki/contributing-to-eui/testing/visual-regression-testing.md | Updates local VRT guidance, adds stable story authoring tips, and troubleshooting for local timeouts. |
| packages/eui/src/components/text_truncate/text_truncate.stories.tsx | Replaces fragment roots with a wrapper element to avoid VRT clipping. |
| packages/eui/src/components/spacer/spacer.stories.tsx | Replaces fragment decorator wrapper with an element to avoid VRT clipping. |
| packages/eui/src/components/popover/wrapping_popover.stories.tsx | Stabilizes popover VRT by waiting for visibility and forcing a post-font-load resize. |
| packages/eui/src/components/popover/popover.stories.tsx | Unskips popover playground in VRT and stabilizes it via play/waits + resize. |
| packages/eui/src/components/popover/popover_title.stories.tsx | Adds play wait to ensure popover is visible before capture. |
| packages/eui/src/components/popover/popover_footer.stories.tsx | Adds play wait to ensure popover is visible before capture. |
| packages/eui/src/components/panel/split_panel/split_panel_outer.stories.tsx | Replaces fragment root with wrapper element to avoid VRT clipping. |
| packages/eui/src/components/panel/panel.stories.tsx | Fixes overlapping panel positioning so the visual example actually overlaps (and is VRT-stable). |
| packages/eui/src/components/link/link.stories.tsx | Adds a VRT-only external link story. |
| packages/eui/src/components/header/header.stories.tsx | Adds a play wait to ensure portal popover content is present before snapshotting. |
| packages/eui/src/components/header/header_alert/header_alert.stories.tsx | Makes the popover example VRT-capturable via portal selector + play wait (and opens by default). |
| packages/eui/src/components/flyout/flyout.stories.tsx | Skips a behavior-only story in VRT to reduce flake risk. |
| packages/eui/src/components/expression/expression.stories.tsx | Replaces fragment root with wrapper element to avoid VRT clipping. |
| packages/eui/src/components/datagrid/data_grid_styles.stories.tsx | Unskips/adjusts datagrid VRT stories (e.g., height="auto") and removes redundant play logic. |
| packages/eui/src/components/datagrid/controls/data_grid_toolbar.stories.tsx | Changes column selector to use portal selector instead of skipping. |
| packages/eui/src/components/context_menu/context_menu.stories.tsx | Adds play waits for popover-rendered stories to stabilize captures. |
| packages/eui/src/components/comment_list/comment_list.stories.tsx | Replaces remote avatar image with inline data URI for VRT determinism. |
| packages/eui/src/components/collapsible_nav/collapsible_nav.stories.tsx | Uses portal selector for correct VRT capture of portalled nav content. |
| packages/eui/src/components/code/code_block.stories.tsx | Unskips a previously skipped VRT story. |
| packages/eui/src/components/basic_table/basic_table.stories.tsx | Reduces table dataset size to avoid slow/oversized VRT screenshots (faker remains seeded). |
| packages/eui/src/components/badge/beta_badge/beta_badge.stories.tsx | Adjusts rendering to prevent VRT cropping without relying on alignment prop. |
| packages/eui/scripts/test-visual-regression.js | Adds static build/serve mode (default locally), Docker build-in-container logic, and CI-like serving to avoid networkidle stalls. |
| packages/eui/package.json | Adds serve-storybook script and http-server devDependency for static Storybook serving. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4b70d52 to
2cf004b
Compare
41 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuibetabadge (2 differences)
euicomment (2 differences)
euiexpression (4 differences)
euiheader (3 differences)
euipanel (2 differences)
euispacer (2 differences)
euisplitpanel (2 differences)
euicollapsiblenav (2 differences)
euibasictable (18 differences)
euitexttruncate (4 differences)
|
d6bdf0f to
5b53a83
Compare
| const { defaultView, fonts } = canvasElement.ownerDocument; | ||
| await fonts.ready; | ||
| defaultView?.dispatchEvent(new defaultView.Event('resize')); | ||
|
|
There was a problem hiding this comment.
document.fonts is supported in our controlled Storybook/Chromium env.
new defaultView.Event('resize') is guarded with an if block and doesn't fail either.
eecb6fc to
d1655eb
Compare
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|



























































































































Summary
QA instructions for reviewer
yarn workspace @elastic/eui test-visual-regression(remember to turn on Docker)Build #1🟢Build #2🟢Build #3🟢Build #4🟢Build #5🟢Build #6🟢