- Extracted the chromiumCanLaunch probe from browser-tab-evaluate into a shared test/tools/chromium-probe.ts helper. - The two attached-navigation tests from PR #7006 launch real headless Chrome; CI runners without Chrome system libraries (libnspr4 & co.) cannot exec the downloaded binary, failing the native/unit bucket. - Gave both tests 30s timeouts to survive CI cold starts.
22 lines
813 B
TypeScript
22 lines
813 B
TypeScript
import { ensureChromiumExecutable } from "@oh-my-pi/pi-coding-agent/tools/browser/launch";
|
|
|
|
/**
|
|
* Whether the Chromium puppeteer resolves can actually execute on this host.
|
|
* CI runners without Chrome's system libraries (libnspr4 & co.) hold the
|
|
* downloaded binary but cannot exec it — probe with --version and skip
|
|
* instead of failing.
|
|
*/
|
|
async function chromiumCanLaunch(): Promise<boolean> {
|
|
try {
|
|
const executable = await ensureChromiumExecutable();
|
|
if (!executable) return false;
|
|
const probe = Bun.spawnSync([executable, "--version"], { stdout: "ignore", stderr: "ignore" });
|
|
return probe.exitCode === 0;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/** Gate for tests that launch a real Chromium: `describe.skipIf(!CHROMIUM_AVAILABLE)`. */
|
|
export const CHROMIUM_AVAILABLE = await chromiumCanLaunch();
|