Skip to content

Increase e2e provider response timeouts AB#17107 - #6802

Draft
BrianMaki wants to merge 1 commit into
devfrom
tasks/17107
Draft

Increase e2e provider response timeouts AB#17107#6802
BrianMaki wants to merge 1 commit into
devfrom
tasks/17107

Conversation

@BrianMaki

@BrianMaki BrianMaki commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Fixes or Implements AB#17107

Description

Increase Cypress E2E synchronization timeouts for delayed PHSA provider responses.

Changes

  • Wait for Laboratory Orders before validating timeline empty-state filters.
  • Increase Hospital Visit service request timeouts to 120 seconds.
  • Register dependent immunization intercepts before the requests occur.
  • Wait for dependent immunizations before downloading vaccine recommendations.
  • Avoid waiting for the primary patient request on dependents and dependent timeline routes.

Testing

  • Unit Tests Updated
  • Functional Tests Updated
  • Not Required

UI Changes

None

Notes

Items to Review:

@BrianMaki
BrianMaki requested a lite review from Copilot August 21, 2026 20:20
@BrianMaki BrianMaki changed the title Increase e2e provider reponse timeouts AB#17107 Increase e2e provider response timeouts AB#17107 Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Cypress functional-test reliability for slow provider responses and dependent-page request timing.

Changes:

  • Adjusts dependent-page request waits and interception timing.
  • Adds laboratory-result response waits.
  • Extends encounter provider timeouts to 120 seconds.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Summary
Testing/functional/tests/cypress/support/functions/intercept.js Adjusts dependent-page data-load waits.
Testing/functional/tests/cypress/integration/e2e/user/dependents.js Registers immunization interception earlier.
Testing/functional/tests/cypress/integration/e2e/timeline/filter.js Adds lab-result waits; assertions may resolve an in-progress response at lines 47 and 184.
Testing/functional/tests/cypress/integration/e2e/services/encounter.js Applies extended provider response timeouts.
Suppressed comments (1)

Testing/functional/tests/cypress/integration/e2e/timeline/filter.js:184

  • This wait is reached only after cy.checkTimelineHasLoaded() in the beforeEach. That command runs immediately after login, and its loading-toast assertion uses the suite's 30-second defaultCommandTimeout; TimelineComponent keeps that toast active while the lab dataset is loading. A provider response taking more than 30 seconds can therefore fail the hook before this 120-second alias wait is reached. Move waitForLabResults() into the beforeEach before checkTimelineHasLoaded(), or give the loading assertion the longer timeout.
        waitForLabResults();

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Testing/functional/tests/cypress/integration/e2e/timeline/filter.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Testing/functional/tests/cypress/integration/e2e/services/encounter.js:149

  • This 120-second value only applies to the two direct cy.request calls in this spec. The shared timeline login path still waits for @getHospitalVisit with defaultTimeout (60 seconds) in support/functions/intercept.js:272-274; the filter setup enables Hospital Visits, so a provider response taking 60–120 seconds will still make those E2E tests fail. Please raise or reuse the 120-second timeout for that alias wait as well.
                    timeout: providerResponseTimeout,

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Testing/functional/tests/cypress/integration/e2e/user/dependents.js:673

  • This matcher aliases every dependent's immunization request. The dependents page mounts a RecommendationsDialog/ImmunizationReport for each non-expired card, so a delayed retry for an existing dependent can satisfy this wait before the newly registered validDependent has loaded. Scope the route to the dependent under test so this synchronization cannot consume another request.
        cy.intercept("GET", "**/Immunization?hdid*").as("getImmunization");

Comment thread Testing/functional/tests/cypress/integration/e2e/dependent/dashboard.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (5)

Testing/functional/tests/cypress/integration/e2e/dependent/dashboard.js:23

  • Because this intercept is installed before cy.login, it captures the eager requests made by the hidden RecommendationsDialog mounted in every non-expired dependent card, not just the card clicked below. Consequently, cy.wait("@getImmunization") can consume another dependent's earlier request and proceed without synchronizing the selected dependent before the download. Match the request to validDependent.hdid (or otherwise wait on that dependent's interception).
        cy.intercept(

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:35

  • This wait is reached only after cy.checkTimelineHasLoaded() in beforeEach. The loading check retries the timeline loading-toast for Cypress's 30-second default command timeout, while a pending Covid19Orders request keeps the dataset loading; a provider response that needs the new 120-second window can fail before this wait is reached. Move the provider wait before cy.checkTimelineHasLoaded() (and synchronize the final loaded response).
        waitForCovid19TestResults();

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:45

  • The 60-second download timeout is applied only to the full-report button path. The attachment test immediately below still calls validateAttachmentDownload(), which invokes the same Covid19 getReportDocument(..., true) flow and retains the helper's 20-second default. If this report/download is slow enough to require the new timeout, the attachment case will still fail; apply the extended timeout to both paths or share the timeout.
                    60000

Testing/functional/tests/cypress/integration/e2e/timeline/filter.js:184

  • This wait is reached only after cy.checkTimelineHasLoaded() in beforeEach. That helper waits for the timeline loading-toast with Cypress's 30-second default command timeout, while a pending LaboratoryOrders request keeps the timeline loading; a response needing the new 120-second window can therefore fail the setup before waitForLabResults() runs. Move the provider wait into beforeEach before cy.checkTimelineHasLoaded() (or give the loading check the extended timeout).
        waitForLabResults();

Testing/functional/tests/cypress/support/functions/timeline.js:22

  • The new timeout is configurable only for validateFileDownload; validateAttachmentDownload still calls validateSensitiveDocumentDownload with the 20-second default. Both COVID full-report and attachment actions invoke the same getReportDocument(..., true) laboratory endpoint, so a delayed PHSA report can still make the attachment test fail at 20 seconds. Extend the attachment helper and pass the longer timeout from covid19Test.js as well.
export function validateFileDownload(
    buttonSelector,
    clickEntryCard = true,
    downloadTimeout = 20000
) {

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (7)

Testing/functional/tests/cypress/integration/e2e/dependent/dashboard.js:86

  • retrieveImmunizations schedules another GET after a response with loadState.refreshInProgress (Apps/WebClient/src/ClientApp/src/stores/immunization.ts:165-171). This cy.wait resolves the first matching response, so a delayed provider response can leave the recommendations table empty while the test proceeds to download the report. Wait for the matching dependent request to finish loading, not merely for its first network response.
        cy.wait("@getImmunization", { timeout: defaultTimeout });

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:35

  • This 120-second COVID-19 wait is reached only after the beforeEach has already run cy.checkTimelineHasLoaded(). With the COVID dataset enabled, a delayed provider response keeps the timeline loading toast visible, and that assertion uses Cypress's 30-second default command timeout, so the test can fail before this longer wait is reached. Move the provider synchronization before checkTimelineHasLoaded (or give that check the same timeout).
        waitForCovid19TestResults();

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:11

  • This helper only checks for HTTP 200, but the COVID-19 store treats a 200 response with payload.loaded === false and a refresh action as an in-progress result, then schedules another request (Apps/WebClient/src/ClientApp/src/stores/covid19TestResult.ts:132-143). cy.wait can therefore return on the first response and the test can look for the 2020-Dec-03 entry before it has been populated. Make the wait consume/retry interceptions until resourcePayload.loaded is true.
    function waitForCovid19TestResults() {
        cy.wait("@getCovid19TestResults", { timeout: 120000 })
            .its("response.statusCode")
            .should("eq", 200);

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:45

  • Both COVID download controls call the same getReportDocument(..., true) request, but the 60-second timeout is passed only to validateFileDownload; validateAttachmentDownload() still uses validateSensitiveDocumentDownload's 20-second default. A delayed PHSA report can therefore still make the attachment-download test fail. Thread the timeout through the attachment helper and pass it here as well.
                validateFileDownload(
                    "[data-testid=covid-result-download-btn]",
                    true,
                    60000

Testing/functional/tests/cypress/integration/e2e/timeline/filter.js:184

  • This 120-second lab wait is reached only after the beforeEach has already run cy.checkTimelineHasLoaded(). With labResult enabled, a delayed laboratory request keeps loading-toast visible, and that assertion uses Cypress's 30-second default command timeout, so the test can fail before this 120-second wait gets a chance to handle the delayed response. Move the lab synchronization before checkTimelineHasLoaded (or give that check the same timeout).
        waitForLabResults();

Testing/functional/tests/cypress/integration/e2e/timeline/filter.js:226

  • This 120-second lab wait is reached only after the beforeEach has already run cy.checkTimelineHasLoaded(). With labResult enabled, a delayed laboratory request keeps loading-toast visible, and that assertion uses Cypress's 30-second default command timeout, so the test can fail before this 120-second wait gets a chance to handle the delayed response. Move the lab synchronization before checkTimelineHasLoaded (or give that check the same timeout).
        waitForLabResults();

Testing/functional/tests/cypress/integration/e2e/user/dependents.js:673

  • Because this alias is registered before the dependent is added, it can also capture pending or retry requests from the other dependent dashboards; the pattern is not restricted to the dependent being added. The later cy.wait("@getImmunization") can therefore consume an unrelated response and continue before validDependent is loaded. Scope the route to validDependent.hdid, as the dependent dashboard test does.
        cy.intercept("GET", "**/Immunization?hdid*").as("getImmunization");

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Suppressed comments (4)

Testing/functional/tests/cypress/integration/e2e/dependent/dashboard.js:85

  • A 200 response can still have resourcePayload.loadState.refreshInProgress === true; the immunization store marks that dataset deferred and schedules another request after 10 seconds. cy.wait resolves the first interception, so the following enabled assertion can run while hasRecords is still false and fail or proceed without recommendations. Keep waiting on this alias until a response reports refreshInProgress === false rather than only increasing the timeout.
        cy.wait("@getImmunization", { timeout: defaultTimeout });

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:35

  • This runs only after the beforeEach has already called cy.checkTimelineHasLoaded(), so it cannot extend the timeout for the initial COVID-19 Orders request. That helper waits for loading-toast with Cypress's 30-second default command timeout; a provider response taking 30–120 seconds therefore fails setup before this 120-second wait executes. Pass an extended timeout through the timeline-loaded check (or otherwise synchronize the final load before that check).
        waitForCovid19TestResults();

Testing/functional/tests/cypress/integration/e2e/timeline/filter.js:184

  • This call is also after the beforeEach has already run cy.checkTimelineHasLoaded(), so the new 120-second wait cannot protect the test from a slow Laboratory Orders response. That helper waits for loading-toast with Cypress's 30-second default command timeout, meaning this test fails in setup before reaching this line when the provider takes longer than 30 seconds. Pass an extended timeout through the timeline-loaded check or move final-response synchronization into setup.
        waitForLabResults();

Testing/functional/tests/cypress/integration/e2e/timeline/labResult.js:35

  • This runs only after the beforeEach has already called cy.checkTimelineHasLoaded(), so it cannot extend the timeout for the initial Laboratory Orders request. That helper waits for loading-toast with Cypress's 30-second default command timeout; a provider response taking 30–120 seconds therefore fails setup before this 120-second wait executes. Pass an extended timeout through the timeline-loaded check (or otherwise synchronize the final load before that check).
        waitForLabResults();

Comment thread Testing/functional/tests/cypress/integration/e2e/user/dependents.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Suppressed comments (2)

Testing/functional/tests/cypress/integration/e2e/user/dependents.js:675

  • Although this scopes the alias to the new dependent, it still records every response for that dependent, including an initial loadState.refreshInProgress response. The existing wait later in this test can therefore finish before the store's scheduled retry populates the history, leaving the row/download assertions to run against deferred data. Make the synchronization wait for a final non-deferred response (or for the data-ready control with defaultTimeout) rather than treating the first interception as completion.
        cy.intercept("GET", `**/Immunization?hdid=${validDependent.hdid}*`).as(
            "getImmunization"
        );

Testing/functional/tests/cypress/support/functions/timeline.js:37

  • validateAttachmentDownload() still calls validateSensitiveDocumentDownload(dateString) with the default 20-second verification timeout, while the COVID attachment and full-report buttons both submit the same getReportDocument(..., true) request. The new 60-second timeout is only passed through validateFileDownload, so a slow COVID report can still make the attachment test fail after 20 seconds. Thread the timeout through validateAttachmentDownload and use 60000 for both COVID download tests.
    exactMatch = false,
    downloadTimeout = 20000

Comment thread Testing/functional/tests/cypress/integration/e2e/dependent/dashboard.js Outdated
Comment thread Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js Outdated
Comment thread Testing/functional/tests/cypress/integration/e2e/timeline/filter.js Outdated
Comment thread Testing/functional/tests/cypress/integration/e2e/timeline/labResult.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Suppressed comments (4)

Testing/functional/tests/cypress/integration/e2e/dependent/dashboard.js:85

  • The alias wait resolves the first matching immunization request, but the store treats a refreshInProgress response as deferred and schedules another request 10 seconds later. The following table/button assertions still use the 30-second default, so this can proceed while the report is loading and then fail before the retry completes. Wait for the final loaded response or give the report-readiness assertions the same 120-second timeout.
        cy.wait("@getImmunization", { timeout: defaultTimeout });

Testing/functional/tests/cypress/integration/e2e/timeline/covid19Test.js:37

  • This 120-second wait is also executed only after beforeEach has called cy.checkTimelineHasLoaded(). That helper waits for the loading toast with the 30-second default, so a delayed COVID test result response can fail the hook before this new timeout is applied. Move waitForCovid19TestResults() into beforeEach before checkTimelineHasLoaded() and remove the per-test waits; this affects both tests in the file.
        waitForCovid19TestResults();

Testing/functional/tests/cypress/integration/e2e/timeline/filter.js:184

  • The new 120-second wait is queued after cy.checkTimelineHasLoaded() in the beforeEach. Since that helper uses the 30-second default while the delayed laboratory response keeps isFullyLoaded false, the hook can time out before this wait is reached. Move the lab wait before checkTimelineHasLoaded() (and remove the waits from the three test bodies at lines 184, 226, and 322).
        waitForLabResults();

Testing/functional/tests/cypress/integration/e2e/timeline/labResult.js:37

  • This 120-second wait is reached only after beforeEach has already run cy.checkTimelineHasLoaded(). That helper waits for loading-toast with Cypress's 30-second default, while a pending laboratory request keeps the timeline loading, so a response taking more than 30 seconds still fails before this synchronization runs. Move waitForLabResults() into beforeEach before cy.checkTimelineHasLoaded() and remove the per-test waits; the same ordering affects the attachment test.
        waitForLabResults();

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Testing/functional/tests/cypress/integration/e2e/user/dependents.js:708

  • Removing the immunization intercept and wait leaves the request started by this tab click unsynchronized. The subsequent History/table assertions can run while the newly added dependent's immunizations are still loading (or before the request completes), which is the delayed-provider race this test is intended to cover. Register a dependent-scoped intercept before the click and wait for it before opening the History tab.
        cy.get("@newDependentCard").within(() => {
            cy.get(
                `[data-testid=immunization-tab-title-${validDependent.hdid}]`
            ).click();
        });

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants