Files
clean-architecture-frontend…/playwright.storybook.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

56 lines
1.7 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
import { flakyJudgement, flakyJudgementReporter } from "./scripts/lib/playwright-flaky-judgement.ts";
import {
reservePort,
TEST_PORT_VARIABLES,
testRunPath,
} from "./scripts/lib/run-isolation.ts";
import { storybookStaticServer } from "./scripts/lib/storybook-static.ts";
import { childProcessTimeout } from "./tests/helpers/child-process-timeout.ts";
// 1105/12-04. Under TEST_RUN_ID the workshop build (storybookStaticServer),
// the results and the report are the run's own. The static server listens on
// a free port (TEST_STORYBOOK_PORT pins one).
const port = await reservePort(TEST_PORT_VARIABLES.storybook);
const origin = `http://127.0.0.1:${port}`;
export default defineConfig({
testDir: "./tests/storybook",
forbidOnly: true,
...flakyJudgement(),
outputDir: testRunPath("artifacts/tests/storybook/results"),
reporter: [
["list"],
flakyJudgementReporter,
[
"html",
{
outputFolder: testRunPath("artifacts/tests/storybook/report"),
open: "never",
},
],
[
"junit",
{ outputFile: testRunPath("artifacts/tests/storybook/results.xml"), includeRetries: true },
],
],
use: {
baseURL: origin,
trace: "retain-on-failure",
screenshot: "only-on-failure",
},
webServer: {
// REV-FE-0015. The command builds the workshop first: longest start
// 8,887 ms on desktop (2026-11-23, 2 runs), sized like a child process of
// a test (tests/helpers/child-process-timeout.ts).
timeout: childProcessTimeout(8_887),
command: storybookStaticServer(port).command,
url: origin,
reuseExistingServer: false,
},
projects: [
{ name: "chromium-workshop", use: { ...devices["Desktop Chrome"] } },
],
});