
























@@ -151,48 +151,55 @@ export function ensurePlaywrightChromium(options = {}) {
151151}
152152153153log(`[ui-e2e] Playwright Chromium is not runnable at ${executablePath}; installing chromium.`);
154-const runner = resolvePlaywrightInstallRunner({
155-comSpec: options.comSpec,
154+const canInstallSystemDependencies = shouldInstallPlaywrightSystemDependencies({
156155 env,
156+getuid: options.getuid,
157157platform: options.platform,
158158});
159-const result = spawnSync(runner.command, runner.args, {
160-cwd: options.cwd ?? repoRoot,
161- env,
162-shell: runner.shell,
163-stdio: options.stdio ?? "inherit",
164-windowsVerbatimArguments: runner.windowsVerbatimArguments,
165-});
166-const status = result.status ?? 1;
159+const runPlaywrightInstall = (withDeps = false) => {
160+const runner = resolvePlaywrightInstallRunner({
161+comSpec: options.comSpec,
162+ env,
163+platform: options.platform,
164+ withDeps,
165+});
166+const result = spawnSync(runner.command, runner.args, {
167+cwd: options.cwd ?? repoRoot,
168+ env,
169+shell: runner.shell,
170+stdio: options.stdio ?? "inherit",
171+windowsVerbatimArguments: runner.windowsVerbatimArguments,
172+});
173+return result.status ?? 1;
174+};
175+176+const status = runPlaywrightInstall();
167177if (status !== 0) {
178+if (canInstallSystemDependencies) {
179+log(
180+`[ui-e2e] Chromium install failed in a Linux CI/root lane; installing Linux system dependencies.`,
181+);
182+const depsStatus = runPlaywrightInstall(true);
183+if (depsStatus !== 0) {
184+return depsStatus;
185+}
186+if (existsSync(executablePath) && canRunChromiumExecutable(executablePath, spawnSync)) {
187+return 0;
188+}
189+log(
190+`[ui-e2e] Playwright install completed but Chromium is still not runnable at ${executablePath}.`,
191+);
192+return 1;
193+}
168194return status;
169195}
170196171197if (!existsSync(executablePath) || !canRunChromiumExecutable(executablePath, spawnSync)) {
172-if (
173-shouldInstallPlaywrightSystemDependencies({
174- env,
175-getuid: options.getuid,
176-platform: options.platform,
177-})
178-) {
198+if (canInstallSystemDependencies) {
179199log(
180200`[ui-e2e] Chromium is installed but still cannot start; installing Linux system dependencies.`,
181201);
182-const depsRunner = resolvePlaywrightInstallRunner({
183-comSpec: options.comSpec,
184- env,
185-platform: options.platform,
186-withDeps: true,
187-});
188-const depsResult = spawnSync(depsRunner.command, depsRunner.args, {
189-cwd: options.cwd ?? repoRoot,
190- env,
191-shell: depsRunner.shell,
192-stdio: options.stdio ?? "inherit",
193-windowsVerbatimArguments: depsRunner.windowsVerbatimArguments,
194-});
195-const depsStatus = depsResult.status ?? 1;
202+const depsStatus = runPlaywrightInstall(true);
196203if (depsStatus !== 0) {
197204return depsStatus;
198205}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。