Repository navigation
[On Week] Replace Loki with Playwright-based approach and run in CI - #9594
Conversation
06a29a1 to
0140de5
Compare
aaea671 to
1267344
Compare
💚 Build Succeeded
History
|
9d4cae3 to
ac0df3c
Compare
ee06da5 to
af19826
Compare
8b6c1f4 to
7cd116c
Compare
| # 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 | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
50b9bfb to
4e480e4
Compare
8021cdb to
8558cc6
Compare
22 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuicomment (1 difference)
euiicon (1 difference)
euicombobox (2 differences)
euiselectable (2 differences)
euisuperdatepicker (1 difference)
euilistitemlayout (1 difference)
euiheader (1 difference)
euipanel (2 differences)
euipopover (1 difference)
euibasictable (8 differences)
euiselectabletemplatesitewide (2 differences)
|
c4dab84 to
36da4dc
Compare
36da4dc to
3a53b39
Compare
23 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuicomment (1 difference)
euiicon (1 difference)
euicombobox (2 differences)
euirange (1 difference)
euiselectable (2 differences)
euisuperdatepicker (1 difference)
euilistitemlayout (1 difference)
euiheader (1 difference)
euipanel (2 differences)
euipopover (1 difference)
euibasictable (8 differences)
euiselectabletemplatesitewide (2 differences)
|
|
buildkite test this |
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
@weronikaolejniczak we might need to also add |
tkajtoch
left a comment
There was a problem hiding this comment.
Thank you for addressing my feedback! Changes look good! 🚢
|
@tkajtoch actually, I did try |


































































Tip
~1800 files changed includes removing loki references and adding new baseline snapshots.
Summary
skip-vrtlabel, in case there's something wrong with Visual Regression Tests and they're blocking an important PR from being merged.What's the idea?
Visual regression tests are executed and snapshots are updated solely in CI.
Benefits
How does it work?
No visual regression
If there are no visual changes, the CI run will simply pass.
Visual regression
If there are visual changes:
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.
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.
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.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
playfunction 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 --> NNote
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
fonts-noto-color-emojialready and remove the install from the script.globals: { colorMode: 'dark' }or{ highContrastMode: true }VRT stories. We could treat dark and high contrast mode as variables and compute them for all 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.
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:
chore(eui): add VRT baseline screenshotschore(eui): update VRT baseline screenshotsskip: truestories are still valid to be skippedskip-vrtlabel skips the VRT step and makes CI passkibanamachineChecklist before marking Ready for Review
QA: Tested light/dark modes, high contrast, mobile, Chrome/Safari/Edge/Firefox, keyboard-only, screen readerQA: Tested in CodeSandbox and KibanaQA: Tested docs changesChangelog: Added changelog entryBreaking changes: Addedbreaking changelabel (if applicable)Reviewer checklist