Skip to content

Commit cf3f7a7

Browse files
authored
fix(playwright): use npm run to start the server on default port (#540)
Also use conditional baseURL depending on CI variable
1 parent 79cfc72 commit cf3f7a7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

template/config/playwright/playwright.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default defineConfig({
3434
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
3535
actionTimeout: 0,
3636
/* Base URL to use in actions like `await page.goto('/')`. */
37-
baseURL: 'http://localhost:5173',
37+
baseURL: process.env.CI ? 'http://localhost:4173' : 'http://localhost:5173',
3838

3939
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
4040
trace: 'on-first-retry',
@@ -103,8 +103,8 @@ export default defineConfig({
103103
* Use the preview server on CI for more realistic testing.
104104
* Playwright will re-use the local server if there is already a dev-server running.
105105
*/
106-
command: process.env.CI ? 'vite preview --port 5173' : 'vite dev',
107-
port: 5173,
106+
command: process.env.CI ? 'npm run preview' : 'npm run dev',
107+
port: process.env.CI ? 4173 : 5173,
108108
reuseExistingServer: !process.env.CI
109109
}
110110
})

0 commit comments

Comments
 (0)