Files
HamHam/playwright.config.ts
T

48 lines
1.4 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
import { randomBytes } from 'node:crypto';
process.env.TEST_PASSWORD ??= randomBytes(24).toString('base64url');
process.env.TEST_DATABASE_URL ??= `postgres://${process.env.USER ?? 'postgres'}@localhost:5432/hamham_test`;
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: false,
workers: 1,
retries: 0,
timeout: 45000,
globalSetup: './tests/setup.ts',
reporter: [['list'], ['html', { open: 'never' }]],
use: {
baseURL: 'http://localhost:3100',
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
},
webServer: {
command: 'npm run start -- --port 3100',
url: 'http://localhost:3100/api/health',
reuseExistingServer: false,
timeout: 60000,
env: {
DATABASE_URL: process.env.TEST_DATABASE_URL,
APP_ORIGIN: 'http://localhost:3100',
COOKIE_SECURE: 'false',
UPLOAD_DIR: './test-results/uploads',
NEXT_TELEMETRY_DISABLED: '1',
},
},
projects: [
{
name: 'desktop',
use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 1000 } },
},
{
name: 'mobile',
testMatch: /public.spec.ts/,
use: { ...devices['iPhone 13'], defaultBrowserType: 'chromium' },
},
{
name: 'tablet',
testMatch: /public.spec.ts/,
use: { ...devices['iPad Mini'], defaultBrowserType: 'chromium' },
},
],
});