惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
GbyAI
GbyAI
博客园_首页
V
Visual Studio Blog
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 叶小钗
腾讯CDC
博客园 - Franky
IT之家
IT之家
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
B
Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(ui): install Playwright ffmpeg for UI e2e · openclaw/...
vincentkoc · 2026-06-18 · via Recent Commits to openclaw:main

@@ -8,16 +8,7 @@ import { chromium } from "playwright";

88

import { resolvePnpmRunner } from "./pnpm-runner.mjs";

991010

const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");

11-

const playwrightInstallArgs = ["--dir", "ui", "exec", "playwright", "install", "chromium"];

12-

const playwrightInstallWithDepsArgs = [

13-

"--dir",

14-

"ui",

15-

"exec",

16-

"playwright",

17-

"install",

18-

"--with-deps",

19-

"chromium",

20-

];

11+

const playwrightInstallBaseArgs = ["--dir", "ui", "exec", "playwright", "install"];

2112

const executableOverrideEnvKey = "PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH";

2213

/**

2314

* System Chromium executable paths used before downloading Playwright browsers.

@@ -59,12 +50,17 @@ export function resolveSystemChromiumExecutablePath(

5950

*/

6051

export function resolvePlaywrightInstallRunner(options = {}) {

6152

const env = options.env ?? process.env;

53+

const targets = options.targets ?? ["chromium"];

6254

return resolvePnpmRunner({

6355

comSpec: options.comSpec ?? env.ComSpec ?? env.COMSPEC,

6456

env,

6557

npmExecPath: env === process.env ? env.npm_execpath : (env.npm_execpath ?? ""),

6658

platform: options.platform,

67-

pnpmArgs: options.withDeps ? playwrightInstallWithDepsArgs : playwrightInstallArgs,

59+

pnpmArgs: [

60+

...playwrightInstallBaseArgs,

61+

...(options.withDeps ? ["--with-deps"] : []),

62+

...targets,

63+

],

6864

});

6965

}

7066

@@ -122,10 +118,37 @@ export function ensurePlaywrightChromium(options = {}) {

122118

const existsSync = options.existsSync ?? existsSyncImpl;

123119

const log = options.log ?? console.error;

124120

const spawnSync = options.spawnSync ?? spawnSyncImpl;

121+

const runPlaywrightInstall = (targets = ["chromium"], withDeps = false) => {

122+

const runner = resolvePlaywrightInstallRunner({

123+

comSpec: options.comSpec,

124+

env,

125+

platform: options.platform,

126+

targets,

127+

withDeps,

128+

});

129+

const result = spawnSync(runner.command, runner.args, {

130+

cwd: options.cwd ?? repoRoot,

131+

env,

132+

shell: runner.shell,

133+

stdio: options.stdio ?? "inherit",

134+

windowsVerbatimArguments: runner.windowsVerbatimArguments,

135+

});

136+

return result.status ?? 1;

137+

};

138+

const ensureFfmpeg = () => {

139+

if (!options.ensureFfmpeg) {

140+

return 0;

141+

}

142+

const status = runPlaywrightInstall(["ffmpeg"]);

143+

if (status !== 0) {

144+

log(`[ui-e2e] Playwright ffmpeg install failed with status ${status}.`);

145+

}

146+

return status;

147+

};

125148126149

if (executableOverride) {

127150

if (existsSync(executableOverride) && canRunChromiumExecutable(executableOverride, spawnSync)) {

128-

return 0;

151+

return ensureFfmpeg();

129152

}

130153

log(

131154

`[ui-e2e] ${executableOverrideEnvKey} points to ${executableOverride}, but that browser is not runnable.`,

@@ -134,14 +157,14 @@ export function ensurePlaywrightChromium(options = {}) {

134157

}

135158136159

if (existsSync(executablePath) && canRunChromiumExecutable(executablePath, spawnSync)) {

137-

return 0;

160+

return ensureFfmpeg();

138161

}

139162140163

const systemExecutablePath =

141164

options.systemExecutablePath ?? resolveSystemChromiumExecutablePath(existsSync, spawnSync);

142165

if (systemExecutablePath && canRunChromiumExecutable(systemExecutablePath, spawnSync)) {

143166

log(`[ui-e2e] Using system Chromium at ${systemExecutablePath}.`);

144-

return 0;

167+

return ensureFfmpeg();

145168

}

146169147170

if (env.OPENCLAW_UI_E2E_ALLOW_MISSING_CHROMIUM === "1") {

@@ -157,35 +180,18 @@ export function ensurePlaywrightChromium(options = {}) {

157180

getuid: options.getuid,

158181

platform: options.platform,

159182

});

160-

const runPlaywrightInstall = (withDeps = false) => {

161-

const runner = resolvePlaywrightInstallRunner({

162-

comSpec: options.comSpec,

163-

env,

164-

platform: options.platform,

165-

withDeps,

166-

});

167-

const result = spawnSync(runner.command, runner.args, {

168-

cwd: options.cwd ?? repoRoot,

169-

env,

170-

shell: runner.shell,

171-

stdio: options.stdio ?? "inherit",

172-

windowsVerbatimArguments: runner.windowsVerbatimArguments,

173-

});

174-

return result.status ?? 1;

175-

};

176-177183

const status = runPlaywrightInstall();

178184

if (status !== 0) {

179185

if (canInstallSystemDependencies) {

180186

log(

181187

`[ui-e2e] Chromium install failed in a Linux CI/root lane; installing Linux system dependencies.`,

182188

);

183-

const depsStatus = runPlaywrightInstall(true);

189+

const depsStatus = runPlaywrightInstall(["chromium"], true);

184190

if (depsStatus !== 0) {

185191

return depsStatus;

186192

}

187193

if (existsSync(executablePath) && canRunChromiumExecutable(executablePath, spawnSync)) {

188-

return 0;

194+

return ensureFfmpeg();

189195

}

190196

log(

191197

`[ui-e2e] Playwright install completed but Chromium is still not runnable at ${executablePath}.`,

@@ -200,22 +206,22 @@ export function ensurePlaywrightChromium(options = {}) {

200206

log(

201207

`[ui-e2e] Chromium is installed but still cannot start; installing Linux system dependencies.`,

202208

);

203-

const depsStatus = runPlaywrightInstall(true);

209+

const depsStatus = runPlaywrightInstall(["chromium"], true);

204210

if (depsStatus !== 0) {

205211

return depsStatus;

206212

}

207213

if (existsSync(executablePath) && canRunChromiumExecutable(executablePath, spawnSync)) {

208-

return 0;

214+

return ensureFfmpeg();

209215

}

210216

}

211217

log(

212218

`[ui-e2e] Playwright install completed but Chromium is still not runnable at ${executablePath}.`,

213219

);

214220

return 1;

215221

}

216-

return 0;

222+

return ensureFfmpeg();

217223

}

218224219225

if (isDirectScriptExecution()) {

220-

process.exitCode = ensurePlaywrightChromium();

226+

process.exitCode = ensurePlaywrightChromium({ ensureFfmpeg: true });

221227

}