chore: enhance E2E tests workflow by adding caching for Next.js build and updating test command

This commit is contained in:
Anish Sarkar 2026-05-10 22:21:06 +05:30
parent 548e574f1a
commit 292b4d70ac
4 changed files with 21 additions and 7 deletions

View file

@ -21,8 +21,7 @@ jobs:
if: github.event.pull_request.draft == false
timeout-minutes: 45
# Postgres runs as a step (not a service) so we can pass `-c wal_level=logical`,
# required for migration 117's zero-cache publications.
# Postgres runs as a step (not a service)
services:
redis:
image: redis:8-alpine
@ -246,9 +245,17 @@ jobs:
working-directory: surfsense_web
run: pnpm exec playwright install-deps chromium
- name: Cache Next.js build
uses: actions/cache@v5
with:
path: surfsense_web/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('surfsense_web/pnpm-lock.yaml') }}-${{ hashFiles('surfsense_web/**/*.{js,jsx,ts,tsx}') }}
restore-keys: |
nextjs-${{ runner.os }}-${{ hashFiles('surfsense_web/pnpm-lock.yaml') }}-
- name: Run Playwright tests
working-directory: surfsense_web
run: pnpm test:e2e
run: pnpm test:e2e:prod
- name: Upload Playwright HTML report
if: always()

View file

@ -67,7 +67,11 @@ def run_migrations_offline() -> None:
def do_run_migrations(connection: Connection) -> None:
context.configure(connection=connection, target_metadata=target_metadata)
context.configure(
connection=connection,
target_metadata=target_metadata,
transaction_per_migration=True,
)
with context.begin_transaction():
context.run_migrations()

View file

@ -20,6 +20,7 @@
"db:studio": "drizzle-kit studio",
"format:fix": "npx @biomejs/biome check --fix",
"test:e2e": "playwright test",
"test:e2e:prod": "cross-env CI=1 playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:headed": "playwright test --headed",
"test:e2e:debug": "playwright test --debug",

View file

@ -53,11 +53,13 @@ export default defineConfig({
webServer: process.env.PLAYWRIGHT_NO_WEB_SERVER
? undefined
: {
// Pin to webpack dev (Turbopack has caused stale-lock panics in E2E).
command: "pnpm exec next dev",
// Local stays on webpack dev (Turbopack caused stale-lock panics in E2E).
command: process.env.CI
? "pnpm build && pnpm start"
: "pnpm exec next dev",
url: `http://localhost:${PORT}`,
reuseExistingServer: !process.env.CI,
timeout: 180_000,
timeout: process.env.CI ? 300_000 : 180_000,
env: {
NEXT_PUBLIC_FASTAPI_BACKEND_URL: `http://localhost:${BACKEND_PORT}`,
NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE: "LOCAL",