test(menu): browser interaction + visual-regression testing (thin slice)#4147
test(menu): browser interaction + visual-regression testing (thin slice)#4147adrianschmidt wants to merge 3 commits into
Conversation
Drive the real limel-example-menu-basic docs example to assert the menu opens on click and via keyboard, emits the selected item to the consumer, and closes after selection. New per-component example-tests suite selected by the `components` Playwright filter. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a toHaveScreenshot test for the open menu, gated behind RUN_VISUAL_SNAPSHOTS and run only inside the pinned Playwright Docker image so macOS dev and Linux CI compare byte-identical pixels. Includes the Docker wrapper script, npm scripts, snapshot-path config, and the committed baseline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a PR job that runs the interaction + visual component example-tests inside mcr.microsoft.com/playwright:v1.60.0-jammy, matching the environment that generated the committed baselines, and uploads diff images/traces on failure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4147/ |
What this adds
A first slice of browser-based component testing for
lime-elements, proven end-to-end onlimel-menu. It covers two complementary things our example-tests didn't do before:#/debug/limel-example-menu-basic) in a real browser: click the trigger, confirm the menu opens, pick an item, and verify the selection is actually emitted out to the consumer (and that the menu closes). Also covers opening via keyboard (Enter). These run anywhere, including locally on macOS.This is intentionally a thin slice on one component. The goal is to establish the reusable pattern and the CI/baseline plumbing; rolling it out to more components is follow-up work.
How the visual baselines stay reliable
Screenshots render differently on macOS vs. the Linux CI machines (fonts, anti-aliasing), which normally makes pixel comparison flaky. To avoid that, baselines are only ever generated and compared inside one pinned Docker image (
mcr.microsoft.com/playwright:v1.60.0-jammy) that matches the CI environment exactly — so the same pixels are produced on a developer's Mac and in CI.npm run test:examples:visual:updateregenerates baselines (needs Docker);npm run test:examples:visualcompares.npm run test:examples:components), the interaction tests run and the pixel test is automatically skipped rather than failing on a font mismatch.See
example-tests/components/README.mdfor the full developer workflow.Commits
test(menu)— interaction tests + the per-component suite wiringtest(menu)— the gated visual-regression baseline + Docker/config plumbingci— the PR job that runs it all in the pinned containerVerification
The one thing only CI can confirm is the new job's Node setup inside the container — this draft PR's checks are the gate for that. Opening as a draft until those pass.
🤖 Generated with Claude Code