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
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds a Playwright component test suite for ChangesComponent Example Playwright Tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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/ |
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>
dc78e6b to
d3c1082
Compare
Consolidated PR Review
PR SummaryAdds a thin slice of browser-based component testing for Merge Readiness — MERGE WITH CAVEATS
|
| Dimension | Verdict |
|---|---|
| Backward Compatibility | SAFE |
| Code Quality | GOOD |
| Architecture | GOOD |
| Security | SAFE |
| Observability | GOOD |
| Performance | GOOD |
| Lime Platform Issues | SAFE |
| Merge Readiness | MERGE WITH CAVEATS |
Top Recommendations
- [Medium from Architecture + Performance] Resolve the Node-version mismatch (container ships Node 20;
.nvmrcpins Node 24). Either confirm Node 20 is acceptable for this job and dropset-up-node(removing the per-run Node re-download and the cache miss), or accept the cost and fix the docs — the localvisual-tests-docker.shdoes not reproduce CI's Node 24, so the "exact same environment as CI" claim in the script header/README should be softened to "same browser/OS, pixel-identical." Consider addingnpm ciinside the container in the local script so it doesn't depend on macOS-builtnode_modules. - [Low from Code Quality] Switch the visual capture to the surface locator —
expect(surface).toHaveScreenshot('menu-open.png')— so the baseline tracks the menu, not unrelated example chrome. (Will require regenerating the baseline in Docker.) - [Low from Architecture] Add a guard for the three-way version lockstep — a tiny CI step asserting the container tag matches
@playwright/testinpackage.json, so a future (possibly auto-merged) Playwright bump can't desync the baseline environment. - [Low from Security] Pin the Playwright Docker image by
@sha256:digest (keep the human-readable tag in a comment), matching the SHA-pinning discipline the rest of the workflow already follows. - [Low from Code Quality] Soften the README's "Fast dev loop" wording for
test:examples:componentssince it runs a fulldocs:rebuildeach time, and either broaden the keyboard test to assert selection/the emitted event or tighten the PR description's "also keyboard Enter". - [Low from Observability] Optional: add an
htmlreporter (and document the "download artifact →show-trace/ open*-diff.png" path in the README) so CI failures are one click to diagnose.
|
Addressed the review. Two fixup commits pushed ( FixedNode toolchain re-download (Medium). The review's premise was off: Local script now self-contained + "same environment" claim accurate. Visual capture scope (Low). Switched Digest-pin the image (Low). Both README "Fast dev loop" (Low). Reworded — Deliberately not changed (thin-slice scope)
|
Consolidated PR Review — Round 2 (after fixups)
PR SummaryThin slice of browser-based component testing for Merge Readiness — READY TO MERGE ✅This PR is now strictly better than
1. Backward Compatibility — SAFE ✅No regression vs
2. Code Quality — GOOD ✅Round-1
3. Architecture — GOOD ✅The round-1
4. Security — SAFE ✅Round-1
5. Observability — GOOD ✅No regression; the visual-capture change is artifact-neutral.
6. Performance — GOOD ✅Both round-1
7. Lime Platform Issues — SAFE ✅No findings (round 1 also clean). The
Overall Verdicts
Top RecommendationsAll findings are
|
|
Reviewed the round-2 feedback. All items are
Consider this ready to merge. |
|
Visual baseline: reverted to a full-component capture The round-2 fixups had narrowed the visual screenshot to just the menu surface ( Why: the purpose of this test is to verify the component as a whole. The menu's position relative to its trigger button is exactly the kind of thing a visual test should catch — and a surface-only capture drops it. The baseline now spans both the "Menu" button and the open menu beneath it. Trade-off (intentional): the menu renders as a portal on Baseline regenerated in the same digest-pinned Playwright image and verified locally (3/3 green); CI re-verifies it in that same image. 🤖 Posted by Claude Code on behalf of @adrianschmidt |
b60895d to
08b4a33
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-checks.yml:
- Line 185: The checkout step in the workflow still uses the default credential
persistence, which leaves the job token available in the working copy. Update
the existing actions/checkout usage in this job to explicitly set
persist-credentials to false so the later npm ci and Playwright steps run with a
checked-out repository but without stored Git credentials.
In `@scripts/visual-tests-docker.sh`:
- Around line 21-27: The docker invocation in scripts/visual-tests-docker.sh is
running as the image default user, which can leave updated snapshots in the
bind-mounted /work checkout owned by root. Update the docker run setup to
execute the container with the host UID/GID or another ownership-matching
approach so files written by the visual test flow stay editable on the host.
Keep the change localized to the docker command used by the visual snapshot/test
script.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5d83670b-1093-4524-b50d-3e67a020aad8
⛔ Files ignored due to path filters (1)
example-tests/components/menu.spec.ts-snapshots/menu-open.pngis excluded by!**/*.png
📒 Files selected for processing (6)
.github/workflows/pr-checks.ymlexample-tests/components/README.mdexample-tests/components/menu.spec.tspackage.jsonplaywright.example-tests.config.tsscripts/visual-tests-docker.sh
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>
ad4d4c2 to
33dcb29
Compare
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
Summary by CodeRabbit
New Features
Bug Fixes
Documentation