Skip to content

[Chore] Stabilize VRT flakes, update snapshots and fix local mobile timeout#9795

Open
weronikaolejniczak wants to merge 15 commits into
elastic:mainfrom
weronikaolejniczak:chore/stabilize-vrt-flakes
Open

[Chore] Stabilize VRT flakes, update snapshots and fix local mobile timeout#9795
weronikaolejniczak wants to merge 15 commits into
elastic:mainfrom
weronikaolejniczak:chore/stabilize-vrt-flakes

Conversation

@weronikaolejniczak

@weronikaolejniczak weronikaolejniczak commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Unskip flaky stories from [Chore] VRT fixes #9721 and stabilize them.
  • Fix local mobile timeout: run VRT against static Storybook build instead of dev server with HMR.
  • Update stories to have correct snapshots.
  • Skip behavioral-only story.
  • Add a new story.
  • Update baselines.

QA instructions for reviewer

  • Running VRT locally succeeds: yarn workspace @elastic/eui test-visual-regression (remember to turn on Docker)
  • After running CI at least 5 times, there are no flakes
  • Added/changes snapshots are correct: added, updated
  • Wiki is clear, not repetitive, not too verbose

@snyk-io

snyk-io Bot commented Jul 9, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@weronikaolejniczak weronikaolejniczak added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Jul 9, 2026
@weronikaolejniczak
weronikaolejniczak force-pushed the chore/stabilize-vrt-flakes branch 5 times, most recently from 0dbdfd0 to e7f28cd Compare July 15, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-storybook tooling (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.

Comment thread packages/eui/scripts/test-visual-regression.js Outdated
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
41 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euibetabadge (2 differences)

StoryBeforeAfterDiff
playground desktop
playground mobile

euicomment (2 differences)

StoryBeforeAfterDiff
high contrast desktop
high contrast mobile

euiexpression (4 differences)

StoryBeforeAfterDiff
high contrast desktop
high contrast mobile
kitchen sink desktop
kitchen sink mobile

euiheader (3 differences)

StoryBeforeAfterDiff
popover example desktop
popover example mobile
playground mobile

euipanel (2 differences)

StoryBeforeAfterDiff
overlapping panels desktop
overlapping panels mobile

euispacer (2 differences)

StoryBeforeAfterDiff
playground desktop
playground mobile

euisplitpanel (2 differences)

StoryBeforeAfterDiff
high contrast desktop
high contrast mobile

euicollapsiblenav (2 differences)

StoryBeforeAfterDiff
playground desktop
playground mobile

euibasictable (18 differences)

StoryBeforeAfterDiff
dark mode desktop
dark mode mobile
expanded nested table without background desktop
expanded nested table without background mobile
expanded row desktop
expanded row mobile
high contrast desktop
high contrast mobile mobile
large expanded row desktop
large expanded row mobile
marked row desktop
marked row mobile
panelled desktop
panelled mobile
playground desktop
playground mobile
scrollable desktop
scrollable mobile

euitexttruncate (4 differences)

StoryBeforeAfterDiff
resize observer desktop
resize observer mobile
start end anchor for search desktop
start end anchor for search mobile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 79 changed files in this pull request and generated 3 comments.

Comment on lines +45 to +48
const { defaultView, fonts } = canvasElement.ownerDocument;
await fonts.ready;
defaultView?.dispatchEvent(new defaultView.Event('resize'));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/eui/scripts/test-visual-regression.js
Comment thread wiki/contributing-to-eui/testing/visual-regression-testing.md
@weronikaolejniczak
weronikaolejniczak force-pushed the chore/stabilize-vrt-flakes branch from eecb6fc to d1655eb Compare July 16, 2026 10:55
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @weronikaolejniczak

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @weronikaolejniczak

@weronikaolejniczak
weronikaolejniczak marked this pull request as ready for review July 16, 2026 11:24
@weronikaolejniczak
weronikaolejniczak requested a review from a team as a code owner July 16, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants