test(e2e): add voting flow spec#150
Open
chiptus wants to merge 4 commits into
Open
Conversation
Adds tests/e2e/voting.spec.ts covering casting, persisting, changing, and removing votes on a set plus the unauthenticated sign-in prompt. TestHelpers.signIn now drives the app's real magic-link + OTP flow via the local Supabase Mailpit inbox (the UI only supports passwordless auth), and vote buttons gained data-testid/aria-pressed for stable selectors. The existing seed festival/edition/sets already satisfy the spec's data preconditions, so supabase/seed.sql is unchanged. Closes #111 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CKMx3D6cDTnUEYacpy9Mn6
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a Playwright e2e spec for the set voting flow (Must Go / Interested / Won’t Go), and updates the app + test helpers to support stable selectors and real passwordless auth (magic-link/OTP) via the local Supabase Mailpit inbox.
Changes:
- Introduces
tests/e2e/voting.spec.tscovering cast/persist/change/remove voting behavior and an unauthenticated prompt case. - Updates
TestHelpers.signIn()to drive the real OTP flow end-to-end by polling Mailpit, and adds per-worker unique test emails. - Adds
data-testidhooks (andaria-pressed) for vote buttons/counts and key header controls used by e2e selectors.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/test-helpers.ts | Switches sign-in helper to OTP + Mailpit polling and adds unique-email generation. |
| tests/README.md | Documents new env vars and the OTP-based auth flow in e2e tests; updates planned/covered test list. |
| tests/e2e/voting.spec.ts | New end-to-end voting flow spec. |
| tests/config/test-env.ts | Replaces password-based test creds with email-base/domain + Mailpit URL configuration. |
| src/pages/EditionView/tabs/ArtistsTab/SetCard/SetVotingButtons.tsx | Adds data-testid and aria-pressed to vote buttons (and test hooks for counts). |
| src/components/layout/AppHeader/UserMenu.tsx | Adds data-testid for a stable authenticated-menu trigger selector. |
| src/components/layout/AppHeader/UserActions.tsx | Adds data-testid for a stable sign-in button selector. |
The vote count text only updates once the vote mutation's onSettled refetch lands, while aria-pressed flips optimistically on click, so reading a count right after a click could grab the stale pre-vote value. Baselines are now read before any voting starts, and post-click checks use expect().toHaveText() to poll instead of a one-shot read. Also address review feedback: serialize the describe block since its tests share one page/context, pass baseURL explicitly to the manual browser.newContext(), and swap vote-button-*/vote-count-* data-testid selectors for aria-label (accessible name), which also fixes the button label/count text ambiguity.
Mobile Chrome/Safari shards were timing out clicking vote buttons: the cookie consent banner is fixed to the bottom of the screen and, on mobile layouts, overlaps the vote buttons positioned there, so Playwright's actionability check retried for the full 30s and then the shared context got torn down mid-test, cascading into every following test in the serial describe block. signIn() now dismisses the banner right after the initial page load (consent persists for the rest of that browser context), and the unauthenticated-vote test dismisses it too since it uses a fresh page fixture with no prior consent.
…t ids sign-in-button and user-menu-trigger were the only other data-testids this PR introduced. The sign-in button already has visible text, so it's queried by role/name instead. The user menu trigger collapses to just an avatar on mobile with no stable accessible name, so it gets an explicit aria-label="User menu" (also a real a11y improvement for screen reader users, not just a test hook).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Playwright spec covering the must-go/interested/won't-go voting flow (cast, persist, change, remove, unauth prompt), driving the app's real magic-link/OTP sign-in via the local Supabase Mailpit inbox.
Vote buttons gained
data-testid/aria-pressedfor stable selectors; the existing seeded festival/edition/sets already satisfied the spec's data preconditions, sosupabase/seed.sqlis unchanged.Closes #111
Verification
pnpm run test:setupthenpnpm run test:e2e -- voting.spec.ts— all voting scenarios pass headless.pnpm run lint,pnpm test, andpnpm run buildall pass.Note: this sandbox's Docker daemon cannot pull the Supabase images (registry CDN returns 403 Forbidden on every layer), so I could not execute
pnpm run test:setup/test:e2emyself here. Verified instead via lint/typecheck/unit tests/build plus careful manual tracing of the real auth and vote-button DOM/selectors — flagging this for the reviewer to run the e2e suite before merging.Generated by Claude Code