cpython/Platforms/emscripten/browser_test/playwright.config.ts
Hood Chatham 2be147e1e7
gh-146352: In Emscripten pyrepl test, pick port dynamically (#146375)
Dynamically allocates the port for the pyrepl browser test, so that multiple
tests can run at the same time. Also allows the pyrepl test to honor the
CROSS_BUILD_DIR environment variable.
2026-03-25 18:38:11 +08:00

26 lines
715 B
TypeScript

import { defineConfig, devices } from '@playwright/test';
import { resolve } from "node:path";
const port = process.env.PORT ?? "8787";
const crossBuildDir = resolve("../../../", process.env.CROSS_BUILD_DIR ?? "cross-build");
export default defineConfig({
testDir: '.',
forbidOnly: true,
retries: 2,
reporter: process.env.CI ? 'dot' : 'html',
use: {
baseURL: `http://localhost:${port}`,
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
command: `npx http-server ${crossBuildDir}/wasm32-emscripten/build/python/web_example_pyrepl_jspi/ -p ${port}`,
url: `http://localhost:${port}`,
},
});