diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e268fd5..727413e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -620,7 +620,30 @@ jobs: - name: Run smoke tests # Use the pinned APP_BASE_URL (explicit IP) so Chromium hits the same # container as the warm-up probes. - run: PLAYWRIGHT_BASE_URL="$APP_BASE_URL" /tmp/pw-install/node_modules/.bin/playwright test --config apps/web/playwright.ci.config.ts + # + # Next.js dev mode on QNAP briefly drops the listening socket on + # route-transition compiles — test #2 (`/`) has hit ERR_CONNECTION_ + # REFUSED between a warm-up and the test even though the same URL + # returned 307 moments earlier. Playwright's in-process retry runs + # while the socket is still down. Wrap the whole playwright + # invocation in a shell retry: if the first run fails, re-warm / + # aggressively and run the full suite once more. + run: | + run_smoke() { + PLAYWRIGHT_BASE_URL="$APP_BASE_URL" \ + /tmp/pw-install/node_modules/.bin/playwright test \ + --config apps/web/playwright.ci.config.ts + } + if run_smoke; then exit 0; fi + echo "First smoke run failed — aggressive re-warm + retry" + for i in $(seq 1 10); do + CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 30 "${APP_BASE_URL}/" || echo "000") + echo "Post-fail warm / $i: HTTP $CODE" + [ "$CODE" = "307" ] && break + sleep 3 + done + sleep 5 + run_smoke - name: Upload Playwright report if: failure()