Increase e2e provider response timeouts AB#17107 - #6802
Conversation
There was a problem hiding this comment.
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 thebeforeEach. That command runs immediately after login, and itsloading-toastassertion uses the suite's 30-seconddefaultCommandTimeout;TimelineComponentkeeps 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. MovewaitForLabResults()into thebeforeEachbeforecheckTimelineHasLoaded(), 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.
There was a problem hiding this comment.
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.requestcalls in this spec. The shared timeline login path still waits for@getHospitalVisitwithdefaultTimeout(60 seconds) insupport/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,
There was a problem hiding this comment.
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
validDependenthas loaded. Scope the route to the dependent under test so this synchronization cannot consume another request.
cy.intercept("GET", "**/Immunization?hdid*").as("getImmunization");
There was a problem hiding this comment.
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 hiddenRecommendationsDialogmounted 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 tovalidDependent.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()inbeforeEach. The loading check retries the timelineloading-toastfor 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 beforecy.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 Covid19getReportDocument(..., 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()inbeforeEach. That helper waits for the timelineloading-toastwith 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 beforewaitForLabResults()runs. Move the provider wait intobeforeEachbeforecy.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;validateAttachmentDownloadstill callsvalidateSensitiveDocumentDownloadwith the 20-second default. Both COVID full-report and attachment actions invoke the samegetReportDocument(..., 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 fromcovid19Test.jsas well.
export function validateFileDownload(
buttonSelector,
clickEntryCard = true,
downloadTimeout = 20000
) {
There was a problem hiding this comment.
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
retrieveImmunizationsschedules another GET after a response withloadState.refreshInProgress(Apps/WebClient/src/ClientApp/src/stores/immunization.ts:165-171). Thiscy.waitresolves 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
beforeEachhas already runcy.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 beforecheckTimelineHasLoaded(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 === falseand a refresh action as an in-progress result, then schedules another request (Apps/WebClient/src/ClientApp/src/stores/covid19TestResult.ts:132-143).cy.waitcan 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 untilresourcePayload.loadedis 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 tovalidateFileDownload;validateAttachmentDownload()still usesvalidateSensitiveDocumentDownload'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
beforeEachhas already runcy.checkTimelineHasLoaded(). WithlabResultenabled, a delayed laboratory request keepsloading-toastvisible, 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 beforecheckTimelineHasLoaded(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
beforeEachhas already runcy.checkTimelineHasLoaded(). WithlabResultenabled, a delayed laboratory request keepsloading-toastvisible, 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 beforecheckTimelineHasLoaded(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 beforevalidDependentis loaded. Scope the route tovalidDependent.hdid, as the dependent dashboard test does.
cy.intercept("GET", "**/Immunization?hdid*").as("getImmunization");
There was a problem hiding this comment.
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.waitresolves the first interception, so the following enabled assertion can run whilehasRecordsis still false and fail or proceed without recommendations. Keep waiting on this alias until a response reportsrefreshInProgress === falserather 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
beforeEachhas already calledcy.checkTimelineHasLoaded(), so it cannot extend the timeout for the initial COVID-19 Orders request. That helper waits forloading-toastwith 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
beforeEachhas already runcy.checkTimelineHasLoaded(), so the new 120-second wait cannot protect the test from a slow Laboratory Orders response. That helper waits forloading-toastwith 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
beforeEachhas already calledcy.checkTimelineHasLoaded(), so it cannot extend the timeout for the initial Laboratory Orders request. That helper waits forloading-toastwith 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();
There was a problem hiding this comment.
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.refreshInProgressresponse. 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 withdefaultTimeout) 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 callsvalidateSensitiveDocumentDownload(dateString)with the default 20-second verification timeout, while the COVID attachment and full-report buttons both submit the samegetReportDocument(..., true)request. The new 60-second timeout is only passed throughvalidateFileDownload, so a slow COVID report can still make the attachment test fail after 20 seconds. Thread the timeout throughvalidateAttachmentDownloadand use 60000 for both COVID download tests.
exactMatch = false,
downloadTimeout = 20000
There was a problem hiding this comment.
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
refreshInProgressresponse 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
beforeEachhas calledcy.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. MovewaitForCovid19TestResults()intobeforeEachbeforecheckTimelineHasLoaded()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 keepsisFullyLoadedfalse, the hook can time out before this wait is reached. Move the lab wait beforecheckTimelineHasLoaded()(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
beforeEachhas already runcy.checkTimelineHasLoaded(). That helper waits forloading-toastwith 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. MovewaitForLabResults()intobeforeEachbeforecy.checkTimelineHasLoaded()and remove the per-test waits; the same ordering affects the attachment test.
waitForLabResults();
There was a problem hiding this comment.
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();
});
Fixes or Implements AB#17107
Description
Increase Cypress E2E synchronization timeouts for delayed PHSA provider responses.
Changes
Testing
UI Changes
None
Notes
Items to Review: