]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
fix(playwright): use `npm run` to start the server on default port (#540)
authorRaku Zeta <zetaraku@gmail.com>
Wed, 10 Jul 2024 06:46:23 +0000 (14:46 +0800)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2024 06:46:23 +0000 (08:46 +0200)
Also use conditional baseURL depending on CI variable

template/config/playwright/playwright.config.js

index 92075cc1bb3a62c86294d6baec8bf636dad8ce1b..cbb25003f0bfe5868fc9fe5f6c9dd9a2308e0b9f 100644 (file)
@@ -34,7 +34,7 @@ export default defineConfig({
     /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
     actionTimeout: 0,
     /* Base URL to use in actions like `await page.goto('/')`. */
-    baseURL: 'http://localhost:5173',
+    baseURL: process.env.CI ? 'http://localhost:4173' : 'http://localhost:5173',
 
     /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
     trace: 'on-first-retry',
@@ -103,8 +103,8 @@ export default defineConfig({
      * Use the preview server on CI for more realistic testing.
      * Playwright will re-use the local server if there is already a dev-server running.
      */
-    command: process.env.CI ? 'vite preview --port 5173' : 'vite dev',
-    port: 5173,
+    command: process.env.CI ? 'npm run preview' : 'npm run dev',
+    port: process.env.CI ? 4173 : 5173,
     reuseExistingServer: !process.env.CI
   }
 })