E2E Testing¶
Last1 ID uses Playwright for end-to-end tests.
Setup¶
Install Playwright browsers (required once per machine):
Or install all browsers:
If you see "Executable doesn't exist" errors, install to your user cache:
The test:e2e script uses this path by default. E2E runs the dev server with SITE_URL and CORS_ORIGINS set to the test port so onboarding and API requests succeed.
Running Tests¶
For interactive UI mode:
Test Coverage¶
Unauthenticated Access (always runs)¶
- Visiting
/dashboard,/profile,/credentials,/settingsredirects to/login - Redirect param is preserved (e.g.
/profile→/login?redirect=%2Fprofile) - Visiting
/onboardingwithout auth redirects to/login?redirect=%2Fonboarding
Login & Redirect (requires credentials)¶
Add these to .env to run auth-dependent tests:
E2E_TEST_EMAIL– test user emailE2E_TEST_PASSWORD– test user password (use double quotes if it contains#:E2E_TEST_PASSWORD="pass#word")VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY– required; auth tests are skipped when Supabase is not configured
The test script loads .env via dotenv-cli. In .env, # starts a comment—wrap values in double quotes to preserve it.
Tests covered:
- Redirect to intended path after login (
/login?redirect=%2Fprofile→/profile) - Redirect to dashboard after login when no redirect param
Signup¶
- Form validation (passwords match, min length)
- After signup: redirects to
/onboardingor shows "Check your email" (depends on Supabase email confirmation)
The signup flow test is skipped by default (creates real accounts, can hit Supabase limits). To run the full suite including signup:
Onboarding (requires credentials)¶
- Completes onboarding flow and redirects to dashboard
Linked providers, connected apps, consent (requires credentials)¶
Note: The onboarding test passes in isolation. The Linked providers block may intermittently fail when run in the full suite—likely due to a race between auth state and navigation. If the beforeEach completes (user on /dashboard), the subsequent page navigation may not render correctly. Consider running the onboarding test first, then the Linked providers tests.
- Linked providers page loads and shows sign-in methods
- Unlink button not shown when only one provider (safety guard)
- Connected apps page loads
- Consent page loads
- Revoke confirmation appears when revoking app access (if app is connected)
CI¶
Run with CI=1 to disable reusing an existing server and enable retries: