fix(ui): detect system chromium for e2e · openclaw/openclaw@0bfba7e
vincentkoc
·
2026-06-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,6 +9,17 @@ import { resolvePnpmRunner } from "./pnpm-runner.mjs";
|
9 | 9 | const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); |
10 | 10 | const playwrightInstallArgs = ["--dir", "ui", "exec", "playwright", "install", "chromium"]; |
11 | 11 | const executableOverrideEnvKey = "PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH"; |
| 12 | +export const systemChromiumExecutableCandidates = [ |
| 13 | +"/snap/bin/chromium", |
| 14 | +"/usr/bin/chromium-browser", |
| 15 | +"/usr/bin/chromium", |
| 16 | +"/usr/bin/google-chrome", |
| 17 | +"/usr/bin/google-chrome-stable", |
| 18 | +]; |
| 19 | + |
| 20 | +export function resolveSystemChromiumExecutablePath(existsSync = existsSyncImpl) { |
| 21 | +return systemChromiumExecutableCandidates.find((candidate) => existsSync(candidate)) ?? ""; |
| 22 | +} |
12 | 23 | |
13 | 24 | export function resolvePlaywrightInstallRunner(options = {}) { |
14 | 25 | const env = options.env ?? process.env; |
@@ -58,6 +69,13 @@ export function ensurePlaywrightChromium(options = {}) {
|
58 | 69 | return 0; |
59 | 70 | } |
60 | 71 | |
| 72 | +const systemExecutablePath = |
| 73 | +options.systemExecutablePath ?? resolveSystemChromiumExecutablePath(existsSync); |
| 74 | +if (systemExecutablePath) { |
| 75 | +log(`[ui-e2e] Using system Chromium at ${systemExecutablePath}.`); |
| 76 | +return 0; |
| 77 | +} |
| 78 | + |
61 | 79 | if (env.OPENCLAW_UI_E2E_ALLOW_MISSING_CHROMIUM === "1") { |
62 | 80 | log( |
63 | 81 | `[ui-e2e] Playwright Chromium is missing at ${executablePath}; OPENCLAW_UI_E2E_ALLOW_MISSING_CHROMIUM=1 leaves the lane skipped.`, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。