frontend-quality-gates / merge / static checks (pull_request) Successful in 1m23s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 11m31s
FE-GATE-008의 Firefox 시험이 가끔 첫 화면 5초 대기에서 실패한다
(old-tab-chunk-recovery.spec.ts, preload-use.spec.ts,
platform-overview.spec.ts). runner run 127과 desktop merge 검증에서
실패했고, 다시 돌리면 통과해 묻혔다.
Playwright는 Firefox 프로필을 os.tmpdir()에 만든다. desktop과 CI job
모두 /tmp가 같은 SATA SSD 위에 있다. Firefox는 시험 context의
localStorage·IndexedDB를 그 프로필(디스크)에 둔다. 그래서 디스크가
붐비면 context마다 첫 localStorage 접근이 디스크 일을 기다린다.
Chromium·WebKit은 시험 context 저장소를 메모리에 둔다. 앱은 첫 렌더
전에 색 구성 설정을 localStorage에서 읽어, 그 대기가 첫 화면 대기에
들어간다. desktop e2e 전체 8회(2026-11-13)에서 Firefox 앱 부팅 463회
중 19회가 0.7~3.8초 멈췄고, Chromium·WebKit은 16 ms를 넘지 않았다.
tests/support/browser/browser-test.ts가 Firefox worker의 프로필을 RAM
파일시스템에 둔다. os.tmpdir()가 이미 tmpfs면 그대로 쓴다. 아니면
/dev/shm에 worker 수 x 64 MB 자리가 있을 때 그 안에 폴더를 만든다.
Playwright의 browser fixture가 launch하는 동안만 TMPDIR를 그 폴더로
돌리고 바로 되돌린다. 그래서 fixture build 같은 다른 임시 파일은
디스크에 그대로 남는다. 프로필이 그 폴더에 생기지 않으면 시험을
실패시킨다. 자리가 없으면 이유를 한 줄 알리고 디스크에 둔다. strict
fixture와 strict를 쓰지 않는 spec 둘(preload-use, chunk-load-error)이
이 test를 바탕으로 쓴다. docs/work/reference/testing.md 5절 표에 원인을
적었다.
버린 대안:
- worker마다 localStorage를 미리 한 번 건드리는 예열: 브라우저 프로세스당
한 번 드는 준비 비용으로 봤다. 예열 뒤에도 19/463이 멈췄다. 예열
context를 바로 닫는 판은 21/464로 더 나빴다.
- toolkit.storage.synchronous=0(SQLite fsync 끔): 15/224로 그대로였다.
- 첫 화면 대기 timeout 늘리기, worker 줄이기: 원인을 덮는다.
- 시험 실행 전체에 TMPDIR 걸기: fixture build까지 RAM에 들어간다.
위험·한계:
- CI job 컨테이너는 /dev/shm이 64 MB다(2026-11-13 runner 확인). /tmp는
같은 SSD 위에 있다. 그래서 CI에서는 프로필이 디스크에 남고 로그에
이유가 한 줄 찍힌다. CI까지 고치려면 runner가 job 컨테이너에 RAM
자리를 줘야 한다(--shm-size 또는 --tmpfs /tmp). runner 설정이라 이
커밋에 넣지 않았다.
- 64 MB/worker는 Firefox worker 6개 프로필 합이 가장 컸을 때 211 MB(1개
35 MB)인 것을 보고 잡은 여유다.
- Playwright의 두 동작에 기댄다. fixture 의존성을 적힌 순서로 준비하는
것과, launch할 때 os.tmpdir()를 읽는 것이다. 어느 쪽이 바뀌어도
폴더가 비므로 시험이 실패해 알린다.
검증(desktop):
- 재현: Firefox 6개를 동시에 띄우고 context 8개씩 localStorage 첫 접근을
쟀다. 프로필 /tmp에서 최대 8,157 ms(384회), /dev/shm에서 최대 17 ms
(384회).
- 수정본 e2e 전체 10회: 매번 189 passed. Firefox 부팅 576회 중 0.5초를
넘는 멈춤 0회(최대 36 ms), 부하 15.9~31.2. 프로필은 매번 /dev/shm에
5~6개, 디스크 0개, 끝난 뒤 남은 폴더 0개.
- 변이: launch 전에 TMPDIR를 돌리지 않게 하면 theme.spec.ts(firefox)가
2 failed, 안전장치 메시지로 실패한다.
- check:types:test, eslint(바뀐 파일), check:test-evidence:source 통과.
- scripts/verify.sh gate FE-GATE-008(CI=true, main ee95573f 위): rc=0 205초,
e2e 189 passed, browser-capabilities 69, storybook 11, visual 7.
- scripts/verify.sh docs, desktop verify:documentation 통과.
97 lines
3.5 KiB
TypeScript
97 lines
3.5 KiB
TypeScript
import type { ConsoleMessage, Page } from "@playwright/test";
|
|
|
|
import { expect, test as base } from "./browser-test.ts";
|
|
import { trackPreloadUse } from "./preload-use.ts";
|
|
|
|
/**
|
|
* 1103/11-09. WebKit's guess, three seconds after the load event, that a
|
|
* preload went unused. It fired for chunks the page ran a moment later and
|
|
* missed preloads the page never ran once the test had ended. The fixture
|
|
* checks preload use itself, in every engine (`preloadunused:` below).
|
|
*/
|
|
const WEBKIT_UNUSED_PRELOAD_GUESS =
|
|
/^The resource \S+ was preloaded using link preload but not used within a few seconds from the window's load event\. Please make sure it wasn't preloaded for nothing\.$/u;
|
|
|
|
function ignoredConsole(message: ConsoleMessage) {
|
|
return (
|
|
message.type() === "warning" &&
|
|
(message.text().includes("NO_COLOR") ||
|
|
WEBKIT_UNUSED_PRELOAD_GUESS.test(message.text()))
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 1105/11-01. What the strict `page` fixture does with every failure it
|
|
* recorded, once the test has ended.
|
|
*/
|
|
export type BrowserFailureVerdict = Readonly<{
|
|
judge(failures: readonly string[]): void;
|
|
}>;
|
|
|
|
export const test = base.extend<{
|
|
/**
|
|
* Browser failures a test provokes on purpose, matched against the recorded
|
|
* `console:…`, `pageerror:…`, `requestfailed:…` or `preloadunused:…` line
|
|
* (for example the browser's log line for a mocked 4xx, or the chunks
|
|
* preloaded with a chunk the test removed). Everything else still fails. One
|
|
* pattern, not an array: `test.use` reads an array as a `[value, options]`
|
|
* fixture tuple.
|
|
*/
|
|
allowedBrowserFailure: RegExp | undefined;
|
|
/**
|
|
* Fails the test for every recorded failure `allowedBrowserFailure` does not
|
|
* match. The record is made after the test body, where no test can read it,
|
|
* so tests/e2e/preload-use.spec.ts replaces this verdict to read what the
|
|
* fixture recorded and prove the record itself. No other spec replaces it.
|
|
*/
|
|
browserFailureVerdict: BrowserFailureVerdict;
|
|
}>({
|
|
allowedBrowserFailure: [undefined, { option: true }],
|
|
browserFailureVerdict: async ({ allowedBrowserFailure }, use) => {
|
|
await use(
|
|
Object.freeze({
|
|
judge(failures: readonly string[]) {
|
|
expect(
|
|
failures.filter(
|
|
(failure) => !allowedBrowserFailure?.test(failure),
|
|
),
|
|
"unexpected browser console/page errors",
|
|
).toEqual([]);
|
|
},
|
|
}),
|
|
);
|
|
},
|
|
page: async ({ page, browserFailureVerdict }, use) => {
|
|
const preloads = await trackPreloadUse(page);
|
|
const failures: string[] = [];
|
|
const onConsole = (message: ConsoleMessage) => {
|
|
if (
|
|
["error", "warning"].includes(message.type()) &&
|
|
!ignoredConsole(message)
|
|
) {
|
|
failures.push(`console:${message.type()}:${message.text()}`);
|
|
}
|
|
};
|
|
const onPageError = (error: Error) => {
|
|
failures.push(`pageerror:${error.name}`);
|
|
};
|
|
const onRequestFailed = (request: import("@playwright/test").Request) => {
|
|
failures.push(
|
|
`requestfailed:${request.method()}:${new URL(request.url()).pathname}:${request.failure()?.errorText ?? "unknown"}`,
|
|
);
|
|
};
|
|
page.on("console", onConsole);
|
|
page.on("pageerror", onPageError);
|
|
page.on("requestfailed", onRequestFailed);
|
|
await use(page);
|
|
failures.push(...(await preloads.check()).failures);
|
|
page.off("console", onConsole);
|
|
page.off("pageerror", onPageError);
|
|
page.off("requestfailed", onRequestFailed);
|
|
browserFailureVerdict.judge(failures);
|
|
},
|
|
});
|
|
|
|
export { expect };
|
|
export type { Page };
|