Файли
openidea/evals/lib/measureDeadline.test.ts
T
l0ng-ai 09301ca12d test(bench): skip browser tests where Playwright's Chromium isn't installed (#4570)
Since #4489 and #4491, harness tests under pnpm test launched Chromium, but CI's Frontend job installs no Playwright browsers, so Frontend failed on every pull request. Those tests now skip when the build they launch (headless shell, or the full browser for the chromium channel) is missing. The legacy artifact-date test compares whole seconds, which every file system keeps.
2026-11-20 00:03:28 +08:00

31 рядки
1.1 KiB
TypeScript

// @vitest-environment node
import { expect, test } from "vitest";
import { chromiumInstalled, launchBrowser } from "../../perf/lib/lifecycle.ts";
import { track } from "./measure.ts";
test.skipIf(!chromiumInstalled(true))(
"track times out on Node's clock when animation frames stop",
{ timeout: 20_000 },
async () => {
const runtime = await launchBrowser({ headless: true });
try {
const page = await runtime.browser.newPage();
await page.evaluate(() => {
// Install the otherwise undeclared probe consumed by the serialized measurement.
const w = window as unknown as { __openideaPerf: unknown };
w.__openideaPerf = {
editorState: () => null,
runAction: async () => true,
};
window.requestAnimationFrame = () => 0;
});
// The platform-clock boundary is the regression; a fake Node clock cannot drive Chromium.
await expect(
track(page, { action: "fixture.action", arg: null, first: () => false, done: () => false, timeoutMs: 20 }),
).rejects.toThrow("page measurement timed out");
} finally {
await runtime.close();
}
},
);