From 42f8b020b9292cd1bf2dd8563091a1163464cf22 Mon Sep 17 00:00:00 2001 From: Dhanushree-Microsoft Date: Fri, 22 May 2026 14:42:19 +0530 Subject: [PATCH] fix: increase e2e test timeouts and improve app readiness check - Increase home_page_load timeout to 180s (explicit instead of relying on default) - Increase show_chat_history timeout from 9s to 60s to handle slow backend responses - Improve workflow health check with HTTP status code validation and 15 attempts - Add 30s post-ready wait for full app initialization - Increase retry delays between test runs (60s and 90s instead of 30s and 60s) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/job-test-automation.yml | 22 +++++++++++++--------- tests/e2e-test/pages/HomePage.py | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/job-test-automation.yml b/.github/workflows/job-test-automation.yml index 9db1db98d..318182989 100644 --- a/.github/workflows/job-test-automation.yml +++ b/.github/workflows/job-test-automation.yml @@ -78,25 +78,29 @@ jobs: - name: Wait for Application to be Ready run: | echo "Waiting for application to be ready at ${{ env.url }} " - max_attempts=10 + max_attempts=15 attempt=1 while [ $attempt -le $max_attempts ]; do echo "Attempt $attempt: Checking if application is ready..." - if curl -f -s "${{ env.url }}" > /dev/null; then - echo "Application is ready!" + HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${{ env.url }}" || echo "000") + if [ "$HTTP_STATUS" -ge 200 ] && [ "$HTTP_STATUS" -lt 400 ]; then + echo "Application is ready! (HTTP $HTTP_STATUS)" break fi if [ $attempt -eq $max_attempts ]; then - echo "Application is not ready after $max_attempts attempts" + echo "Application is not ready after $max_attempts attempts (last HTTP status: $HTTP_STATUS)" exit 1 fi - echo "Application not ready, waiting 30 seconds..." + echo "Application not ready (HTTP $HTTP_STATUS), waiting 30 seconds..." sleep 30 attempt=$((attempt + 1)) done + + echo "Waiting additional 30 seconds for application to fully initialize..." + sleep 30 - name: Validate Use Case and Test Suite run: | @@ -142,9 +146,9 @@ jobs: working-directory: tests/e2e-test continue-on-error: true - - name: Sleep for 30 seconds + - name: Sleep for 60 seconds if: ${{ steps.test1.outcome == 'failure' }} - run: sleep 30s + run: sleep 60s shell: bash - name: Run tests(2) @@ -167,9 +171,9 @@ jobs: working-directory: tests/e2e-test continue-on-error: true - - name: Sleep for 60 seconds + - name: Sleep for 90 seconds if: ${{ steps.test2.outcome == 'failure' }} - run: sleep 60s + run: sleep 90s shell: bash - name: Run tests(3) diff --git a/tests/e2e-test/pages/HomePage.py b/tests/e2e-test/pages/HomePage.py index 0722d9e71..de6c046b8 100644 --- a/tests/e2e-test/pages/HomePage.py +++ b/tests/e2e-test/pages/HomePage.py @@ -27,7 +27,7 @@ def __init__(self, page): self.page = page def home_page_load(self): - self.page.locator("//span[normalize-space()='Satisfied']").wait_for(state="visible") + self.page.locator("//span[normalize-space()='Satisfied']").wait_for(state="visible", timeout=180000) def validate_response_text(self, question): logger.info(f"🔍 DEBUG: validate_response_text called for question: '{question}'") @@ -89,7 +89,7 @@ def show_chat_history(self): self.page.wait_for_load_state('networkidle') self.page.wait_for_timeout(2000) try: - expect(self.page.locator(self.CHAT_HISTORY_NAME)).to_be_visible(timeout=9000) + expect(self.page.locator(self.CHAT_HISTORY_NAME)).to_be_visible(timeout=60000) except AssertionError: raise AssertionError("Chat history name was not visible on the page within the expected time.")