Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.8 KiB
E2E Tests: Invitation Accept Smart Router
Suite ID: INVITE-ACCEPT-E2E
Feature: /invitation/accept smart router that handles invitation links for both
authenticated and unauthenticated users.
Test Case: INVITE-ACCEPT-E2E-001 - Unauthenticated user sees choice screen and Sign in preserves token
Priority: high
Tags:
- type: @e2e
- feature: @invitation, @invitation-accept
Description/Objective: Verify the smart router renders the choice screen for
an unauthenticated user with a valid token, and that clicking "Sign in"
redirects to /sign-in with a callbackUrl that preserves the invitation token.
Preconditions:
- Application is running.
- No active session (cookies cleared).
Flow Steps
- Clear all cookies.
- Navigate to
/invitation/accept?invitation_token=test-token. - Verify the choice screen is rendered.
- Click the "I have an account — Sign in" button.
- Verify the redirect target and
callbackUrlquery param.
Expected Result
- Heading "You've Been Invited" is visible.
- Description text "invited to join a tenant" is visible.
- Both "I have an account — Sign in" and "I'm new — Create an account" buttons are visible.
- After clicking "Sign in", URL is
/sign-in?callbackUrl=.... - Decoded
callbackUrlequals/invitation/accept?invitation_token=test-token. - Decoded
callbackUrlcontainsinvitation_token=test-token.
Key verification points
callbackUrlpreserves the original invitation path with token.
Test Case: INVITE-ACCEPT-E2E-002 - "Create an account" button redirects to sign-up with invitation token
Priority: high
Tags:
- type: @e2e
- feature: @invitation, @invitation-accept
Description/Objective: Verify the "Create an account" button redirects to
/sign-up preserving the invitation_token query param, and that the sign-up
form actually renders (no redirect loop back to /invitation/accept).
Preconditions:
- Application is running.
- No active session (cookies cleared).
Flow Steps
- Clear all cookies.
- Navigate to
/invitation/accept?invitation_token=test-token. - Wait for the "I'm new — Create an account" button to be visible.
- Click the button.
- Verify the resulting URL and that the sign-up form is rendered.
Expected Result
- URL pathname is
/sign-up. - Query param
invitation_tokenequalstest-token. - Sign-up form is rendered (email input and submit button visible).
Key verification points
- No redirect back to
/invitation/accept(smart router does not loop).
Notes
- The legacy
action=signupparam is no longer emitted: the backward-compat redirect from/sign-up?invitation_token=...to/invitation/acceptwas removed, so no action bypass is needed. See alsoAUTH-MW-E2E-003inui/tests/auth/auth-middleware.spec.ts, which covers that/sign-upwith a token is no longer rewritten.
Test Case: INVITE-ACCEPT-E2E-004 - No token shows error screen
Priority: medium
Tags:
- type: @e2e
- feature: @invitation, @invitation-accept
Description/Objective: Verify that navigating to /invitation/accept
without an invitation_token query param shows the no-token error state and
that the "Go to Sign In" link redirects to /sign-in.
Preconditions:
- Application is running.
- No active session (cookies cleared).
Flow Steps
- Clear all cookies.
- Navigate to
/invitation/accept(no query params). - Verify the no-token error screen is rendered.
- Click the "Go to Sign In" link.
- Verify redirect to
/sign-in.
Expected Result
- Heading "Invalid Invitation Link" is visible.
- Description "No invitation token was provided" is visible.
- "Go to Sign In" link is visible and clickable.
- After click, URL matches
/sign-in.
Key verification points
- Client-side render only: no API calls involved.