# End-to-End Testing (Playwright) ## Prerequisites - Node 18+ - `npm install` - Laravel backend running on `http://localhost:8000` - Seeded tenant admin account for automation (see below) ## Seed Test Tenant Run the dedicated seeder to provision a deterministic tenant + credentials: ``` php artisan db:seed --class=E2ETenantSeeder ``` By default the seeder creates `tenant-e2e@example.com` with password `password123`. Override via environment variables before seeding: ``` E2E_TENANT_EMAIL="tenant@example.com" \ E2E_TENANT_PASSWORD="super-secret" \ php artisan db:seed --class=E2ETenantSeeder ``` ## Environment Variables Export the same credentials for Playwright so it can sign in: ``` E2E_TENANT_EMAIL="tenant-e2e@example.com" E2E_TENANT_PASSWORD="password123" ``` Inline checkout scenarios additionally require: ``` VITE_STRIPE_PUBLISHABLE_KEY="pk_test_..." VITE_PAYPAL_CLIENT_ID="Abc123..." ``` Inject these into the shell that runs both Laravel (Vite) and Playwright so the onboarding PWA can render payment elements. ## Commands - `npm run test:e2e` - execute the full Playwright suite. - `npx playwright test tests/e2e/tenant-onboarding-flow.test.ts` - focus on the onboarding spec. ## Notes - Fixtures live in `tests/e2e/utils/test-fixtures.ts`. They automatically skip onboarding assertions when credentials are absent. - Traces are captured on the first retry (`playwright.config.ts`); inspect via `npx playwright show-trace` on failure. - Configure CI by injecting the same environment variables and pointing `use.baseURL` to the deployed environment under test.