diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index cff07f1d..3543706b 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -55,10 +55,6 @@ jobs: npm ci npx playwright install --with-deps chromium - - name: Generate E2E fixtures - working-directory: tests/e2e - run: npm run gen:all - - name: Start fixture server run: | cd tests/e2e/fixtures @@ -97,20 +93,13 @@ jobs: exit 1 fi - - name: Run smoke suite - working-directory: tests/e2e - env: - KK_BASE_URL: http://127.0.0.1:8012 - FIXTURE_BASE_URL: http://127.0.0.1:18080 - run: npm run test:smoke - - - name: Run perf suite + - name: Run nightly E2E suites working-directory: tests/e2e env: KK_BASE_URL: http://127.0.0.1:8012 FIXTURE_BASE_URL: http://127.0.0.1:18080 E2E_MAX_PREVIEW_MS: 20000 - run: npm run test:perf + run: npm run test:ci - name: Upload Playwright report if: always() diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 03d4f9f9..32ad1396 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -62,4 +62,7 @@ npm run test:smoke # perf smoke (self-contained; default threshold 15000ms) E2E_MAX_PREVIEW_MS=15000 npm run test:perf + +# CI-style combined run (single fixture generation) +E2E_MAX_PREVIEW_MS=20000 npm run test:ci ``` diff --git a/tests/e2e/package.json b/tests/e2e/package.json index e465cc69..78f3f375 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -13,7 +13,8 @@ "pretest:smoke": "npm run gen:all", "test:smoke": "playwright test specs/preview-smoke.spec.ts", "pretest:perf": "npm run gen:all", - "test:perf": "playwright test specs/perf-smoke.spec.ts" + "test:perf": "playwright test specs/perf-smoke.spec.ts", + "test:ci": "npm run gen:all && playwright test specs/preview-smoke.spec.ts specs/perf-smoke.spec.ts" }, "devDependencies": { "@playwright/test": "^1.55.0" diff --git a/tests/e2e/specs/perf-smoke.spec.ts b/tests/e2e/specs/perf-smoke.spec.ts index 6976ead5..1dd61ed8 100644 --- a/tests/e2e/specs/perf-smoke.spec.ts +++ b/tests/e2e/specs/perf-smoke.spec.ts @@ -1,16 +1,18 @@ import { test, expect, request as playwrightRequest } from '@playwright/test'; +import type { APIRequestContext } from '@playwright/test'; const fixtureBase = process.env.FIXTURE_BASE_URL || 'http://127.0.0.1:18080'; +const DEFAULT_MAX_MS = 15000; const envMaxMs = Number(process.env.E2E_MAX_PREVIEW_MS); -const maxMs = Number.isFinite(envMaxMs) ? envMaxMs : 15000; +const maxMs = Number.isFinite(envMaxMs) && envMaxMs >= 1 ? Math.floor(envMaxMs) : DEFAULT_MAX_MS; function b64(v: string): string { return Buffer.from(v).toString('base64'); } -async function timedPreview(request: any, fileUrl: string) { +async function timedPreview(request: APIRequestContext, fileUrl: string) { const started = Date.now(); - const resp = await request.get(`/onlinePreview?url=${b64(fileUrl)}`); + const resp = await request.get(`/onlinePreview?url=${encodeURIComponent(b64(fileUrl))}`); const elapsed = Date.now() - started; return { resp, elapsed }; }