import { defineConfig, devices } from "@playwright/test"; /** * Playwright 설정 파일 * https://playwright.dev/docs/test-configuration */ export default defineConfig({ testDir: "./tests", /* Vitest 단위 테스트 파일들을 Playwright 테스트 대상에서 제외 */ testIgnore: "**/unit/**", /* 하나의 테스트 파일 내에서 병렬 실행 금지 및 직렬 실행으로 세션 상태 격리 보장 */ fullyParallel: false, /* Redis 및 PostgreSQL 공유 자원의 세션 정렬을 위해 워커를 1개로 제한 */ workers: 1, /* 테스트 실패 시 재시도 횟수 */ retries: 0, /* 각 테스트 타임아웃 (30초) */ timeout: 30000, /* 전체 테스트 실행 타임아웃 */ globalTimeout: 600000, /* Assertion 타임아웃 */ expect: { timeout: 5000, }, /* 리포터 설정 (HTML 리포트 및 터미널 요약) */ reporter: [["html", { open: "never" }], ["list"]], /* 공유 설정 */ use: { /* 테스트 타겟 URL */ baseURL: process.env.PLAYWRIGHT_BASE_URL || "http://localhost:3000", /* 실패한 테스트에 대해서만 트레이스 수집 */ trace: "retain-on-failure", /* 스크린샷 캡처 설정 */ screenshot: "only-on-failure", }, /* 프로젝트별 브라우저 구성 (기본적으로 Chromium 위주로 동작 확인) */ projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"] }, }, { name: "firefox", use: { ...devices["Desktop Firefox"] }, }, { name: "webkit", use: { ...devices["Desktop Safari"] }, }, ], /* 로컬 서버 자동 기동 설정 */ webServer: { command: "pnpm dev", url: "http://localhost:3000", reuseExistingServer: true, timeout: 120000, stdout: "pipe", stderr: "pipe", }, });