Repository navigation
test(web): add visual regression tests - #35
Conversation
27 baseline screenshots across 6 tests covering every screen and key conditional rendering path: - Landing page + CreateGroup form (filtered/all modes, all options) - Admin flow: setup → links → invite → intro → welcome → question → summary → review → waiting → results (2-person) - Intro with/without timing, question with timing sub-question - Non-admin waiting screen (no "View group members" button) - Self-pick anatomy: pick screen, expanded options, pending screen - 3-person: invite list, waiting (partial), results with pair tabs Chromium args for deterministic rendering: font-render-hinting=none, disable-lcd-text, disable-font-subpixel-positioning, force-color-profile=srgb, disable-skia-runtime-opts. Adds a `visual` project to playwright.config.ts (separate from `e2e`), `pnpm test:visual` script, and a CI job that uploads diff artifacts on failure. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughImplements visual regression testing infrastructure using Playwright with Git LFS storage for PNG baselines. Adds configuration for desktop and mobile test projects, new e2e test specs covering landing/partner/admin flows and three-person groups, CSS for deterministic rendering, workflow CI job, and documentation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
54 baseline screenshots (27 desktop @ 1280×800 2x, 27 mobile @ 390×664 2x) across 6 tests × 2 viewports covering every screen and key conditional rendering path: - Landing page + CreateGroup form (filtered/all modes, all options) - Admin flow: setup → links → invite → intro → welcome → question → summary → review → waiting → results (2-person) - Intro with/without timing, question with timing sub-question - Non-admin waiting screen (no "View group members" button) - Self-pick anatomy: pick screen, expanded options, pending screen - 3-person: invite list, waiting (partial), results with pair tabs Deterministic rendering via Chromium args (font-render-hinting=none, disable-lcd-text, force-color-profile=srgb, etc.) plus a screenshot.css that suppresses animations and the feTurbulence grain overlay. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move 54 baseline PNGs to Git LFS to keep the repo lean. Add .gitattributes rule for e2e/visual/**/*.png, lfs: true on the visual CI checkout step, and baseline update instructions in README. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- test:visual:new — generate baselines for new tests only (--update-snapshots=missing) - test:visual:update — regenerate all baselines (--update-snapshots=all) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Ensures LFS objects are uploaded on every push. Without this, git push sends only LFS pointers and CI fails with 404s on checkout. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
145-163: Consider extracting duplicated Playwright setup into a reusable unit.The Playwright version/cache/install/deps sequence is duplicated between
e2eandvisual. A composite action or reusable workflow would reduce drift risk over time.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 145 - 163, The Playwright setup steps ("Get Playwright version" with id pw-version, "Cache Playwright browsers" with id playwright-cache, "Install Playwright Chromium", and "Install Chromium OS deps") are duplicated across the e2e and visual jobs; extract these into a single reusable unit (either a composite action or a reusable workflow) that accepts inputs (e.g., cache key prefix, browser choice) and performs the PW_VERSION detection, cache restore/save, conditional npx playwright install, and apt deps installation, then replace the duplicated step sequences in both jobs with a single call to that composite action or workflow (passing required inputs and preserving existing ids/outputs like version).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@e2e/visual/admin-flow.spec.ts`:
- Around line 119-123: The test currently makes the timing branch optional by
checking nowBtn.isVisible() and skipping the assertion if it isn't present;
change this to assert the timing UI is present and then capture the screenshot
so the test fails if the "Now" step disappears — specifically remove the
conditional around nowBtn and replace it with an explicit visibility/assertion
on page.getByRole("button", { name: "Now" }) (or expect(nowBtn).toBeVisible())
before calling expect(page).toHaveScreenshot("question-timing.png"), ensuring
the timing-enabled path exercised by the test (the nowBtn variable and the
screenshot assertion) is always validated.
- Around line 58-64: The test is asserting "Yes" remains visible after each
click which doesn't confirm the survey advanced; change the synchronization to
wait for the question/card to change between clicks. After clicking a radio via
alice.getByRole("radio", { name: ... }).click(), await a locator that identifies
the current question/card (for example the question heading or the card
container used in the test) to update—either assert the previous question text
is gone (expect(oldQuestionLocator).not.toBeVisible()) or assert the new
question text/identifier appears (expect(newQuestionLocator).toBeVisible() or
toHaveText(...)); update the repeated assertions around the clicks so each click
is followed by a wait for the question/card transition rather than checking the
static "Yes" text.
In `@e2e/visual/partner-flow.spec.ts`:
- Around line 27-28: The test currently uses expect(bob.getByText("View group
members")).not.toBeVisible(), which only checks visibility and can miss elements
that are rendered but hidden; replace that assertion with an absence check by
asserting the locator has zero matches (e.g., use expect(bob.getByText("View
group members")).toHaveCount(0) or expect(bob.locator('text="View group
members"')).toHaveCount(0)) so the test fails if the element is present in the
DOM even if hidden.
---
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 145-163: The Playwright setup steps ("Get Playwright version" with
id pw-version, "Cache Playwright browsers" with id playwright-cache, "Install
Playwright Chromium", and "Install Chromium OS deps") are duplicated across the
e2e and visual jobs; extract these into a single reusable unit (either a
composite action or a reusable workflow) that accepts inputs (e.g., cache key
prefix, browser choice) and performs the PW_VERSION detection, cache
restore/save, conditional npx playwright install, and apt deps installation,
then replace the duplicated step sequences in both jobs with a single call to
that composite action or workflow (passing required inputs and preserving
existing ids/outputs like version).
🪄 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: CHILL
Plan: Pro
Run ID: 1dd04167-71f0-4bb0-bafc-3ac381026670
⛔ Files ignored due to path filters (54)
e2e/visual/admin-flow.spec.ts-snapshots/end-all-answered-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/end-all-answered-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/intro-no-timing-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/intro-no-timing-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/intro-with-timing-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/intro-with-timing-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/invite-members-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/invite-members-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-timing-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-timing-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-unanswered-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/question-unanswered-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/results-2p-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/results-2p-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/review-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/review-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/setup-form-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/setup-form-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/setup-links-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/setup-links-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/summary-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/summary-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/waiting-admin-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/waiting-admin-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/welcome-screen-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/admin-flow.spec.ts-snapshots/welcome-screen-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/create-group-all-options-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/create-group-all-options-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/create-group-all-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/create-group-all-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/create-group-filtered-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/create-group-filtered-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/landing-home-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/landing.spec.ts-snapshots/landing-home-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pending-waiting-anatomy-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pending-waiting-anatomy-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pick-anatomy-expanded-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pick-anatomy-expanded-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pick-anatomy-partner-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pick-anatomy-partner-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pick-anatomy-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/pick-anatomy-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/waiting-non-admin-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/partner-flow.spec.ts-snapshots/waiting-non-admin-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/invite-3-members-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/invite-3-members-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/results-3p-first-tab-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/results-3p-first-tab-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/results-3p-second-tab-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/results-3p-second-tab-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/results-3p-third-tab-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/results-3p-third-tab-visual-mobile-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/waiting-3p-partial-visual-desktop-linux.pngis excluded by!**/*.pnge2e/visual/three-person.spec.ts-snapshots/waiting-3p-partial-visual-mobile-linux.pngis excluded by!**/*.png
📒 Files selected for processing (11)
.gitattributes.github/workflows/ci.ymlREADME.mde2e/visual/admin-flow.spec.tse2e/visual/landing.spec.tse2e/visual/partner-flow.spec.tse2e/visual/screenshot.csse2e/visual/three-person.spec.tspackage.jsonplaywright.config.tstodo.md
💤 Files with no reviewable changes (1)
- todo.md
- Remove flaky mixed-rating sequence (no-op waits between questions) - Assert timing sub-question is visible instead of conditional skip - Use toHaveCount(0) instead of not.toBeVisible() for absent elements Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Excludes screenshot PNGs from GitHub language stats and diffs. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add answerQuestionsCycling helper that rotates through all 5 ratings
- Admin flow uses mixed answers → review shows all rating styles,
summary shows partial progress, results show match/possible/fantasy
- New results-edge.spec.ts: green-light column with timing enabled,
empty state ("No overlaps")
- Three-person test uses mixed answers for match type variety across
all pair tabs
30 unique screenshots × 2 viewports = 60 baselines total.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- SHA-pin actions/upload-artifact@v4 (supply-chain consistency) - Move personBase() to e2e/helpers.ts (was duplicated in two specs) - Add comment explaining why visual-mobile uses Desktop Chrome Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
🎉 This PR is included in version 1.6.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
visualproject toplaywright.config.tswith deterministic Chromium args (--font-render-hinting=none,--force-color-profile=srgb,--disable-lcd-text,--disable-font-subpixel-positioning,--disable-skia-runtime-opts)pnpm test:visualscript (separate frompnpm test:e2e)visualCI job that uploads diff artifacts on failurepnpm test:e2eto--project=e2eonlyScreenshots covered
landingadmin-flowpartner-flowthree-personChromium args rationale
--font-render-hinting=none--disable-lcd-text--disable-font-subpixel-positioning--force-color-profile=srgb--disable-skia-runtime-optsTest plan
pnpm -r typecheckpassespnpm test— all 335 unit tests passpnpm test:e2e— all 37 E2E tests pass (existing tests unaffected by project split)pnpm test:visual— all 6 visual tests pass against generated baselines🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Tests
Documentation
Chores