Skip to content

[On Week] Replace Loki with Playwright-based approach and run in CI - #9594

Merged
weronikaolejniczak merged 17 commits into
elastic:mainfrom
weronikaolejniczak:chore/vrt-playwright
Jun 5, 2026
Merged

weronikaolejniczak merged 17 commits into
elastic:mainfrom
weronikaolejniczak:chore/vrt-playwright

Conversation

@weronikaolejniczak

@weronikaolejniczak weronikaolejniczak commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

Tip

~1800 files changed includes removing loki references and adding new baseline snapshots.

Summary

What's the idea?

Visual regression tests are executed and snapshots are updated solely in CI.

Benefits

  • visual regression surfaces with the changes that cause it,
  • these changes are blocked until the visual regression is addressed appropriately (through updating the code or the snapshots),
  • snapshots are always generated and evaluated on the same machine leading to less machine-dependant flake,
  • VRT happens on the PR, asynchronously and is not blocking to your local development.

How does it work?

No visual regression

If there are no visual changes, the CI run will simply pass.

Screenshot 2026-05-22 at 16 37 50

Visual regression

If there are visual changes:

Screenshot 2026-05-23 at 00 23 32

the "Test visual regression" step will fail and there will be a comment added to the PR with a diff table.

GitHub has a limit on the comment length and so the same diff table appears in the Buildkite annotation.

Expected visual changes

You can approve the update of the snapshots (if the diff is expected) in the Buildkite pipeline. Read more about the block step here. Only EUI team (on Buildkite, not GitHub!) can approve that block.

Screenshot 2026-05-23 at 01 56 56 Screenshot 2026-05-23 at 01 09 17

A commit will be added to the PR: chore(eui): update VRT baseline screenshots. CI is re-ran automatically.

If new stories are added, this commit will include the new baselines.

Screenshot 2026-05-23 at 01 16 31

New stories, no baselines

If there are new stories with no baseline snapshots AND the VRT step passed, CI will automatically add them in a commit: chore(eui): add VRT baseline screenshots. CI is re-ran automatically. No maintainer approval needed.

Screenshot 2026-05-22 at 17 26 38

Skipping tests

If there's something wrong with the visual regression tests in CI and your PR is blocked by them but needs to be merged, you can add a label skip-vrt. Obviously, this is not desired and should always be properly explained in the PR comment!

External contributors cannot add labels themselves.

Running tests locally

You can run these tests/update snapshots yourself, just like before, by running yarn workspace @elastic/eui test-visual-regression (update). Make sure Docker is up and running! It uses the same image as our job runners.

Incorrect behavior

At times, a behavioral regression can be introduced which makes Storybook interactions fail. In this case, no visual diff will be evaluated until the author fixes either the code or the play function in such a way that it passes.

CI workflow

flowchart TD
    PR[Pull request] --> WS[Build and deploy website]
    PR --> SB[Build and deploy Storybook]
    SB --> VRT[Test visual regression]

    VRT -->|skip-vrt label| N[Notify]
    VRT -->|Pass, new stories| C1[Commit baselines\nto PR branch]
    VRT -->|Pass, no changes| N
    VRT -->|Fail, infrastructure error| N

    VRT -->|Fail, visual diffs found| D[Post diff table\nto PR comment]
    D --> B[Approve visual changes]
    B --> U[Update VRT baselines]
    U --> N

    C1 --> N
    WS --> N
Loading

Note

Moving Visual Regression Testing into a separate workflow or the test workflow would involve changing Backstage. This PR aims to add VRT to CI in a straightforward, easy way. The CI can be re-architectured in the future.

In the future

  • [Low effort] Add diff percentage to the table.
  • [Low effort] There's no documentation around how to author a stable snapshot. No explanation as to which VRT selector to use, how to use the play function etc. I think this can easily be added apart from this PR.
  • [Low effort] Detect and remove orphaned snapshots automatically when you approve updating the snapshots.
  • [Low effort] Some components have distinct tablet (~768px) layouts that fall between mobile and desktop. We could easily add that third viewport.
  • [Medium effort] Update our CI images to contain fonts-noto-color-emoji already and remove the install from the script.
  • [Medium effort] Only a handful of components have globals: { colorMode: 'dark' } or { highContrastMode: true } VRT stories. We could treat dark and high contrast mode as variables and compute them for all components.
  • [High effort] We can do a broader audit for most components and add hover, focus and active states. They aren't captured for most components.

API Changes

N/A

Screenshots

N/A

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — May break functional or snapshot tests (e.g., HTML structure, class names, default values).
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 None

Release Readiness

  • Documentation: {link to docs page(s)}
  • Figma: {link to Figma or issue}
  • Migration guide: {steps or link, for breaking/visual changes or deprecations}
  • Adoption plan (new features): {link to issue/doc or outline who will integrate this and where}

QA instructions for reviewer

This PR can be tested by pushing commits directly to this branch OR by working off a branch based on this one and opening a PR for it.

Checklist:

  • If there are new snapshots, a commit is added chore(eui): add VRT baseline screenshots
  • If VRT is not failing, the whole pipeline passes and there are no GitHub comments made
  • If VRT fails, the whole pipeline fails and there is a GitHub comment with a diff table
  • When the blocked step to update VRT snapshots is approved, a commit is added chore(eui): update VRT baseline screenshots
  • No one outside of EUI team on Buildkite can approve the block step
  • The workflow works as expected in a feature branch
  • All snapshots make sense (nothing is cut off, it displays a correct state)
  • All skip: true stories are still valid to be skipped
  • Flakes do not block the PR from being merged
  • skip-vrt label skips the VRT step and makes CI pass
  • CI auto re-runs after commits have been made by kibanamachine

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

@weronikaolejniczak weronikaolejniczak changed the title Chore/vrt playwright [On Week] Replace Loki with Playwright-based approach and run in CI Apr 15, 2026
@weronikaolejniczak weronikaolejniczak self-assigned this Apr 15, 2026
@weronikaolejniczak
weronikaolejniczak force-pushed the chore/vrt-playwright branch 3 times, most recently from 06a29a1 to 0140de5 Compare April 15, 2026 13:40
@weronikaolejniczak weronikaolejniczak added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Apr 15, 2026
@weronikaolejniczak
weronikaolejniczak force-pushed the chore/vrt-playwright branch 2 times, most recently from aaea671 to 1267344 Compare April 15, 2026 15:27
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@weronikaolejniczak
weronikaolejniczak force-pushed the chore/vrt-playwright branch 3 times, most recently from ee06da5 to af19826 Compare May 20, 2026 19:34
@weronikaolejniczak
weronikaolejniczak force-pushed the chore/vrt-playwright branch 2 times, most recently from 8b6c1f4 to 7cd116c Compare May 21, 2026 13:03
Comment on lines +3 to +14
# Push HEAD to the PR source branch. Requires `GH_TOKEN` to be exported.
function git_push_to_pr_branch {
local branch="${BUILDKITE_BRANCH##*:}"
# Normalize to HTTPS: `BUILDKITE_PULL_REQUEST_REPO` can be git://, git@, or https://
local pr_repo_url="${BUILDKITE_PULL_REQUEST_REPO}"
pr_repo_url="${pr_repo_url/[email protected]:/https://github.com/}"
pr_repo_url="${pr_repo_url/git:\/\/github.com\//https://github.com/}"
git remote add pr-origin "${pr_repo_url}" 2>/dev/null \
|| git remote set-url pr-origin "${pr_repo_url}"
git push pr-origin "HEAD:${branch}" --no-verify
}

@weronikaolejniczak weronikaolejniczak May 21, 2026 •

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.

This logic is needed to be able to push to the fork remote and consequently, add commits to the PR. The URL substitution is needed because BUILDKITE_PULL_REQUEST_REPO is as Git protocol string but we need HTTPS for gh to work correctly.

@weronikaolejniczak
weronikaolejniczak force-pushed the chore/vrt-playwright branch 10 times, most recently from 50b9bfb to 4e480e4 Compare May 22, 2026 13:08
@elastic-vault-github-plugin-prod

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

euicomment (1 difference)

StoryBeforeAfterDiff
high contrast desktop

euiicon (1 difference)

StoryBeforeAfterDiff
all icons desktop

euicombobox (2 differences)

StoryBeforeAfterDiff
groups desktop
nested options groups desktop

euiselectable (2 differences)

StoryBeforeAfterDiff
with search and groups desktop
groups desktop

euisuperdatepicker (1 difference)

StoryBeforeAfterDiff
custom time zone display desktop

euilistitemlayout (1 difference)

StoryBeforeAfterDiff
kitchen sink desktop

euiheader (1 difference)

StoryBeforeAfterDiff
dark theme with sitewide search desktop

euipanel (2 differences)

StoryBeforeAfterDiff
overlapping panels desktop
playground desktop

euipopover (1 difference)

StoryBeforeAfterDiff
playground desktop

euibasictable (8 differences)

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

euiselectabletemplatesitewide (2 differences)

StoryBeforeAfterDiff
scrollable desktop
vrt desktop

Comment thread .buildkite/pipelines/deploy_docs.yml Resolved
@elastic-vault-github-plugin-prod

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

euicomment (1 difference)

StoryBeforeAfterDiff
high contrast desktop

euiicon (1 difference)

StoryBeforeAfterDiff
all icons desktop

euicombobox (2 differences)

StoryBeforeAfterDiff
groups desktop
nested options groups desktop

euirange (1 difference)

StoryBeforeAfterDiff
input with popover desktop

euiselectable (2 differences)

StoryBeforeAfterDiff
with search and groups desktop
groups desktop

euisuperdatepicker (1 difference)

StoryBeforeAfterDiff
custom time zone display desktop

euilistitemlayout (1 difference)

StoryBeforeAfterDiff
kitchen sink desktop

euiheader (1 difference)

StoryBeforeAfterDiff
dark theme with sitewide search desktop

euipanel (2 differences)

StoryBeforeAfterDiff
overlapping panels desktop
playground desktop

euipopover (1 difference)

StoryBeforeAfterDiff
playground desktop

euibasictable (8 differences)

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

euiselectabletemplatesitewide (2 differences)

StoryBeforeAfterDiff
scrollable desktop
vrt desktop

@weronikaolejniczak

Copy link
Copy Markdown
Contributor Author

buildkite test this

@weronikaolejniczak

Copy link
Copy Markdown
Contributor Author

@tkajtoch I think I addressed all of your feedback and the CI works as expected. One thing, allowed_list for the kibanamachine that pushes commits to the branch doesn't seem to be working: 3a53b39. The checks for Buildkite are not automatically triggered.

@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@tkajtoch

tkajtoch commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

One thing, allowed_list for the kibanamachine that pushes commits to the branch doesn't seem to be working: 3a53b39. The checks for Buildkite are not automatically triggered.

@weronikaolejniczak we might need to also add kibanamachine to allowed_list... It's worth trying out

@tkajtoch tkajtoch 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.

Thank you for addressing my feedback! Changes look good! 🚢

@weronikaolejniczak

Copy link
Copy Markdown
Contributor Author

@tkajtoch actually, I did try kibanamachine first, it didn't work, so then I tried the current one, still nothing... It's like GH doesn't even register the check. So let's handle that later.

@weronikaolejniczak weronikaolejniczak mentioned this pull request Jun 5, 2026
7 of 10 tasks
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.

[EuiIconTip] The story for VRT test doesn't work as expected

5 participants