diff --git a/Jenkinsfile b/Jenkinsfile index 6568897..156228d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -309,7 +309,8 @@ if [ "${npm_ci_rc}" -eq 0 ]; then npm run lint npm run test:unit npm run test:component - npm run test:e2e + npm run build + PLAYWRIGHT_REUSE_DIST=1 npm run test:e2e frontend_rc=$? else echo "frontend dependency install failed after retries" >&2 diff --git a/testing/frontend/playwright.config.mjs b/testing/frontend/playwright.config.mjs index 4e70530..924d46e 100644 --- a/testing/frontend/playwright.config.mjs +++ b/testing/frontend/playwright.config.mjs @@ -4,6 +4,8 @@ import { defineConfig } from "../../frontend/node_modules/@playwright/test/index const testingDir = path.dirname(fileURLToPath(import.meta.url)); const frontendRoot = path.resolve(testingDir, "../../frontend"); +const previewCommand = "npm run preview -- --host 127.0.0.1 --port 4173 --strictPort"; +const webServerCommand = process.env.PLAYWRIGHT_REUSE_DIST === "1" ? previewCommand : `npm run build && ${previewCommand}`; export default defineConfig({ testDir: path.resolve(testingDir, "e2e"), @@ -18,11 +20,11 @@ export default defineConfig({ viewport: { width: 1440, height: 1080 }, }, webServer: { - command: "npm run build && npm run preview -- --host 127.0.0.1 --port 4173", + command: webServerCommand, cwd: frontendRoot, url: "http://127.0.0.1:4173", reuseExistingServer: !process.env.CI, - timeout: 120000, + timeout: process.env.CI ? 420000 : 120000, }, reporter: [["list"], ["junit", { outputFile: path.resolve(testingDir, "../../build/junit-frontend-e2e.xml") }]], });