feat(e2e): add Playwright E2E testing infrastructure and critical path tests
Set up Playwright with dual-project config (API + Web), auth test fixtures, 16 E2E tests covering registration, login, profile, token refresh, and homepage rendering. Added GitHub Actions CI workflow for automated E2E runs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
62
playwright.config.ts
Normal file
62
playwright.config.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Playwright E2E configuration for Goodgo Platform.
|
||||
*
|
||||
* Projects:
|
||||
* - "api" — tests against the NestJS API (port 3001)
|
||||
* - "web" — tests against the Next.js frontend (port 3000)
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: process.env.CI
|
||||
? [['html', { open: 'never' }], ['github']]
|
||||
: [['html', { open: 'on-failure' }]],
|
||||
|
||||
use: {
|
||||
trace: 'on-first-retry',
|
||||
screenshot: 'only-on-failure',
|
||||
},
|
||||
|
||||
projects: [
|
||||
// API E2E tests — no browser needed, uses APIRequestContext
|
||||
{
|
||||
name: 'api',
|
||||
testDir: './e2e/api',
|
||||
use: {
|
||||
baseURL: process.env.API_BASE_URL ?? 'http://localhost:3001',
|
||||
},
|
||||
},
|
||||
// Web E2E tests — Chromium browser
|
||||
{
|
||||
name: 'web',
|
||||
testDir: './e2e/web',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
baseURL: process.env.WEB_BASE_URL ?? 'http://localhost:3000',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
webServer: [
|
||||
{
|
||||
command: 'pnpm --filter @goodgo/api run dev',
|
||||
url: 'http://localhost:3001',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 30_000,
|
||||
env: {
|
||||
NODE_ENV: 'test',
|
||||
},
|
||||
},
|
||||
{
|
||||
command: 'pnpm --filter @goodgo/web run dev',
|
||||
url: 'http://localhost:3000',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 30_000,
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user