WellNuo/playwright.config.ts
Sergei 67496d6913 Add comprehensive E2E tests for critical flows
Implement Playwright E2E tests covering 43 critical user flows:
- Authentication: login, OTP verification, validation, onboarding
- Beneficiary management: list, detail, equipment, subscription navigation
- Subscription: status display, Stripe integration, demo mode
- Profile: settings, edit, logout flow

Includes:
- Page Object Models for test maintainability
- Test helpers with common utilities
- Updated Playwright config with proper project structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-01 10:22:47 -08:00

64 lines
1.9 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
/**
* E2E tests for WellNuo Expo web app
*
* To run tests:
* 1. Start Expo web server: npm run web
* 2. Run tests: npm run test:e2e
*
* Or with custom URL:
* E2E_BASE_URL=http://localhost:3000 npm run test:e2e
*/
export default defineConfig({
testDir: './e2e',
fullyParallel: false, // Sequential tests to avoid rate limiting
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1, // Single worker to prevent 429 errors
reporter: [
['html', { open: 'never' }],
['list'],
],
timeout: 60000, // 60 second timeout per test
expect: {
timeout: 10000, // 10 second timeout for assertions
},
use: {
// Use environment variable or default to local Expo web server
baseURL: process.env.E2E_BASE_URL || 'http://localhost:8081',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: 15000,
navigationTimeout: 30000,
},
// Optionally start Expo web server before tests
webServer: process.env.E2E_START_SERVER ? {
command: 'npm run web',
url: 'http://localhost:8081',
reuseExistingServer: !process.env.CI,
timeout: 120000,
} : undefined,
projects: [
// Critical flows - desktop Chrome (primary)
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testMatch: /critical-flows\/.*.spec.ts/,
},
// Mobile Chrome for responsive testing
{
name: 'mobile-chrome',
use: { ...devices['Pixel 5'] },
testMatch: /critical-flows\/.*.spec.ts/,
},
// Legacy tests (original e2e files)
{
name: 'legacy',
use: { ...devices['Desktop Chrome'] },
testMatch: /^(?!critical-flows).*.spec.ts/,
},
],
});