Skip to content

Commit 55ab5a4

Browse files
Updating playwright config for devhost tests (#17142)
Updating the playwright configuration for devhost visual tests, so playwright itself starts the devhost before running the visual tests, instead of having to do both things separately.
1 parent de8de9b commit 55ab5a4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

playwright.devhost.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,24 @@ export default defineConfig({
2525
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
2626
trace: "on-first-retry",
2727
ignoreHTTPSErrors: true,
28+
// Provide a baseURL so tests can use page.goto("/path") without hardcoding the host.
29+
baseURL: process.env.BASE_URL || "http://localhost:1338",
2830
},
2931

3032
globalSetup: browserType === "BrowserStack" ? require.resolve("./packages/tools/tests/globalSetup.ts") : undefined,
3133
globalTeardown: browserType === "BrowserStack" ? require.resolve("./packages/tools/tests/globalTeardown.ts") : undefined,
3234

35+
/* Start the dev host automatically before the tests.
36+
Playwright will wait until the URL responds (HTTP 200/302) before executing tests. */
37+
webServer: {
38+
command: process.env.PW_DEVHOST_CMD || "npm run serve -w @tools/dev-host",
39+
url: process.env.BASE_URL || "http://localhost:1338",
40+
reuseExistingServer: !isCI,
41+
timeout: 90_000,
42+
stdout: "pipe",
43+
stderr: "pipe",
44+
},
45+
3346
/* Project configuration */
3447
projects: getDevHostTestsList(),
3548
/* Snapshots */

0 commit comments

Comments
 (0)