diff --git a/cypress/e2e/facility_spec/facility_creation.cy.ts b/cypress/e2e/facility_spec/facility_creation.cy.ts index 15288719ba8..670af8993d6 100644 --- a/cypress/e2e/facility_spec/facility_creation.cy.ts +++ b/cypress/e2e/facility_spec/facility_creation.cy.ts @@ -45,6 +45,9 @@ describe("Facility Management", () => { facilityPage.submitFacilityCreationForm(); facilityPage.verifySuccessMessage(); + // Wait for facility cards to load + facilityPage.waitForFacilityCardsToLoad(); + // Search for the facility and verify in card facilityPage.searchFacility(testFacility.name); facilityPage.verifyFacilityNameInCard(testFacility.name); diff --git a/cypress/pageObject/facility/FacilityCreation.ts b/cypress/pageObject/facility/FacilityCreation.ts index 2762f29fab8..2f86a0eaeca 100644 --- a/cypress/pageObject/facility/FacilityCreation.ts +++ b/cypress/pageObject/facility/FacilityCreation.ts @@ -101,4 +101,11 @@ export class FacilityCreation { verifyFacilityNameInCard(facilityName: string) { cy.get('[data-cy="facility-cards"]').should("contain", facilityName); } + + waitForFacilityCardsToLoad(timeout = 10000) { + cy.get('[data-cy="facility-cards"]', { timeout }) + .should("be.visible") + .should("not.be.empty"); + return this; + } } diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 5af8df3a8ec..a73e27b9664 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -235,20 +235,32 @@ Cypress.Commands.add( ( selector: string, value: string, - options: { clearBeforeTyping?: boolean; skipVerification?: boolean } = {}, + options: { + clearBeforeTyping?: boolean; + skipVerification?: boolean; + delay?: number; + } = {}, ) => { - const { clearBeforeTyping = false, skipVerification = false } = options; + const { + clearBeforeTyping = false, + skipVerification = false, + delay = 50, + } = options; const inputField = cy.get(selector); if (clearBeforeTyping) { - inputField.clear(); // Clear the input field if specified + inputField.clear(); } - inputField.scrollIntoView().should("be.visible").click().type(value); - - // Conditionally skip verification based on the skipVerification flag - if (!skipVerification) { - inputField.should("have.value", value); // Verify the value if skipVerification is false - } + inputField + .scrollIntoView() + .should("be.visible") + .click() + .type(value, { delay }) + .then(() => { + if (!skipVerification) { + cy.get(selector).should("have.value", value); + } + }); }, ); diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 22839037dae..3da319f36cd 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -48,7 +48,11 @@ declare global { typeIntoField( selector: string, value: string, - options?: { clearBeforeTyping?: boolean; skipVerification?: boolean }, + options?: { + clearBeforeTyping?: boolean; + skipVerification?: boolean; + delay?: number; + }, ): Chainable; } } diff --git a/package-lock.json b/package-lock.json index 69b50fa1713..fb81d7671e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,6 @@ "@radix-ui/react-tabs": "^1.1.1", "@radix-ui/react-toast": "^1.2.4", "@radix-ui/react-tooltip": "^1.1.6", - "@rollup/rollup-linux-x64-gnu": "4.30.1", "@sentry/browser": "^8.48.0", "@tanstack/react-query": "^5.62.8", "@tanstack/react-query-devtools": "^5.63.0", @@ -147,8 +146,8 @@ "node": ">=22.8.0" }, "optionalDependencies": { - "@esbuild/linux-arm64": "*", - "@esbuild/linux-x64": "*", + "@esbuild/linux-arm64": "latest", + "@esbuild/linux-x64": "latest", "@rollup/rollup-linux-arm64-gnu": "4.30.1", "@rollup/rollup-linux-x64-gnu": "4.30.1" }