diff --git a/.github/workflows/pr_ci_playwright_e2e.yaml b/.github/workflows/pr_ci_playwright_e2e.yaml index 60c2a1eef..c1ae5cebc 100644 --- a/.github/workflows/pr_ci_playwright_e2e.yaml +++ b/.github/workflows/pr_ci_playwright_e2e.yaml @@ -52,10 +52,30 @@ jobs: run: | sudo yarn playwright install --with-deps - - name: Wait for web server to be ready + - name: Wait for web server to be ready with retry working-directory: ./frontend run: | - yarn wait-on http://localhost:3000 + MAX_ATTEMPTS=3 + WAIT_TIME=90 + ATTEMPT=1 + while [[ $ATTEMPT -le $MAX_ATTEMPTS ]] + do + echo "Attempt $ATTEMPT of $MAX_ATTEMPTS" + if yarn wait-on http://localhost:3000 --timeout ${WAIT_TIME}000; then + echo "Server is ready!" + break + else + echo "Server not ready, restarting Docker Compose..." + docker compose --env-file .env.dev down + docker compose --env-file .env.dev up --build -d + ATTEMPT=$((ATTEMPT + 1)) + if [[ $ATTEMPT -gt $MAX_ATTEMPTS ]]; then + echo "Server failed to start after $MAX_ATTEMPTS attempts." + exit 1 + fi + sleep 10 + fi + done - name: Run Playwright tests working-directory: ./frontend