mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
fix(test): install playwright deps after host validation failure
This commit is contained in:
@@ -193,6 +193,56 @@ describe("ensurePlaywrightChromium", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("retries with Linux system dependencies when the Chromium install reports missing host deps", () => {
|
||||
const logs: string[] = [];
|
||||
const spawnSync = vi
|
||||
.fn()
|
||||
.mockReturnValueOnce({ status: 23 })
|
||||
.mockReturnValueOnce({ status: 0 })
|
||||
.mockReturnValueOnce({ status: 0 });
|
||||
let existsCalls = 0;
|
||||
|
||||
expect(
|
||||
ensurePlaywrightChromium({
|
||||
cwd: "/repo",
|
||||
env: { CI: "1", PATH: "/bin" },
|
||||
executablePath: "/cache/chromium/chrome",
|
||||
existsSync: () => ++existsCalls > 1,
|
||||
getuid: () => 501,
|
||||
log: (line: string) => logs.push(line),
|
||||
platform: "linux",
|
||||
spawnSync,
|
||||
stdio: "pipe",
|
||||
systemExecutablePath: "",
|
||||
}),
|
||||
).toBe(0);
|
||||
expect(spawnSync).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"pnpm",
|
||||
["--dir", "ui", "exec", "playwright", "install", "chromium"],
|
||||
{
|
||||
cwd: "/repo",
|
||||
env: { CI: "1", PATH: "/bin" },
|
||||
shell: false,
|
||||
stdio: "pipe",
|
||||
windowsVerbatimArguments: undefined,
|
||||
},
|
||||
);
|
||||
expect(spawnSync).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
"pnpm",
|
||||
["--dir", "ui", "exec", "playwright", "install", "--with-deps", "chromium"],
|
||||
{
|
||||
cwd: "/repo",
|
||||
env: { CI: "1", PATH: "/bin" },
|
||||
shell: false,
|
||||
stdio: "pipe",
|
||||
windowsVerbatimArguments: undefined,
|
||||
},
|
||||
);
|
||||
expect(logs.join("\n")).toContain("installing Linux system dependencies");
|
||||
});
|
||||
|
||||
it("does not install Linux system dependencies for an unprivileged local lane", () => {
|
||||
const spawnSync = vi
|
||||
.fn()
|
||||
|
||||
Reference in New Issue
Block a user