fix(ci): fix E2E tests - remove invalid NODE_OPTIONS flag and add PostgreSQL

- Remove --no-experimental-strip-types from test:e2e as it's not allowed in NODE_OPTIONS
- Add PostgreSQL service container for E2E tests
- Add Payload migrations step before E2E tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Martin Porwoll 2025-12-15 12:57:12 +00:00
parent 1eabd4b71a
commit bb678ea60c
2 changed files with 26 additions and 2 deletions

View file

@ -217,6 +217,20 @@ jobs:
name: E2E Tests name: E2E Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build] needs: [build]
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: payload
POSTGRES_PASSWORD: payload_test_password
POSTGRES_DB: payload_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -244,12 +258,22 @@ jobs:
- name: Install Playwright browsers - name: Install Playwright browsers
run: pnpm exec playwright install chromium --with-deps run: pnpm exec playwright install chromium --with-deps
- name: Run Payload Migrations
run: pnpm payload migrate
env:
PAYLOAD_SECRET: e2e-secret-placeholder
DATABASE_URI: postgresql://payload:payload_test_password@localhost:5432/payload_test
NEXT_PUBLIC_SERVER_URL: http://localhost:3001
PAYLOAD_PUBLIC_SERVER_URL: http://localhost:3001
CONSENT_LOGGING_API_KEY: ci-consent-api-key-placeholder
IP_ANONYMIZATION_PEPPER: ci-anonymization-pepper-placeholder
- name: Run E2E tests - name: Run E2E tests
run: pnpm test:e2e run: pnpm test:e2e
env: env:
CI: true CI: true
PAYLOAD_SECRET: e2e-secret-placeholder PAYLOAD_SECRET: e2e-secret-placeholder
DATABASE_URI: postgresql://placeholder:placeholder@localhost:5432/placeholder DATABASE_URI: postgresql://payload:payload_test_password@localhost:5432/payload_test
NEXT_PUBLIC_SERVER_URL: http://localhost:3001 NEXT_PUBLIC_SERVER_URL: http://localhost:3001
PAYLOAD_PUBLIC_SERVER_URL: http://localhost:3001 PAYLOAD_PUBLIC_SERVER_URL: http://localhost:3001
EMAIL_DELIVERY_DISABLED: 'true' EMAIL_DELIVERY_DISABLED: 'true'

View file

@ -23,7 +23,7 @@
"test:security": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts tests/unit/security tests/int/security-api.int.spec.ts", "test:security": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts tests/unit/security tests/int/security-api.int.spec.ts",
"test:access-control": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts tests/unit/access-control", "test:access-control": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts tests/unit/access-control",
"test:coverage": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts --coverage", "test:coverage": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts --coverage",
"test:e2e": "test -f .next/BUILD_ID || (echo 'Error: No build found. Run pnpm build first.' && exit 1) && cross-env NODE_OPTIONS=\"--no-deprecation --no-experimental-strip-types\" pnpm exec playwright test", "test:e2e": "test -f .next/BUILD_ID || (echo 'Error: No build found. Run pnpm build first.' && exit 1) && cross-env NODE_OPTIONS=--no-deprecation pnpm exec playwright test",
"prepare": "test -d .git && (ln -sf ../../scripts/detect-secrets.sh .git/hooks/pre-commit 2>/dev/null || true) || true" "prepare": "test -d .git && (ln -sf ../../scripts/detect-secrets.sh .git/hooks/pre-commit 2>/dev/null || true) || true"
}, },
"dependencies": { "dependencies": {