browser tests: deterministic under load
The afterAll hook of tests/console-fill.test.ts timed out (30 s) in 2 of 3 runs with 10 CPU hogs. Cause: Google Chrome (the fallback when playwright's Chromium is not downloaded) hangs in its own shutdown after loading http pages until its 10 s teardown watchdog fires; under load that passed 30 s. - tests/helpers/browser.ts: one shared launch per file as a browser server with a 60 s launch timeout, killed at the end (throwaway profile, nothing to flush); a launch timeout fails instead of silently skipping; contexts and engine runs tracked per test and closed in afterEach (capped); event-driven waits for engine log lines - console-fill: explicit test timeouts, slow tests marked, waits expected to succeed get a long cap (they return at once), sign-in / watching navTimeoutMs 1.5 s -> 5 s, persistent-profile Chromium closed in finally, temp account dirs removed - site-overflow, console-session: same plumbing (site-overflow's afterAll had bun's 5 s default) - console session: launchTimeoutMs option (tests only)
This commit is contained in:
parent
c4bc45f479
commit
f8361c5beb
5 changed files with 233 additions and 83 deletions
|
|
@ -168,6 +168,8 @@ export interface OpenOpts {
|
|||
hosts?: string[];
|
||||
headless?: boolean;
|
||||
platform?: string;
|
||||
/** Tests: Playwright's launch timeout for modes (b) and (c) (default: Playwright's 30 s). */
|
||||
launchTimeoutMs?: number;
|
||||
say: (m: string) => void;
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +235,7 @@ export async function openConsoleBrowser(root: string, o: OpenOpts): Promise<Con
|
|||
copy = await copySession(chromeDir, { ...(o.chromeProfile ? { profile: o.chromeProfile } : {}), ...(o.hosts ? { hosts: o.hosts } : {}) });
|
||||
const c = await chromiumFor(root);
|
||||
const context = await c.launchPersistentContext(copy.dir, {
|
||||
channel: 'chrome', headless: o.headless ?? false, viewport: null, args: KEEP_SESSION_ARGS,
|
||||
channel: 'chrome', headless: o.headless ?? false, viewport: null, args: KEEP_SESSION_ARGS, ...(o.launchTimeoutMs ? { timeout: o.launchTimeoutMs } : {}),
|
||||
// Playwright's mock keychain would hide Chrome's own key, and the cookies could not be read
|
||||
ignoreDefaultArgs: ['--use-mock-keychain', '--password-store=basic'],
|
||||
});
|
||||
|
|
@ -251,7 +253,7 @@ export async function openConsoleBrowser(root: string, o: OpenOpts): Promise<Con
|
|||
}
|
||||
// (c) storebound's persistent profile, the owner signs in there
|
||||
mkdirSync(o.profileDir, { recursive: true });
|
||||
const context = await launchPersistent(root, o.profileDir, { headless: o.headless ?? false, viewport: null, args: KEEP_SESSION_ARGS });
|
||||
const context = await launchPersistent(root, o.profileDir, { headless: o.headless ?? false, viewport: null, args: KEEP_SESSION_ARGS, ...(o.launchTimeoutMs ? { timeout: o.launchTimeoutMs } : {}) });
|
||||
o.say(`browser: storebound's own profile (${o.profileDir}); sign in there once, it is kept for the next run`);
|
||||
const page = await ownTab(context);
|
||||
return wrapContext('profile', context, page, () => { /* kept on purpose */ });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue