Files
clean-architecture-frontend…/playwright.config.ts
DongHyeonka ec95cde5df test(service-worker): 대기 숫자를 지우고 시험 timeout 하나에 맡긴다
Service Worker e2e 두 spec의 대기 넷(waitForFunction 60 s 둘, expect
30 s 둘)이 Playwright 기본 시험 timeout 30 s 이상이다. 설정과 spec
어디에도 시험 timeout이 없고, beforeAll의 test.setTimeout(180_000)은
그 hook의 기한만 바꾼다. 그래서 대기가 자기 기한에 닿기 전에 시험이
먼저 끊기고, 숫자의 근거도 없다.

대기 숫자를 지운다. waitForFunction과 expect.poll은 시험 timeout만
받는다. poll에는 `timeout: 0`을 준다. 그래야 기본 expect timeout(5 s)이
아니라 시험 기한까지 본다. toBeVisible은 기본 expect timeout을 받는다.
desktop에서 두 spec을 3회 돌려 잰 가장 긴 시험이 7.7 s(webkit, 기본
30 s 아래)라 describe.configure로 시험 timeout을 주지 않는다. 잰 가장
긴 대기는 waitForFunction 1.05 s, expect.poll 1.95 s(chromium 3회 모두
1.9 s대, webkit 3회 0.01 s), toBeVisible 0.09 s다.

버린 안: 대기를 25 s로 줄이기는 숫자만 바뀌고 근거가 없다. poll을 기본
5 s에 맡기기는 잰 최장의 2.6배뿐이라, 느린 날 끊기면 FE-GATE-008의
판정용 재시도가 flaky로 run을 떨어뜨린다(리뷰 지적).

위험·한계: toBeVisible 기한이 30 s에서 기본 5 s가 된다(잰 최장의 약
55배). poll은 예전처럼 시험 timeout에 끊긴다. 측정 때 desktop load는
15~23(12코어)이었다. beforeAll의 test.setTimeout(180_000)은 이 커밋이
다루지 않는다(잰 beforeAll 최장 7.3 s).

검증: 고치기 전 origin/main에서 `git grep -nE 'timeout: (30|60)_000' --
'tests/e2e/service-worker-*.spec.ts'` rc=0 4줄, 고친 뒤 rc=1 0줄.
poll의 `timeout: 0`은 Playwright 1.62 deadlineForMatcher
(lib/matchers/expect.js)가 시험 기한 250 ms 전을 기한으로 쓴다. desktop
CI env에서 두 spec을 3회 rc=0(17 passed·4 skipped씩, 재시도 0, poll을
기본 5 s에 둔 측정 트리 49b979c5), poll에 timeout 0을 준 트리 3a291c92(7752f90d 위,
다음 커밋까지 든 트리)에서 1회 rc=0(17 passed·4 skipped, load 22).

Refs: REV-FE-0012, REV-FE-0023
2026-11-23 12:45:31 +09:00

85 lines
2.8 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
import { flakyJudgement, 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";
import { childProcessTimeout } from "./tests/helpers/child-process-timeout.ts";
// 1105/12-04. With TEST_RUN_ID set, this run's results, report and the build
// its preview serves are under .tmp/runs/<id>/ (scripts/lib/run-isolation.ts),
// so a second run in the same checkout neither empties this run's dist nor
// deletes its results. Unset, the paths are artifacts/tests/e2e/* and dist,
// which FE-GATE-008 and the CI upload read. The preview listens on a free
// port (TEST_E2E_PORT pins one); a fixed 4173 made the second run fail with
// "is already used".
const dist = testRunPath("dist");
const port = await reservePort(TEST_PORT_VARIABLES.e2e);
const origin = `http://127.0.0.1:${port}`;
export default defineConfig({
testDir: "./tests/e2e",
// Fixture specs build a repository copy once for the run, not once per
// browser project (tests/e2e/support/shared-fixture-builds.ts).
globalSetup: "./tests/e2e/support/e2e-global-setup.ts",
forbidOnly: true,
...flakyJudgement(),
outputDir: testRunPath("artifacts/tests/e2e/results"),
reporter: [
["list"],
flakyJudgementReporter,
["html", { outputFolder: testRunPath("artifacts/tests/e2e/report"), open: "never" }],
[
"junit",
{ outputFile: testRunPath("artifacts/tests/e2e/results.xml"), includeRetries: true },
],
],
use: {
baseURL: origin,
trace: "retain-on-failure",
screenshot: "only-on-failure",
},
webServer: {
env: { [RUN_OUTPUT_ROOT_VARIABLE]: testRunRoot() },
// REV-FE-0015. The wait covers the build: longest start 3,880 ms on desktop
// (2026-11-23, 3 runs), sized like a child process of a test
// (tests/helpers/child-process-timeout.ts). test:a11y inherits it.
timeout: childProcessTimeout(3_880),
command:
`corepack pnpm build && corepack pnpm preview --host 127.0.0.1 --port ${port} --strictPort --outDir ${dist}`,
url: origin,
reuseExistingServer: false,
},
projects: [
{
name: "chromium",
testIgnore: "**/compact-smoke.spec.ts",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
testIgnore: "**/compact-smoke.spec.ts",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
testIgnore: "**/compact-smoke.spec.ts",
use: { ...devices["Desktop Safari"] },
},
{
name: "chromium-compact",
testMatch: "**/compact-smoke.spec.ts",
use: {
...devices["Desktop Chrome"],
viewport: { width: 390, height: 844 },
hasTouch: true,
isMobile: true,
},
},
],
});