test(ui): add E2E tests for invitation accept smart router#10814
test(ui): add E2E tests for invitation accept smart router#10814pfe-nazaries merged 1 commit intomasterfrom
Conversation
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
🔒 Container Security ScanImage: ✅ No Vulnerabilities DetectedThe container image passed all security checks. No known CVEs were found.📋 Resources:
|
Alan-TheGentleman
left a comment
There was a problem hiding this comment.
Three things to address:
-
SignUpPage.verifyPageLoaded()breaks the new flow — inINVITE-ACCEPT-E2E-002you first assert the URL is/sign-up?invitation_token=..., but then callsignUpPage.verifyPageLoaded(), and that method currently requires an exacttoHaveURL("/sign-up"). With query params present, that assertion does not match the real flow. Either relaxverifyPageLoaded()for this case or add a dedicated method for sign-up with invitation token. -
The PR description/docs do not match the actual code path — the PR says the legacy
action=signupparam is no longer emitted, but the current router inui/app/(auth)/invitation/accept/accept-invitation-client.tsxstill pushes/sign-up?invitation_token=...&action=signup. Also, the reference toAUTH-MW-E2E-003does not exist inui/tests. Please align the doc/description with the real behavior or update the implementation if the intent changed. -
The commit message includes AI attribution —
Co-Authored-By: Claude Opus 4.7...is present in the commit, and that goes against the repo rules. Please clean that up before merge.
The overall direction is good — the POM structure is clean, the Playwright project setup makes sense, and the unauthenticated flow coverage is useful. But these three issues should be fixed before this goes in.
- Cover unauthenticated choice screen with callbackUrl preservation - Cover "Create an account" redirect preserving the invitation token - Cover no-token error screen and redirect to sign-in - Add invitation-accept project to playwright config
666aa35 to
36ab612
Compare
|
Thanks for the review, @Alan-TheGentleman. Addressing the three points: 1. // ui/tests/sign-up/sign-up-page.ts:56-59
async verifyPageLoaded(): Promise<void> {
await expect(this.emailInput).toBeVisible();
await expect(this.submitButton).toBeVisible();
}The method that requires an exact 2. Doc matches current code — the
// ui/app/(auth)/invitation/accept/accept-invitation-client.tsx:201-205
onClick={() => {
router.push(
`/sign-up?invitation_token=${encodeURIComponent(token!)}`,
);
}}
// ui/tests/auth/auth-middleware.spec.ts:81-82
"should not redirect /sign-up?invitation_token=... to /invitation/accept",
{ tag: ["@e2e", "@auth", "@middleware", "@AUTH-MW-E2E-003"] },Could you re-pull 3. AI attribution removed. Amended the commit to drop |
Context
Follow-up from PR #10589 code review: the
/invitation/acceptsmart router was validated with ad-hoc browser tests but lacked Playwright E2E coverage.Description
Adds 3 Playwright E2E tests for the invitation accept smart router. All tests run unauthenticated and client-side only — no API mocking or external credentials required.
INVITE-ACCEPT-E2E-001— unauthenticated user sees the choice screen; the "Sign in" button redirects to/sign-inwith acallbackUrlpreserving the invitation token.INVITE-ACCEPT-E2E-002— the "Create an account" button redirects to/sign-up?invitation_token=...and the sign-up form renders (guards against redirect loops).INVITE-ACCEPT-E2E-004— navigating to/invitation/acceptwith no token shows the no-token error screen and the "Go to Sign In" link redirects to/sign-in.INVITE-ACCEPT-E2E-003from the original spec (backward-compat redirect) is intentionally not included: the redirect was removed in #10797, and the remaining negative case (/sign-up?invitation_token=...stays on/sign-up) is already covered byAUTH-MW-E2E-003inui/tests/auth/auth-middleware.spec.ts.A new
invitation-acceptPlaywright project is registered inui/playwright.config.tswith no auth-setup dependency, matching thesign-upproject layout.Steps to review
Expected: 3 tests pass.
Files:
ui/tests/invitation-accept/invitation-accept.spec.tsui/tests/invitation-accept/invitation-accept-page.ts(Page Object)ui/tests/invitation-accept/invitation-accept.md(doc — test IDs synced with spec)ui/playwright.config.ts(new project)Checklist
Community Checklist
UI (if applicable)
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.