From dcf933000aa8fc6547ff912905075d422da62fbb Mon Sep 17 00:00:00 2001 From: Zachary Licastro Date: Sat, 5 Oct 2024 16:00:38 -0400 Subject: [PATCH] Improve startup time for Playwright tests, fix report path. Signed-off-by: Zachary Licastro --- .github/workflows/playwright.yml | 2 +- run-playwright.sh | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ab64441..72a1d37 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -104,5 +104,5 @@ jobs: if: always() with: name: playwright-report - path: playwright-report/ + path: modules/odr_frontend/playwright-report/ retention-days: 7 diff --git a/run-playwright.sh b/run-playwright.sh index 6a12831..d0ed6d6 100755 --- a/run-playwright.sh +++ b/run-playwright.sh @@ -3,7 +3,28 @@ set -e task dev & echo "Waiting for services to start..." -sleep 300 + +# Maximum wait time in seconds +max_wait=300 +check_interval=5 +start_time=$(date +%s) + +while true; do + if docker compose logs | grep -q "INFO: Application startup complete."; then + echo "Services started successfully." + break + fi + + current_time=$(date +%s) + elapsed=$((current_time - start_time)) + + if [ $elapsed -ge $max_wait ]; then + echo "Timeout: Services did not start within $max_wait seconds." + exit 1 + fi + + sleep $check_interval +done cd modules/odr_frontend npx playwright test