ci speed: desktop boot check runs its cases in parallel (one browser, killed at the end; a page per case; condition waits instead of fixed sleeps: element, text or a quiet window of host calls and DOM); shots capture / render close the browser with a 3 s cap, then kill it; console engine waits injectable for tests (WAITS / engineWaits: poll rounds, a missing step ends once its loaded page stays quiet, team switch settle, field-miss grace), fillPage looks up each data type's dialog once per round and skips dialog sections when no dialog is open; browser tests run 4 at a time per file (testScope().concurrent with a scope per test, --max-concurrency in ci), 20 ms rounds; capture-web counts boots per test and runs its browser tests concurrently; console-session / -persist Chrome tests concurrent; recorded test timings smoothed (mergeTimings) so one loaded run does not skew the shard split
This commit is contained in:
parent
f2d7062bcb
commit
9ba8471002
16 changed files with 390 additions and 178 deletions
|
|
@ -175,6 +175,32 @@ export async function launch(root: string, opts: Record<string, unknown>, deps:
|
|||
return withCandidates(kind, deps.installed ?? installedBrowsers(c), o => c.launch({ ...opts, ...o }));
|
||||
}
|
||||
|
||||
/** How long a launched (throwaway profile) browser gets to close gracefully before it is killed. */
|
||||
export const CLOSE_GRACE_MS = 3000;
|
||||
|
||||
/**
|
||||
* Ends a browser from `launch` once the work is done: a graceful close capped at `ms`, then SIGKILL of its process.
|
||||
* Google Chrome often hangs 10-30 s in its own shutdown after http pages (tests/helpers/browser.ts); a throwaway
|
||||
* profile has nothing to flush, so waiting for it only costs time. The pid is read over CDP before the close. Never
|
||||
* throws.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export async function closeBrowser(browser: any, ms = CLOSE_GRACE_MS): Promise<void> {
|
||||
let pid: number | undefined;
|
||||
try {
|
||||
const s = await browser.newBrowserCDPSession();
|
||||
const info = await s.send('SystemInfo.getProcessInfo') as { processInfo: { type: string; id: number }[] };
|
||||
pid = info.processInfo.find(p => p.type === 'browser')?.id;
|
||||
} catch { /* not Chromium, or already gone */ }
|
||||
let t: ReturnType<typeof setTimeout> | undefined;
|
||||
const closed = await Promise.race([
|
||||
Promise.resolve().then(() => browser.close()).then(() => true, () => true),
|
||||
new Promise<boolean>(r => { t = setTimeout(() => r(false), ms); }),
|
||||
]);
|
||||
clearTimeout(t);
|
||||
if (!closed && pid) try { process.kill(pid, 'SIGKILL'); } catch { /* exited meanwhile */ }
|
||||
}
|
||||
|
||||
/**
|
||||
* A persistent browser profile (cookies of a console sign-in the owner did by hand stay there between runs; storebound
|
||||
* never reads them). Used by `storebound console fill`: always a real Chrome / Chromium (kind "visible", also when a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue