diff --git a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts index 27d68aa257f..706be899dd8 100644 --- a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts +++ b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts @@ -22,16 +22,25 @@ describe("Patient Investigation Creation from Patient consultation page", () => it("Create a investigation for a patient and verify its reflection", () => { patientPage.visitPatient(patientName); + cy.url().should("include", "/patient"); + patientInvestigation.clickInvestigationTab(); + cy.get("#consultation_tab_nav").should("exist"); + patientInvestigation.clickLogLabResults(); + cy.get("#log-lab-results").should("exist"); + patientInvestigation.selectInvestigationOption([ "Haematology", "Urine Test", ]); - cy.clickSubmitButton("Save Investigation"); + + cy.get("button") + .contains("Save Investigation") + .should("be.visible") + .click(); cy.verifyNotification("Please Enter at least one value"); cy.closeNotification(); - // Temporary workflow for investigation since we dont have dummy data and moving away from existing module }); afterEach(() => { diff --git a/cypress/pageobject/Patient/PatientInvestigation.ts b/cypress/pageobject/Patient/PatientInvestigation.ts index bd422234891..a85862632a5 100644 --- a/cypress/pageobject/Patient/PatientInvestigation.ts +++ b/cypress/pageobject/Patient/PatientInvestigation.ts @@ -18,10 +18,16 @@ class PatientInvestigation { } selectInvestigationOption(options: string[]) { - cy.get("#investigation-select").click(); + // Click to open dropdown + cy.get("#investigation-select").should("exist").click(); + + // Select each option options.forEach((option) => { - cy.get("[role='option']").contains(option).click(); + cy.get("[role='option']").contains(option).should("be.visible").click(); }); + + // Click outside to close dropdown (if needed) + cy.get("body").click(0, 0); } clickLogLabResults() {