Skip to content

Commit 1c3d21c

Browse files
Fix CI Playwright Python fallback
1 parent 6f51aa6 commit 1c3d21c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

web/tests/e2e/global-setup.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { execFileSync } from "node:child_process";
2+
import fs from "node:fs";
23
import path from "node:path";
34

45
async function waitFor(url: string, timeoutMs: number): Promise<void> {
@@ -19,10 +20,12 @@ async function waitFor(url: string, timeoutMs: number): Promise<void> {
1920

2021
export default async function globalSetup() {
2122
const repoRoot = path.resolve(__dirname, "../../..");
22-
const pythonExecutable = path.resolve(
23-
repoRoot,
24-
process.env.WMG_E2E_PYTHON ?? ".venv/bin/python",
25-
);
23+
const configuredPython = process.env.WMG_E2E_PYTHON ?? ".venv/bin/python";
24+
const resolvedPython =
25+
configuredPython.startsWith("/") || configuredPython.includes(path.sep)
26+
? path.resolve(repoRoot, configuredPython)
27+
: configuredPython;
28+
const pythonExecutable = fs.existsSync(resolvedPython) ? resolvedPython : "python";
2629
const apiBase = process.env.WMG_E2E_API_BASE ?? "http://127.0.0.1:8100";
2730
const uploadToken = process.env.WMG_E2E_UPLOAD_TOKEN ?? "e2e-token";
2831

0 commit comments

Comments
 (0)