Skip to content

Commit

Permalink
poll method
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Sep 23, 2024
1 parent 9ba8cba commit e83c13c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cypress/pageobject/Facility/FacilityHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class FacilityHome {
}

pollForCsvDownload(queryParam: string, retries = 10, delay = 5000) {
cy.log(`Polling for API status, retries left: ${retries}`);
// Make a GET request to the API
cy.request({
method: "GET",
url: `/api/v1/facility/?csv${queryParam}`,
failOnStatusCode: false, // Allow Cypress to proceed even if the status is not 200
}).then((response) => {
if (response.status === 200) {
if (response && response.status === 200) {
// Success, CSV is ready
cy.log("API returned 200! File is ready for download.");
} else if (retries > 0) {
cy.wait(delay); // Wait for a delay before retrying
Expand Down

0 comments on commit e83c13c

Please sign in to comment.