Files
clean-architecture-frontend…/playwright.dev.config.ts
DongHyeonka c1e258bb81 test(playwright): CI 판정용 재시도로 흔들림을 가리고 실패로 남긴다
Playwright가 재시도하지 않아 실패가 흔들림인지 회귀인지 run에 남지
않는다. CI=true에서만 한 번 더 돌고, 재시도에서 통과해도 실패로
끝낸다. 설정 helper로만 주고 검사기가 설정 객체의 key를 거절한다.

failOnFlakyTests만으로는 재시도에서만 test.fail()에 닿은 시험의 첫
실패가 통과로 바뀐다. helper의 reporter가 실패한 시도를 따로 판정하고
다른 보고에 없는 원인을 색 코드 없이 찍는다. e2e 공유 fixture 빌드는 재시도에서 앞
시도의 실패 기록을 다시 쓰지 않는다(카드 C9). package script와 게이트
args는 029 파서와 이어 쓴 script 때문에 버렸다. CI 판별은 러너 정책이라
CI env를 읽는다.

위험·한계: 많이 깨진 run은 브라우저 게이트가 최대 약 두 배 걸린다
(추정). 명령줄 --reporter는 이 판정 reporter를 뺀다. JUnit에서 실패한
시험의 시간과 failure/error 분류는 첫 시도 기준이 된다. 검사기는 spec
안의 describe.configure({ retries })를 보지 않는다. 빌드가 실패 기록
없이 끊기면(worker 종료, hook 시간 초과) 재시도도 기다리다 실패한다.

검증: main으로 옮기기 전 트리 c8df70ab에서 test:unit 3632개, types,
lint, FE-GATE-029, verify:documentation rc=0, 변이 30개 검출. desktop
실제 브라우저: 일시 빌드 실패는 6 flaky, 계속 실패는 3 failed, 숨은
실패는 rc=1과 원인 출력. 트리 3dea9c06에서 숨은 expect 실패의 색 코드
시험이 고치기 전 1개 실패, 고친 뒤 35개 통과.

Refs: CI-FE-0001
2026-11-23 00:45:11 +09:00

52 lines
2.0 KiB
TypeScript

import { defineConfig } from "@playwright/test";
import releaseConfig from "./playwright.config.ts";
import { LOCAL_BUILD_IDENTITY } from "./scripts/lib/build-environment.ts";
import { flakyJudgementReporter } from "./scripts/lib/playwright-flaky-judgement.ts";
import {
reservePort,
RUN_OUTPUT_ROOT_VARIABLE,
TEST_PORT_VARIABLES,
testRunPath,
testRunRoot,
} from "./scripts/lib/run-isolation.ts";
// 1105/12-04. The dev server used to reuse whatever already answered on 5173,
// so the specs could run against another checkout's or another branch's dev
// server without saying so. It now starts its own on a free port
// (TEST_DEV_PORT pins one) and never reuses a server.
const port = await reservePort(TEST_PORT_VARIABLES.dev);
const origin = `http://127.0.0.1:${port}`;
export default defineConfig({
...releaseConfig,
// Its own result paths: with the e2e config's, a local test:e2e:dev run
// replaced the results, report and results.xml FE-GATE-008 had written
// (tests/unit/playwright-result-paths.test.ts).
outputDir: testRunPath("artifacts/tests/e2e-dev/results"),
reporter: [
["list"],
flakyJudgementReporter,
["html", { outputFolder: testRunPath("artifacts/tests/e2e-dev/report"), open: "never" }],
[
"junit",
{ outputFile: testRunPath("artifacts/tests/e2e-dev/results.xml"), includeRetries: true },
],
],
use: {
...releaseConfig.use,
baseURL: origin,
},
webServer: {
// The dev server serves public/config.json, the local profile, whose
// BUILD_ID is local-build. CI sets VITE_BUILD_ID for the whole workflow;
// built into the dev bundle it makes every page a rolling-release mismatch
// that reloads once and then fails closed (CONFIG_BUILD_MISMATCH).
// 1105/12-04. Under TEST_RUN_ID, Vite's cache is the run's own.
env: { ...LOCAL_BUILD_IDENTITY, [RUN_OUTPUT_ROOT_VARIABLE]: testRunRoot() },
command: `corepack pnpm dev --host 127.0.0.1 --port ${port} --strictPort`,
url: origin,
reuseExistingServer: false,
},
});