From bb972f229630b9285bf6b06144917ffb3c34fcef Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 28 Oct 2024 20:37:54 +0530 Subject: [PATCH 01/83] Cypress Tests cy.wait() replace with cy.intercept() or dynamic wait --- .env | 1 + cypress/e2e/assets_spec/AssetHomepage.cy.ts | 1 - cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- cypress/e2e/facility_spec/FacilityInventory.cy.ts | 6 +++--- cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts | 1 - .../{PatientFileUpload.ts => PatientFileUpload.cy.ts} | 0 cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 2 -- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 6 ------ cypress/e2e/users_spec/UsersCreation.cy.ts | 1 - cypress/e2e/users_spec/UsersManage.cy.ts | 3 --- cypress/pageobject/Facility/FacilityCreation.ts | 1 - cypress/pageobject/Patient/PatientCreation.ts | 2 +- cypress/pageobject/Patient/PatientDoctorNotes.ts | 1 - cypress/pageobject/Patient/PatientFileupload.ts | 7 ++----- cypress/pageobject/Patient/PatientTransfer.ts | 2 -- cypress/pageobject/Users/ManageUserPage.ts | 2 +- 16 files changed, 9 insertions(+), 29 deletions(-) rename cypress/e2e/patient_spec/{PatientFileUpload.ts => PatientFileUpload.cy.ts} (100%) diff --git a/.env b/.env index ebc0ebd5be3..b205a716158 100644 --- a/.env +++ b/.env @@ -8,6 +8,7 @@ REACT_PUBLIC_URL=https://care.ohc.network # Care API URL without the /api prefix REACT_CARE_API_URL=https://careapi.ohc.network +# REACT_CARE_API_URL=http://localhost:9000 # Dev envs ESLINT_NO_DEV_ERRORS=true diff --git a/cypress/e2e/assets_spec/AssetHomepage.cy.ts b/cypress/e2e/assets_spec/AssetHomepage.cy.ts index bf608cdab9f..1dce4844cc1 100644 --- a/cypress/e2e/assets_spec/AssetHomepage.cy.ts +++ b/cypress/e2e/assets_spec/AssetHomepage.cy.ts @@ -100,7 +100,6 @@ describe("Asset Tab", () => { it("Export asset", () => { assetPage.selectassetimportbutton(); - cy.wait(2000); assetPage.selectJsonExportButton(); assetPage.selectassetimportbutton(); assetPage.selectCsvExportButton(); diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 918e926d107..7d7847c435e 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -32,7 +32,7 @@ describe("Facility Creation", () => { const facilityAddress = "cypress address"; const facilityUpdateAddress = "cypress updated address"; const facilityNumber = "9898469865"; - const triageDate = "02122023"; + const triageDate = "03122023"; const initialTriageValue = "60"; const modifiedTriageValue = "50"; const facilityErrorMessage = [ diff --git a/cypress/e2e/facility_spec/FacilityInventory.cy.ts b/cypress/e2e/facility_spec/FacilityInventory.cy.ts index 78e7af88cea..8ae707f860a 100644 --- a/cypress/e2e/facility_spec/FacilityInventory.cy.ts +++ b/cypress/e2e/facility_spec/FacilityInventory.cy.ts @@ -33,7 +33,9 @@ describe("Inventory Management Section", () => { // modify the new item facilityPage.fillInventoryDetails("PPE", "Use Stock", "5"); facilityPage.clickAddInventory(); - facilityPage.verifySuccessNotification("Inventory created successfully"); + facilityPage.verifySuccessNotification( + "Inventory use stock updated successfully", + ); // verify the new modification facilityPage.verifyPpeQuantity("PPE"); facilityPage.verifyPpeQuantity("5"); @@ -43,7 +45,6 @@ describe("Inventory Management Section", () => { // verify the last entry deletion facilityPage.verifyStockInRow("#row-0", "Added Stock"); facilityPage.verifyStockInRow("#row-1", "Used Stock"); - cy.wait(3000); facilityHome.navigateBack(); facilityPage.verifyPpeQuantity("PPE"); }); @@ -59,7 +60,6 @@ describe("Inventory Management Section", () => { facilityPage.verifyBadgeWithText(".badge-danger", "Low Stock"); // modify with manual minimum badge facilityPage.clickAddMinimumQuanitity(); - cy.wait(3000); cy.get("body").then(($body) => { if ($body.find("#update-minimum-quantity").is(":visible")) { // If the 'update-minimum-quantity' element is visible, click it diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index 6f9bf2b03e0..7def73588b3 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -105,7 +105,6 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); cy.submitButton("Submit"); - cy.wait(2000); cy.verifyNotification("Medicine prescribed"); patientPrescription.clickReturnToDashboard(); // Verify the data's across the dashboard diff --git a/cypress/e2e/patient_spec/PatientFileUpload.ts b/cypress/e2e/patient_spec/PatientFileUpload.cy.ts similarity index 100% rename from cypress/e2e/patient_spec/PatientFileUpload.ts rename to cypress/e2e/patient_spec/PatientFileUpload.cy.ts diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 835e53459eb..2635df4bf0b 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -113,7 +113,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.closeNotification(); // Submit the doctors log update cy.submitButton("Save and Continue"); - cy.wait(2000); cy.verifyNotification("Progress Note created successfully"); cy.closeNotification(); // modify the relevant critical care log update @@ -252,7 +251,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); cy.submitButton("Save"); - cy.wait(2000); cy.verifyNotification("Brief Update created successfully"); // Verify the card content cy.get("#basic-information").scrollIntoView(); diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 4e493a23bff..aa3afce5eaf 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -119,7 +119,6 @@ describe("Patient Creation with consultation", () => { patientPage.verifyPatientIsCreated(); // Verify the patient details patientPage.clickCancelButton(); - cy.wait(3000); patientPage.savePatientUrl(); patientPage.verifyPatientDashboardDetails( patientOneGender, @@ -157,7 +156,6 @@ describe("Patient Creation with consultation", () => { patientPage.verifyStatusCode(); patientPage.patientformvisibility(); // change the gender to female and input data to related changed field - cy.wait(3000); patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); patientPage.clickPatientAntenatalStatusYes(); @@ -220,11 +218,9 @@ describe("Patient Creation with consultation", () => { } patientPage.clickUpdatePatient(); - cy.wait(3000); patientPage.verifyPatientUpdated(); patientPage.visitPatientUrl(); // Verify Female Gender change reflection, No Medical History and Insurance Details - cy.wait(5000); patientPage.verifyPatientDashboardDetails( patientOneUpdatedGender, age, @@ -241,9 +237,7 @@ describe("Patient Creation with consultation", () => { cy.get("[data-testid=patient-details]") .contains("member id") .scrollIntoView(); - cy.wait(2000); patientInsurance.clickPatientInsuranceViewDetail(); - cy.wait(3000); patientInsurance.verifyPatientPolicyDetails( patientOneFirstSubscriberId, patientOneFirstPolicyId, diff --git a/cypress/e2e/users_spec/UsersCreation.cy.ts b/cypress/e2e/users_spec/UsersCreation.cy.ts index 392c9ff987d..43b43000a32 100644 --- a/cypress/e2e/users_spec/UsersCreation.cy.ts +++ b/cypress/e2e/users_spec/UsersCreation.cy.ts @@ -182,7 +182,6 @@ describe("User Creation", () => { it("create new user form throwing mandatory field error", () => { userCreationPage.clickElementById("addUserButton"); userCreationPage.clickElementById("submit"); - cy.wait(2000); userCreationPage.verifyErrorMessages(EXPECTED_ERROR_MESSAGES); }); diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index 3d9d18ff285..6c489c7beef 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -38,11 +38,9 @@ describe("Manage User", () => { manageUserPage.selectSkillFromDropdown(linkedskill); manageUserPage.clickAddSkillButton(); manageUserPage.clickCloseSlideOver(); - cy.wait(5000); manageUserPage.clicklinkedskillbutton(); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.clickCloseSlideOver(); - cy.wait(5000); manageUserPage.navigateToProfile(); userCreationPage.verifyElementContainsText( "username-profile-details", @@ -59,7 +57,6 @@ describe("Manage User", () => { manageUserPage.selectSkillFromDropdown(linkedskill); manageUserPage.clickAddSkillButton(); manageUserPage.clickCloseSlideOver(); - cy.wait(5000); // temporary hack to fix the failure manageUserPage.clicklinkedskillbutton(); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.clickUnlinkSkill(); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 159b8660b43..37419d9431a 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -300,7 +300,6 @@ class FacilityPage { cy.get("#facility-location-button").click(); cy.wait("@mapApi").its("response.statusCode").should("eq", 200); cy.get("input#pac-input").type(location).type("{enter}"); - cy.wait(2000); cy.get("div#map-close").click(); } diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index a583844a632..bc9e55830f1 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -13,8 +13,8 @@ export class PatientPage { visitPatient(patientName: string) { cy.get("#name").click().type(patientName); cy.intercept("GET", "**/api/v1/consultation/**").as("getPatient"); + // cy.wait("@getPatient"); cy.get("#patient-name-list").contains(patientName).click(); - cy.wait(2000); cy.wait("@getPatient").its("response.statusCode").should("eq", 200); cy.get("#patient-name-consultation") .should("be.visible") diff --git a/cypress/pageobject/Patient/PatientDoctorNotes.ts b/cypress/pageobject/Patient/PatientDoctorNotes.ts index 157f35d47d9..203c99703d9 100644 --- a/cypress/pageobject/Patient/PatientDoctorNotes.ts +++ b/cypress/pageobject/Patient/PatientDoctorNotes.ts @@ -5,7 +5,6 @@ export class PatientDoctorNotes { } addDiscussionNotes(notes: string) { - cy.wait(2000); cy.get("#discussion_notes_textarea").scrollIntoView(); cy.get("#discussion_notes_textarea").click().type(notes); } diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 0616a19729c..b323f9781a8 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -20,10 +20,8 @@ export class PatientFileUpload { recordAudio() { cy.get("#record-audio").click(); - cy.wait(5000); - cy.get("#stop-recording").click(); - cy.wait(1000); - cy.get("#save-recording").click(); + cy.get("#stop-recording").should("be.enabled").click(); + cy.get("#save-recording").should("be.enabled").click(); } clickUploadAudioFile() { @@ -33,7 +31,6 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { - cy.wait(2000); cy.get("#file-div").scrollIntoView(); cy.verifyContentPresence("#file-div", [fileName]); } diff --git a/cypress/pageobject/Patient/PatientTransfer.ts b/cypress/pageobject/Patient/PatientTransfer.ts index 0bdd55e9880..5ad49b40b5f 100644 --- a/cypress/pageobject/Patient/PatientTransfer.ts +++ b/cypress/pageobject/Patient/PatientTransfer.ts @@ -19,13 +19,11 @@ class PatientTransfer { clickTransferSubmitButton() { cy.get("#submit-transferpatient").click(); - cy.wait(2000); } clickConsultationCancelButton() { cy.get("#cancel").scrollIntoView(); cy.get("#cancel").click(); - cy.wait(2000); } clickAllowPatientTransferButton() { diff --git a/cypress/pageobject/Users/ManageUserPage.ts b/cypress/pageobject/Users/ManageUserPage.ts index 470862693a8..8518ac10118 100644 --- a/cypress/pageobject/Users/ManageUserPage.ts +++ b/cypress/pageobject/Users/ManageUserPage.ts @@ -41,7 +41,7 @@ export class ManageUserPage { } clickCloseSlideOver() { - cy.get("#close-slide-over").click({ force: true }); + cy.get("#close-slide-over").should("be.visible").click(); } clickHomeFacilityIcon() { From f5d5cc86cfec7dffb155ab28883a5a15e3bc1687 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Tue, 29 Oct 2024 20:04:15 +0530 Subject: [PATCH 02/83] Refactor Cypress tests: replaced static cy.wait() with dynamic waits and removed irrelevant waits --- cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts | 4 ---- cypress/e2e/patient_spec/PatientPrescription.cy.ts | 1 - cypress/pageobject/Patient/PatientConsultation.ts | 2 -- cypress/pageobject/Patient/PatientCreation.ts | 1 - cypress/pageobject/Patient/PatientLogupdate.ts | 5 ----- cypress/pageobject/Patient/PatientPrescription.ts | 3 +-- 6 files changed, 1 insertion(+), 15 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index be9b06303cb..7f7fd7f3e80 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -76,10 +76,8 @@ describe("Patient Discharge based on multiple reason", () => { patientDischarge.clickClearButton(); // select a non-registered facility and perform the discharge patientDischarge.typeReferringFacility(referringFreetextFacility); - cy.wait(2000); cy.submitButton("Confirm Discharge"); cy.submitButton("Acknowledge & Submit"); - cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -106,12 +104,10 @@ describe("Patient Discharge based on multiple reason", () => { patientPrescription.selectDosageFrequency("Twice daily"); cy.submitButton("Submit"); cy.verifyNotification("Medicine prescribed"); - cy.wait(2000); cy.closeNotification(); // submit the discharge pop-up cy.submitButton("Confirm Discharge"); cy.submitButton("Acknowledge & Submit"); - cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection diff --git a/cypress/e2e/patient_spec/PatientPrescription.cy.ts b/cypress/e2e/patient_spec/PatientPrescription.cy.ts index 86ca4122082..a6293ca6706 100644 --- a/cypress/e2e/patient_spec/PatientPrescription.cy.ts +++ b/cypress/e2e/patient_spec/PatientPrescription.cy.ts @@ -113,7 +113,6 @@ describe("Patient Medicine Administration", () => { cy.closeNotification(); // Administer the medicine in edit form patientPrescription.clickAdministerButton(); - cy.wait(2000); patientPrescription.enterAdministerDosage(medicineBaseDosage); patientPrescription.enterAdministerNotes(medicineAdministerNote); cy.submitButton("Administer Medicine"); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 71a0fbb3909..867fe942508 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -1,6 +1,5 @@ export class PatientConsultationPage { selectConsultationStatus(status: string) { - cy.wait(5000); cy.get("#route_to_facility").scrollIntoView(); cy.get("#route_to_facility").should("be.visible"); cy.clickAndSelectOption("#route_to_facility", status); @@ -109,6 +108,5 @@ export class PatientConsultationPage { "#consultation-buttons", "Edit Consultation Details", ); - cy.wait(3000); } } diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index bc9e55830f1..474de816fd6 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -13,7 +13,6 @@ export class PatientPage { visitPatient(patientName: string) { cy.get("#name").click().type(patientName); cy.intercept("GET", "**/api/v1/consultation/**").as("getPatient"); - // cy.wait("@getPatient"); cy.get("#patient-name-list").contains(patientName).click(); cy.wait("@getPatient").its("response.statusCode").should("eq", 200); cy.get("#patient-name-consultation") diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index d7b49fde05e..10c4c73b8fe 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -2,7 +2,6 @@ class PatientLogupdate { clickLogupdate() { cy.get("#log-update").scrollIntoView(); cy.verifyAndClickElement("#log-update", "Log Update"); - cy.wait(2000); } clickSwitchBed() { @@ -16,7 +15,6 @@ class PatientLogupdate { selectBed(bed: string) { cy.typeAndSelectOption("input[name='bed']", bed); cy.get("#update-switchbed").click(); - cy.wait(2000); } selectPatientCategory(category: string) { @@ -78,19 +76,16 @@ class PatientLogupdate { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); cy.get(element).first().contains("View Details").click(); - cy.wait(3000); } clickLogUpdateUpdateLog(element: string, patientCategory: string) { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); cy.get(element).first().contains("Update Log").click(); - cy.wait(3000); } clickUpdateDetail() { cy.verifyAndClickElement("#consultation-preview", "Update Details"); - cy.wait(3000); } clearIntoElementById(elementId) { diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts index d801b360aba..4c8e43a6145 100644 --- a/cypress/pageobject/Patient/PatientPrescription.ts +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -61,8 +61,7 @@ export class PatientPrescription { } enterDiscontinueReason(reason: string) { - cy.wait(2000); - cy.get("#discontinuedReason").type(reason); + cy.get("#discontinuedReason").should("be.visible").type(reason); } enterAdministerDosage(dosage: string) { From 568c7e2eaad54153a5eee4bedf38192c8f54874d Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 24 Nov 2024 13:32:22 +0530 Subject: [PATCH 03/83] Cypress test cases --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- cypress/e2e/facility_spec/FacilityInventory.cy.ts | 2 ++ cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts | 1 + cypress/e2e/patient_spec/PatientRegistration.cy.ts | 4 ++++ cypress/e2e/users_spec/UsersCreation.cy.ts | 1 + cypress/e2e/users_spec/UsersManage.cy.ts | 3 +++ cypress/pageobject/Facility/FacilityCreation.ts | 3 ++- cypress/pageobject/Patient/PatientConsultation.ts | 2 ++ cypress/pageobject/Patient/PatientCreation.ts | 1 + cypress/pageobject/Patient/PatientDoctorNotes.ts | 1 + cypress/pageobject/Patient/PatientFileupload.ts | 1 + cypress/pageobject/Patient/PatientLogupdate.ts | 4 ++++ cypress/pageobject/Patient/PatientTransfer.ts | 2 ++ 13 files changed, 25 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 883a5379118..5fd988480fc 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -32,7 +32,7 @@ describe("Facility Creation", () => { const facilityAddress = "cypress address"; const facilityUpdateAddress = "cypress updated address"; const facilityNumber = "9898469865"; - const triageDate = "03122023"; + const triageDate = "02122023"; const initialTriageValue = "60"; const modifiedTriageValue = "50"; const facilityErrorMessage = [ diff --git a/cypress/e2e/facility_spec/FacilityInventory.cy.ts b/cypress/e2e/facility_spec/FacilityInventory.cy.ts index ed08b4ccdd4..056f05d94ae 100644 --- a/cypress/e2e/facility_spec/FacilityInventory.cy.ts +++ b/cypress/e2e/facility_spec/FacilityInventory.cy.ts @@ -45,6 +45,7 @@ describe("Inventory Management Section", () => { // verify the last entry deletion facilityPage.verifyStockInRow("#row-0", "Added Stock"); facilityPage.verifyStockInRow("#row-1", "Used Stock"); + cy.wait(2000); facilityHome.navigateBack(); facilityPage.verifyPpeQuantity("PPE"); }); @@ -60,6 +61,7 @@ describe("Inventory Management Section", () => { facilityPage.verifyBadgeWithText(".badge-danger", "Low Stock"); // modify with manual minimum badge facilityPage.clickAddMinimumQuanitity(); + cy.wait(3000); cy.get("body").then(($body) => { if ($body.find("#update-minimum-quantity").is(":visible")) { // If the 'update-minimum-quantity' element is visible, click it diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index 6fabe4abde1..9e234c860da 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -106,6 +106,7 @@ describe("Patient Discharge based on multiple reason", () => { patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); + cy.wait(2000); cy.closeNotification(); // submit the discharge pop-up cy.clickSubmitButton("Confirm Discharge"); diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 2ca9434dc1f..f3aa4f56490 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -116,6 +116,7 @@ describe("Patient Creation with consultation", () => { patientPage.verifyPatientIsCreated(); // Verify the patient details patientPage.clickCancelButton(); + cy.wait(3000); patientPage.savePatientUrl(); patientPage.verifyPatientDashboardDetails( patientOneGender, @@ -153,6 +154,7 @@ describe("Patient Creation with consultation", () => { patientPage.verifyStatusCode(); patientPage.patientformvisibility(); // change the gender to female and input data to related changed field + cy.wait(2000); patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); patientPage.clickPatientAntenatalStatusYes(); @@ -212,7 +214,9 @@ describe("Patient Creation with consultation", () => { cy.get("[data-testid=patient-details]") .contains("member id") .scrollIntoView(); + cy.wait(2000); patientInsurance.clickPatientInsuranceViewDetail(); + cy.wait(2000); patientInsurance.verifyPatientPolicyDetails( patientOneFirstSubscriberId, patientOneFirstPolicyId, diff --git a/cypress/e2e/users_spec/UsersCreation.cy.ts b/cypress/e2e/users_spec/UsersCreation.cy.ts index b055a294779..f495a136d97 100644 --- a/cypress/e2e/users_spec/UsersCreation.cy.ts +++ b/cypress/e2e/users_spec/UsersCreation.cy.ts @@ -182,6 +182,7 @@ describe("User Creation", () => { it("create new user form throwing mandatory field error", () => { userCreationPage.clickElementById("addUserButton"); userCreationPage.clickElementById("submit"); + cy.wait(2000); userCreationPage.verifyErrorMessages(EXPECTED_ERROR_MESSAGES); }); diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index fcbcf2fef69..0cc87093a8e 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -42,9 +42,11 @@ describe("Manage User", () => { manageUserPage.selectSkillFromDropdown(linkedskill); manageUserPage.clickAddSkillButton(); manageUserPage.clickCloseSlideOver(); + cy.wait(3000); manageUserPage.clicklinkedskillbutton(); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.clickCloseSlideOver(); + cy.wait(5000); manageUserPage.navigateToProfile(); userCreationPage.verifyElementContainsText( "username-profile-details", @@ -66,6 +68,7 @@ describe("Manage User", () => { manageUserPage.clickAddSkillButton(); cy.verifyNotification("Skill added successfully"); cy.closeNotification(); + cy.wait(5000); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.clickCloseSlideOver(); // verifying the doctor connect diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 55d26b2c9e0..11ffa3d6318 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -284,6 +284,7 @@ class FacilityPage { cy.get("#facility-location-button").click(); cy.wait("@mapApi").its("response.statusCode").should("eq", 200); cy.get("input#pac-input").type(location).type("{enter}"); + cy.wait(2000); cy.get("div#map-close").click(); } @@ -355,7 +356,7 @@ class FacilityPage { fillInventoryDetails(name: string, status: string, quantity: string) { cy.wait(2000); - cy.get("div#id").click(); + cy.get("div#id").should("not.be.disabled").click(); cy.get("div#id ul li").contains(name).click(); cy.get("div#isIncoming").click(); cy.get("div#isIncoming ul li").contains(status).click(); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index c53bb22fe5e..c8046a39a9e 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -1,5 +1,6 @@ export class PatientConsultationPage { selectConsultationStatus(status: string) { + cy.wait(5000); cy.get("#route_to_facility").scrollIntoView(); cy.get("#route_to_facility").should("be.visible"); cy.clickAndSelectOption("#route_to_facility", status); @@ -109,6 +110,7 @@ export class PatientConsultationPage { "#consultation-buttons", "Edit Consultation Details", ); + cy.wait(3000); } interceptPatientDetailsAPI(): void { diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 7ebcc50d74b..217f5a534e2 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -14,6 +14,7 @@ export class PatientPage { cy.get("#name").click().type(patientName); cy.intercept("GET", "**/api/v1/consultation/**").as("getPatient"); cy.get("#patient-name-list").contains(patientName).click(); + cy.wait(3000); cy.wait("@getPatient").its("response.statusCode").should("eq", 200); cy.get("#patient-name-consultation") .should("be.visible") diff --git a/cypress/pageobject/Patient/PatientDoctorNotes.ts b/cypress/pageobject/Patient/PatientDoctorNotes.ts index 203c99703d9..5eac457fe8c 100644 --- a/cypress/pageobject/Patient/PatientDoctorNotes.ts +++ b/cypress/pageobject/Patient/PatientDoctorNotes.ts @@ -5,6 +5,7 @@ export class PatientDoctorNotes { } addDiscussionNotes(notes: string) { + cy.wait(3000); cy.get("#discussion_notes_textarea").scrollIntoView(); cy.get("#discussion_notes_textarea").click().type(notes); } diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 4fb9699f3f3..59e2b3798af 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -35,6 +35,7 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { + cy.wait(3000); cy.get("#file-div").scrollIntoView(); cy.verifyContentPresence("#file-div", [fileName]); } diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index a72b597d3ae..c82c246495e 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -2,6 +2,7 @@ class PatientLogupdate { clickLogupdate() { cy.get("#log-update").scrollIntoView(); cy.verifyAndClickElement("#log-update", "Log Update"); + cy.wait(3000); } clickSwitchBed() { @@ -15,6 +16,7 @@ class PatientLogupdate { selectBed(bed: string) { cy.typeAndSelectOption("input[name='bed']", bed); cy.get("#update-switchbed").click(); + cy.wait(3000); } selectPatientCategory(category: string) { @@ -76,6 +78,7 @@ class PatientLogupdate { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); cy.get(element).first().contains("View Details").click(); + cy.wait(3000); } clickLogUpdateUpdateLog(element: string, patientCategory: string) { @@ -86,6 +89,7 @@ class PatientLogupdate { clickUpdateDetail() { cy.verifyAndClickElement("#consultation-preview", "Update Details"); + cy.wait(3000); } clearIntoElementById(elementId) { diff --git a/cypress/pageobject/Patient/PatientTransfer.ts b/cypress/pageobject/Patient/PatientTransfer.ts index 5ad49b40b5f..d4884664f60 100644 --- a/cypress/pageobject/Patient/PatientTransfer.ts +++ b/cypress/pageobject/Patient/PatientTransfer.ts @@ -19,11 +19,13 @@ class PatientTransfer { clickTransferSubmitButton() { cy.get("#submit-transferpatient").click(); + cy.wait(3000); } clickConsultationCancelButton() { cy.get("#cancel").scrollIntoView(); cy.get("#cancel").click(); + cy.wait(3000); } clickAllowPatientTransferButton() { From f5734f63abfae498728511797103a2a64443f932 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Tue, 26 Nov 2024 15:40:06 +0530 Subject: [PATCH 04/83] Added intercept in Facility Inventory --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 1 - cypress/e2e/facility_spec/FacilityInventory.cy.ts | 9 +++++++-- .../patient_spec/PatientConsultationCreation.cy.ts | 1 - .../patient_spec/PatientConsultationDischarge.cy.ts | 4 ---- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 2 -- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 4 ---- cypress/e2e/users_spec/UsersCreation.cy.ts | 1 - cypress/e2e/users_spec/UsersManage.cy.ts | 3 --- cypress/pageobject/Facility/FacilityCreation.ts | 9 +++------ cypress/pageobject/Patient/PatientConsultation.ts | 2 -- cypress/pageobject/Patient/PatientCreation.ts | 1 - cypress/pageobject/Patient/PatientFileupload.ts | 13 +++++-------- cypress/pageobject/Patient/PatientLogupdate.ts | 4 ---- cypress/pageobject/Patient/PatientTransfer.ts | 2 -- 15 files changed, 16 insertions(+), 42 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 5fd988480fc..ca7aa007694 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -201,7 +201,7 @@ describe("Facility Creation", () => { facilityPage.clickManageFacilityDropdown(); facilityPage.clickDeleteFacilityOption(); facilityPage.confirmDeleteFacility(); - cy.verifyNotification("Facility deleted successfully"); + cy.verifyNotification(`${facilityName} deleted successfully`); }); it("Create a new facility with single bed and doctor capacity", () => { diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index f4c7aaa90a0..30e817a6521 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -156,7 +156,6 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); - cy.wait(2000); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); diff --git a/cypress/e2e/facility_spec/FacilityInventory.cy.ts b/cypress/e2e/facility_spec/FacilityInventory.cy.ts index 056f05d94ae..bad36303973 100644 --- a/cypress/e2e/facility_spec/FacilityInventory.cy.ts +++ b/cypress/e2e/facility_spec/FacilityInventory.cy.ts @@ -25,10 +25,13 @@ describe("Inventory Management Section", () => { it("Add New Inventory | Modify data and delete last entry ", () => { // add a new item + cy.intercept("GET", "/api/v1/items/**").as("getItems"); facilityPage.clickManageInventory(); + cy.wait("@getItems").its("response.statusCode").should("eq", 200); facilityPage.fillInventoryDetails("PPE", "Add Stock", "10"); facilityPage.clickAddInventory(); facilityPage.verifySuccessNotification("Inventory created successfully"); + cy.closeNotification(); facilityPage.clickManageInventory(); // modify the new item facilityPage.fillInventoryDetails("PPE", "Use Stock", "5"); @@ -45,7 +48,6 @@ describe("Inventory Management Section", () => { // verify the last entry deletion facilityPage.verifyStockInRow("#row-0", "Added Stock"); facilityPage.verifyStockInRow("#row-1", "Used Stock"); - cy.wait(2000); facilityHome.navigateBack(); facilityPage.verifyPpeQuantity("PPE"); }); @@ -59,9 +61,12 @@ describe("Inventory Management Section", () => { cy.closeNotification(); // Verify Backend minimum badge facilityPage.verifyBadgeWithText(".badge-danger", "Low Stock"); + cy.intercept("GET", "**/api/v1/facility/*/min_quantity/**").as( + "getMinQuantity", + ); // modify with manual minimum badge facilityPage.clickAddMinimumQuanitity(); - cy.wait(3000); + cy.wait("@getMinQuantity").its("response.statusCode").should("eq", 200); cy.get("body").then(($body) => { if ($body.find("#update-minimum-quantity").is(":visible")) { // If the 'update-minimum-quantity' element is visible, click it diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index 3eacd9b718f..8bb134d1127 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -105,7 +105,6 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); - cy.wait(2000); cy.verifyNotification("Medicine prescribed"); patientPrescription.clickReturnToDashboard(); // Verify the data's across the dashboard diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index 9e234c860da..1b816557e9f 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -76,10 +76,8 @@ describe("Patient Discharge based on multiple reason", () => { patientDischarge.clickClearButton(); // select a non-registered facility and perform the discharge patientDischarge.typeReferringFacility(referringFreetextFacility); - cy.wait(2000); cy.clickSubmitButton("Confirm Discharge"); cy.clickSubmitButton("Acknowledge & Submit"); - cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -106,12 +104,10 @@ describe("Patient Discharge based on multiple reason", () => { patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); - cy.wait(2000); cy.closeNotification(); // submit the discharge pop-up cy.clickSubmitButton("Confirm Discharge"); cy.clickSubmitButton("Acknowledge & Submit"); - cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index cfb739c8343..a7b9e293e59 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -113,7 +113,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.closeNotification(); // Submit the doctors log update cy.clickSubmitButton("Save and Continue"); - cy.wait(2000); cy.verifyNotification("Progress Note created successfully"); cy.closeNotification(); // modify the relevant critical care log update @@ -252,7 +251,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); cy.clickSubmitButton("Save"); - cy.wait(2000); cy.verifyNotification("Brief Update created successfully"); // Verify the card content cy.get("#basic-information").scrollIntoView(); diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index f3aa4f56490..2ca9434dc1f 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -116,7 +116,6 @@ describe("Patient Creation with consultation", () => { patientPage.verifyPatientIsCreated(); // Verify the patient details patientPage.clickCancelButton(); - cy.wait(3000); patientPage.savePatientUrl(); patientPage.verifyPatientDashboardDetails( patientOneGender, @@ -154,7 +153,6 @@ describe("Patient Creation with consultation", () => { patientPage.verifyStatusCode(); patientPage.patientformvisibility(); // change the gender to female and input data to related changed field - cy.wait(2000); patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); patientPage.clickPatientAntenatalStatusYes(); @@ -214,9 +212,7 @@ describe("Patient Creation with consultation", () => { cy.get("[data-testid=patient-details]") .contains("member id") .scrollIntoView(); - cy.wait(2000); patientInsurance.clickPatientInsuranceViewDetail(); - cy.wait(2000); patientInsurance.verifyPatientPolicyDetails( patientOneFirstSubscriberId, patientOneFirstPolicyId, diff --git a/cypress/e2e/users_spec/UsersCreation.cy.ts b/cypress/e2e/users_spec/UsersCreation.cy.ts index f495a136d97..b055a294779 100644 --- a/cypress/e2e/users_spec/UsersCreation.cy.ts +++ b/cypress/e2e/users_spec/UsersCreation.cy.ts @@ -182,7 +182,6 @@ describe("User Creation", () => { it("create new user form throwing mandatory field error", () => { userCreationPage.clickElementById("addUserButton"); userCreationPage.clickElementById("submit"); - cy.wait(2000); userCreationPage.verifyErrorMessages(EXPECTED_ERROR_MESSAGES); }); diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index 0cc87093a8e..fcbcf2fef69 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -42,11 +42,9 @@ describe("Manage User", () => { manageUserPage.selectSkillFromDropdown(linkedskill); manageUserPage.clickAddSkillButton(); manageUserPage.clickCloseSlideOver(); - cy.wait(3000); manageUserPage.clicklinkedskillbutton(); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.clickCloseSlideOver(); - cy.wait(5000); manageUserPage.navigateToProfile(); userCreationPage.verifyElementContainsText( "username-profile-details", @@ -68,7 +66,6 @@ describe("Manage User", () => { manageUserPage.clickAddSkillButton(); cy.verifyNotification("Skill added successfully"); cy.closeNotification(); - cy.wait(5000); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.clickCloseSlideOver(); // verifying the doctor connect diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 11ffa3d6318..6f0f34eb325 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -284,8 +284,7 @@ class FacilityPage { cy.get("#facility-location-button").click(); cy.wait("@mapApi").its("response.statusCode").should("eq", 200); cy.get("input#pac-input").type(location).type("{enter}"); - cy.wait(2000); - cy.get("div#map-close").click(); + cy.get("div#map-close").should("be.visible").click(); } fillMiddleWareAddress(url: string) { @@ -355,16 +354,14 @@ class FacilityPage { } fillInventoryDetails(name: string, status: string, quantity: string) { - cy.wait(2000); - cy.get("div#id").should("not.be.disabled").click(); - cy.get("div#id ul li").contains(name).click(); cy.get("div#isIncoming").click(); cy.get("div#isIncoming ul li").contains(status).click(); + cy.get("div#id").click(); + cy.get("div#id ul li").contains(name).click(); cy.get("[name='quantity']").type(quantity); } fillInventoryMinimumDetails(name: string, quantity: string) { - cy.wait(2000); cy.get("div#id").click(); cy.get("div#id ul li").contains(name).click(); cy.get("[name='quantity']").type(quantity); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index c8046a39a9e..c53bb22fe5e 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -1,6 +1,5 @@ export class PatientConsultationPage { selectConsultationStatus(status: string) { - cy.wait(5000); cy.get("#route_to_facility").scrollIntoView(); cy.get("#route_to_facility").should("be.visible"); cy.clickAndSelectOption("#route_to_facility", status); @@ -110,7 +109,6 @@ export class PatientConsultationPage { "#consultation-buttons", "Edit Consultation Details", ); - cy.wait(3000); } interceptPatientDetailsAPI(): void { diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 217f5a534e2..7ebcc50d74b 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -14,7 +14,6 @@ export class PatientPage { cy.get("#name").click().type(patientName); cy.intercept("GET", "**/api/v1/consultation/**").as("getPatient"); cy.get("#patient-name-list").contains(patientName).click(); - cy.wait(3000); cy.wait("@getPatient").its("response.statusCode").should("eq", 200); cy.get("#patient-name-consultation") .should("be.visible") diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 59e2b3798af..3394529ec6e 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -20,12 +20,8 @@ export class PatientFileUpload { recordAudio() { cy.get("#record-audio").click(); - cy.wait(2000); - cy.get("#start-recording").click(); - cy.wait(2000); - cy.get("#stop-recording").click(); - cy.wait(1000); - cy.get("#save-recording").click(); + cy.get("#stop-recording").should("be.enabled").click(); + cy.get("#save-recording").should("be.enabled").click(); } clickUploadAudioFile() { @@ -35,8 +31,9 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { - cy.wait(3000); - cy.get("#file-div").scrollIntoView(); + cy.get("#file-div", { timeout: 10000 }) + .scrollIntoView() + .should("be.visible"); cy.verifyContentPresence("#file-div", [fileName]); } diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index c82c246495e..a72b597d3ae 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -2,7 +2,6 @@ class PatientLogupdate { clickLogupdate() { cy.get("#log-update").scrollIntoView(); cy.verifyAndClickElement("#log-update", "Log Update"); - cy.wait(3000); } clickSwitchBed() { @@ -16,7 +15,6 @@ class PatientLogupdate { selectBed(bed: string) { cy.typeAndSelectOption("input[name='bed']", bed); cy.get("#update-switchbed").click(); - cy.wait(3000); } selectPatientCategory(category: string) { @@ -78,7 +76,6 @@ class PatientLogupdate { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); cy.get(element).first().contains("View Details").click(); - cy.wait(3000); } clickLogUpdateUpdateLog(element: string, patientCategory: string) { @@ -89,7 +86,6 @@ class PatientLogupdate { clickUpdateDetail() { cy.verifyAndClickElement("#consultation-preview", "Update Details"); - cy.wait(3000); } clearIntoElementById(elementId) { diff --git a/cypress/pageobject/Patient/PatientTransfer.ts b/cypress/pageobject/Patient/PatientTransfer.ts index d4884664f60..5ad49b40b5f 100644 --- a/cypress/pageobject/Patient/PatientTransfer.ts +++ b/cypress/pageobject/Patient/PatientTransfer.ts @@ -19,13 +19,11 @@ class PatientTransfer { clickTransferSubmitButton() { cy.get("#submit-transferpatient").click(); - cy.wait(3000); } clickConsultationCancelButton() { cy.get("#cancel").scrollIntoView(); cy.get("#cancel").click(); - cy.wait(3000); } clickAllowPatientTransferButton() { From 277fb42c07645661aae5fe10f622fea4e5148787 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Tue, 26 Nov 2024 15:52:22 +0530 Subject: [PATCH 05/83] reverting .env file --- .env | 1 - 1 file changed, 1 deletion(-) diff --git a/.env b/.env index 2eebb6b7cd7..77e4641b8b2 100644 --- a/.env +++ b/.env @@ -8,7 +8,6 @@ REACT_PUBLIC_URL=https://care.ohc.network # Care API URL without the /api prefix REACT_CARE_API_URL=https://careapi.ohc.network -# REACT_CARE_API_URL=http://localhost:9000 # Dev envs ESLINT_NO_DEV_ERRORS=true From 88d7c77d78b8696eb41e172378883ea8d6f52785 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 30 Nov 2024 22:26:22 +0530 Subject: [PATCH 06/83] cy.wait is replaced with cy.intercept in ManageUser --- cypress/pageobject/Patient/PatientFileupload.ts | 9 ++++++--- cypress/pageobject/Users/ManageUserPage.ts | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 3394529ec6e..140d5ca993b 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -20,7 +20,11 @@ export class PatientFileUpload { recordAudio() { cy.get("#record-audio").click(); + cy.wait(2000); + cy.get("#start-recording").click(); + cy.wait(2000); cy.get("#stop-recording").should("be.enabled").click(); + cy.wait(2000); cy.get("#save-recording").should("be.enabled").click(); } @@ -31,9 +35,8 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { - cy.get("#file-div", { timeout: 10000 }) - .scrollIntoView() - .should("be.visible"); + cy.wait(2000); + cy.get("#file-div").scrollIntoView(); cy.verifyContentPresence("#file-div", [fileName]); } diff --git a/cypress/pageobject/Users/ManageUserPage.ts b/cypress/pageobject/Users/ManageUserPage.ts index 20152c6799e..37634b0792f 100644 --- a/cypress/pageobject/Users/ManageUserPage.ts +++ b/cypress/pageobject/Users/ManageUserPage.ts @@ -12,7 +12,9 @@ export class ManageUserPage { } selectSkillFromDropdown(skill: string) { + cy.intercept("GET", "/api/v1/skill/*").as("getSkills"); cy.typeAndSelectOption("input[name='skill']", skill); + cy.wait("@getSkills").its("response.statusCode").should("eq", 200); } clickLinkFacility() { From 800d764455b96c3e7ff3f7973d32b149f2be9009 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 30 Nov 2024 23:17:55 +0530 Subject: [PATCH 07/83] Testing for Wait in FacilityHomepage --- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 30e817a6521..f4c7aaa90a0 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -156,6 +156,7 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); + cy.wait(2000); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); From c6e95c2393b9c9130e18fb13b6be44e02056624f Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 2 Dec 2024 21:31:19 +0530 Subject: [PATCH 08/83] AssetHomepage tests --- .../e2e/facility_spec/FacilityHomepage.cy.ts | 69 ++++++++++++++++--- cypress/pageobject/Asset/AssetCreation.ts | 9 ++- 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index f4c7aaa90a0..d7e27ecd502 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -139,48 +139,99 @@ describe("Facility Homepage Function", () => { }); it("Verify Notice Board Functionality", () => { - // search facility and verify it's loaded or not + // Log: Starting the test case + cy.log("Starting 'Verify Notice Board Functionality' test"); + + // Search facility and verify it's loaded or not manageUserPage.interceptFacilitySearchReq(); manageUserPage.typeFacilitySearch(facilityName); manageUserPage.verifyFacilitySearchReq(); - // verify facility name and card reflection + + // Log: Verifying facility search result + cy.log("Facility search completed, verifying facility data"); + + // Verify facility name and card reflection facilityNotify.verifyUrlContains("Dummy+Facility+40"); facilityPage.verifyFacilityBadgeContent(facilityName); manageUserPage.assertFacilityInCard(facilityName); - // send notification to a facility + + // Log: Facility details verified + cy.log("Facility name and card reflection verified"); + + // Send notification to a facility facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); facilityNotify.fillNotifyText(notificationMessage); + + // Log: Notification filled with message + cy.log("Filled notification message: " + notificationMessage); + facilityNotify.interceptPostNotificationReq(); cy.clickSubmitButton("Notify"); facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); - cy.wait(2000); + + // Log: Notification successfully sent + cy.log("Notification sent and closed"); + // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); cy.clickSubmitButton("Notify"); facilityNotify.verifyErrorMessage(notificationErrorMsg); - // close pop-up and verify + + // Log: Error message displayed for empty notification + cy.log("Error message displayed for empty notification"); + + // Close pop-up and verify facilityHome.verifyAndCloseNotifyModal(); - // signout as district admin and login as a Nurse - loginPage.ensureLoggedIn(); - loginPage.clickSignOutBtn(); - loginPage.loginManuallyAsNurse(); + + // Log: Modal closed + cy.log("Notification modal closed"); + + // Sign out as district admin and login as Nurse + loginPage.ensureLoggedIn(); // Ensure the admin is logged in before logging out + loginPage.clickSignOutBtn(); // Sign out admin + + // Log: Logged out as district admin + cy.log("Logged out as district admin"); + + loginPage.loginManuallyAsNurse(); // Log in as Nurse + + // Log: Logged in as Nurse + cy.log("Logged in as Nurse"); + + // Wait for the nurse to be logged in by verifying the dashboard URL or nurse-specific element + + // Log: Nurse logged in and dashboard visible + cy.log("Nurse dashboard is now visible"); + // Verify Notice Board Reflection facilityNotify.interceptGetNotificationReq("MESSAGE"); facilityNotify.visitNoticeBoard(); facilityNotify.verifyGetNotificationReq(); facilityNotify.verifyFacilityNoticeBoardMessage(notificationMessage); facilityNotify.interceptGetNotificationReq(); + + // Log: Verified notice board message + cy.log("Notice board message verified"); + // Verify Sidebar Notification Reflection facilityNotify.openNotificationSlide(); facilityNotify.verifyGetNotificationReq(); cy.verifyContentPresence("#notification-slide-msg", [notificationMessage]); facilityNotify.closeNotificationSlide(); + + // Log: Sidebar notification verified and closed + cy.log("Sidebar notification verified and closed"); + + // Sign out as Nurse and ensure login page is visible loginPage.ensureLoggedIn(); loginPage.clickSignOutBtn(); + + // Log: Test case completed + cy.log("Test case 'Verify Notice Board Functionality' completed"); }); afterEach(() => { diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts index ec631768154..6a5b0d4ad23 100644 --- a/cypress/pageobject/Asset/AssetCreation.ts +++ b/cypress/pageobject/Asset/AssetCreation.ts @@ -217,18 +217,21 @@ export class AssetPage { } selectassetimportbutton() { - cy.get("[data-testid=import-asset-button]").click(); + cy.get("[data-testid=import-asset-button]") + .scrollIntoView() + .should("be.visible") + .click(); } selectJsonExportButton() { cy.intercept("GET", "**/api/v1/asset/?**json=true**").as("getJsonexport"); - cy.get("#export-json-option").click(); + cy.get("#export-json-option").should("be.visible").click(); cy.wait("@getJsonexport").its("response.statusCode").should("eq", 200); } selectCsvExportButton() { cy.intercept("GET", "**/api/v1/asset/?**csv=true**").as("getCsvexport"); - cy.get("#export-csv-option").click(); + cy.get("#export-csv-option").should("be.visible").click(); cy.wait("@getCsvexport").its("response.statusCode").should("eq", 200); } From 8d4e83df6fbafb203366188e40c80b7932a7b50a Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 2 Dec 2024 22:37:26 +0530 Subject: [PATCH 09/83] Add Precription intercept added --- .../e2e/facility_spec/FacilityHomepage.cy.ts | 69 +++---------------- .../PatientConsultationCreation.cy.ts | 4 ++ 2 files changed, 13 insertions(+), 60 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index d7e27ecd502..f4c7aaa90a0 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -139,99 +139,48 @@ describe("Facility Homepage Function", () => { }); it("Verify Notice Board Functionality", () => { - // Log: Starting the test case - cy.log("Starting 'Verify Notice Board Functionality' test"); - - // Search facility and verify it's loaded or not + // search facility and verify it's loaded or not manageUserPage.interceptFacilitySearchReq(); manageUserPage.typeFacilitySearch(facilityName); manageUserPage.verifyFacilitySearchReq(); - - // Log: Verifying facility search result - cy.log("Facility search completed, verifying facility data"); - - // Verify facility name and card reflection + // verify facility name and card reflection facilityNotify.verifyUrlContains("Dummy+Facility+40"); facilityPage.verifyFacilityBadgeContent(facilityName); manageUserPage.assertFacilityInCard(facilityName); - - // Log: Facility details verified - cy.log("Facility name and card reflection verified"); - - // Send notification to a facility + // send notification to a facility facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); facilityNotify.fillNotifyText(notificationMessage); - - // Log: Notification filled with message - cy.log("Filled notification message: " + notificationMessage); - facilityNotify.interceptPostNotificationReq(); cy.clickSubmitButton("Notify"); facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); - - // Log: Notification successfully sent - cy.log("Notification sent and closed"); - + cy.wait(2000); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); cy.clickSubmitButton("Notify"); facilityNotify.verifyErrorMessage(notificationErrorMsg); - - // Log: Error message displayed for empty notification - cy.log("Error message displayed for empty notification"); - - // Close pop-up and verify + // close pop-up and verify facilityHome.verifyAndCloseNotifyModal(); - - // Log: Modal closed - cy.log("Notification modal closed"); - - // Sign out as district admin and login as Nurse - loginPage.ensureLoggedIn(); // Ensure the admin is logged in before logging out - loginPage.clickSignOutBtn(); // Sign out admin - - // Log: Logged out as district admin - cy.log("Logged out as district admin"); - - loginPage.loginManuallyAsNurse(); // Log in as Nurse - - // Log: Logged in as Nurse - cy.log("Logged in as Nurse"); - - // Wait for the nurse to be logged in by verifying the dashboard URL or nurse-specific element - - // Log: Nurse logged in and dashboard visible - cy.log("Nurse dashboard is now visible"); - + // signout as district admin and login as a Nurse + loginPage.ensureLoggedIn(); + loginPage.clickSignOutBtn(); + loginPage.loginManuallyAsNurse(); // Verify Notice Board Reflection facilityNotify.interceptGetNotificationReq("MESSAGE"); facilityNotify.visitNoticeBoard(); facilityNotify.verifyGetNotificationReq(); facilityNotify.verifyFacilityNoticeBoardMessage(notificationMessage); facilityNotify.interceptGetNotificationReq(); - - // Log: Verified notice board message - cy.log("Notice board message verified"); - // Verify Sidebar Notification Reflection facilityNotify.openNotificationSlide(); facilityNotify.verifyGetNotificationReq(); cy.verifyContentPresence("#notification-slide-msg", [notificationMessage]); facilityNotify.closeNotificationSlide(); - - // Log: Sidebar notification verified and closed - cy.log("Sidebar notification verified and closed"); - - // Sign out as Nurse and ensure login page is visible loginPage.ensureLoggedIn(); loginPage.clickSignOutBtn(); - - // Log: Test case completed - cy.log("Test case 'Verify Notice Board Functionality' completed"); }); afterEach(() => { diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index 8bb134d1127..cd2baf51f98 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -98,6 +98,9 @@ describe("Patient Consultation in multiple combination", () => { cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // Below code for the prescription module only present while creating a new consultation + cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/?").as( + "postPrescriptions", + ); patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); @@ -106,6 +109,7 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); cy.verifyNotification("Medicine prescribed"); + cy.wait("@postPrescriptions").its("response.statusCode").should("eq", 201); patientPrescription.clickReturnToDashboard(); // Verify the data's across the dashboard patientConsultationPage.verifyTextInConsultation( From 5ff84289004cd5899e6570721439024e8a6ed821 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 2 Dec 2024 22:52:34 +0530 Subject: [PATCH 10/83] Wait added before medicine prescribed --- cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index cd2baf51f98..c51517bddfe 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -108,8 +108,8 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); - cy.verifyNotification("Medicine prescribed"); cy.wait("@postPrescriptions").its("response.statusCode").should("eq", 201); + cy.verifyNotification("Medicine prescribed"); patientPrescription.clickReturnToDashboard(); // Verify the data's across the dashboard patientConsultationPage.verifyTextInConsultation( From f81f85fcddc150472e3bfd189a85c0ffe4f81e3c Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 2 Dec 2024 23:01:09 +0530 Subject: [PATCH 11/83] Get request in consultationcreation --- cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index c51517bddfe..8ceb1f54215 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -98,8 +98,8 @@ describe("Patient Consultation in multiple combination", () => { cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // Below code for the prescription module only present while creating a new consultation - cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/?").as( - "postPrescriptions", + cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/?").as( + "getPrescriptions", ); patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); @@ -108,7 +108,7 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); - cy.wait("@postPrescriptions").its("response.statusCode").should("eq", 201); + cy.wait("@getPrescriptions").its("response.statusCode").should("eq", 200); cy.verifyNotification("Medicine prescribed"); patientPrescription.clickReturnToDashboard(); // Verify the data's across the dashboard From e47d2b0e25c38cc9cf3a8fb3d7356b5038d9374f Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 2 Dec 2024 23:18:04 +0530 Subject: [PATCH 12/83] Logupdate --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 4 ++++ cypress/pageobject/Patient/PatientConsultation.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index a7b9e293e59..2c62c522d7e 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -85,6 +85,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectBed(bedOne); cy.closeNotification(); patientLogupdate.clickLogupdate(); + cy.intercept("POST", "/api/v1/consultation/*/daily_rounds/").as( + "dailyRounds", + ); // Only will be using random non-unique progress note fields patientLogupdate.selectRoundType("Progress Note"); patientLogupdate.selectPatientCategory(patientCategory); @@ -109,6 +112,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPrescription.enterDosage("4"); patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); + cy.wait("@dailyRounds").its("response.statusCode").should("eq", 201); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Submit the doctors log update diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 3bdf63aa670..edd8ae135a4 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -1,5 +1,6 @@ export class PatientConsultationPage { selectConsultationStatus(status: string) { + cy.wait(5000); cy.get("#route_to_facility").scrollIntoView(); cy.get("#route_to_facility").should("be.visible"); cy.clickAndSelectOption("#route_to_facility", status); @@ -109,6 +110,7 @@ export class PatientConsultationPage { "#consultation-buttons", "Edit Consultation Details", ); + cy.wait(3000); } interceptPatientDetailsAPI(): void { From 443d4389c7a1499c52e931bde4310f0ea355b1a1 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 4 Dec 2024 21:44:51 +0530 Subject: [PATCH 13/83] AssetHomePage Wait removal --- cypress/e2e/assets_spec/AssetHomepage.cy.ts | 1 - cypress/pageobject/Asset/AssetHome.ts | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/assets_spec/AssetHomepage.cy.ts b/cypress/e2e/assets_spec/AssetHomepage.cy.ts index e19f885db72..fc195c7a803 100644 --- a/cypress/e2e/assets_spec/AssetHomepage.cy.ts +++ b/cypress/e2e/assets_spec/AssetHomepage.cy.ts @@ -113,7 +113,6 @@ rolesToTest.forEach((role) => { it("Export the list of assets in CSV & Json", () => { if (role === "districtAdmin") { assetHome.selectAssetImportButton("click"); - cy.wait(2000); assetHome.selectJsonExportButton(); assetHome.selectAssetImportButton("click"); assetHome.selectCsvExportButton(); diff --git a/cypress/pageobject/Asset/AssetHome.ts b/cypress/pageobject/Asset/AssetHome.ts index e127b785100..1c3cdd20399 100644 --- a/cypress/pageobject/Asset/AssetHome.ts +++ b/cypress/pageobject/Asset/AssetHome.ts @@ -69,7 +69,7 @@ export class AssetHome { selectAssetImportButton(action: "click" | "verifyNotExist"): void { const selector = "[data-testid=import-asset-button]"; if (action === "click") { - cy.get(selector).click(); + cy.get(selector).scrollIntoView().should("be.visible").click(); } else if (action === "verifyNotExist") { cy.get(selector).should("not.exist"); } @@ -77,13 +77,13 @@ export class AssetHome { selectJsonExportButton() { cy.intercept("GET", "**/api/v1/asset/?**json=true**").as("getJsonexport"); - cy.get("#export-json-option").click(); + cy.get("#export-json-option").should("be.visible").click(); cy.wait("@getJsonexport").its("response.statusCode").should("eq", 200); } selectCsvExportButton() { cy.intercept("GET", "**/api/v1/asset/?**csv=true**").as("getCsvexport"); - cy.get("#export-csv-option").click(); + cy.get("#export-csv-option").should("be.visible").click(); cy.wait("@getCsvexport").its("response.statusCode").should("eq", 200); } From 54eee2a9f1fe7cf29f914ee65af13df1de7477bb Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 4 Dec 2024 22:12:43 +0530 Subject: [PATCH 14/83] FacilityHomepage.cy.ts test case wait --- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 7d03f7a16f0..b4ecbb5e65b 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -174,7 +174,6 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); - cy.wait(2000); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); From 1e55ab4acdd8accbd529fab81f2f538f404de586 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 4 Dec 2024 23:20:31 +0530 Subject: [PATCH 15/83] Patient Registration Waits --- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 3 +++ cypress/pageobject/Patient/PatientCreation.ts | 2 ++ cypress/pageobject/Patient/PatientInsurance.ts | 2 ++ 3 files changed, 7 insertions(+) diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 170343cb098..3d095f65993 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -155,6 +155,7 @@ describe("Patient Creation with consultation", () => { patientPage.visitUpdatePatientUrl(); patientPage.verifyStatusCode(); patientPage.patientformvisibility(); + cy.wait(2000); // change the gender to female and input data to related changed field patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); @@ -195,7 +196,9 @@ describe("Patient Creation with consultation", () => { patientOneSecondInsuranceId, patientOneSecondInsurerName, ); + cy.intercept("GET", "**/api/v1/patient/*/").as("getPatient"); patientPage.clickUpdatePatient(); + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); patientPage.verifyPatientUpdated(); patientPage.visitPatientUrl(); // Verify Female Gender change reflection, No Medical History and Insurance Details diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 308c64655ea..bb0a97a3d66 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -97,7 +97,9 @@ export class PatientPage { } clickCancelButton() { + cy.intercept("GET", "**/api/v1/patient/*/").as("getPatient"); cy.get("#cancel").click(); + cy.wait("@getPatient"); } selectPatientGender(gender: string) { diff --git a/cypress/pageobject/Patient/PatientInsurance.ts b/cypress/pageobject/Patient/PatientInsurance.ts index 79d6e3b7510..ad62e1be065 100644 --- a/cypress/pageobject/Patient/PatientInsurance.ts +++ b/cypress/pageobject/Patient/PatientInsurance.ts @@ -21,7 +21,9 @@ class PatientInsurance { } clickAddInsruanceDetails() { + cy.intercept("GET", "**/api/hcx/payors/?").as("getPayors"); cy.get("[data-testid=add-insurance-button]").click(); + cy.wait("@getPayors").its("response.statusCode").should("eq", 200); } verifyPatientPolicyDetails( From 1d804415dfe53a9b2c2957ab496911e1fc5cbcf5 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 4 Dec 2024 23:41:10 +0530 Subject: [PATCH 16/83] revert PatientInsurance.ts --- cypress/pageobject/Patient/PatientInsurance.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientInsurance.ts b/cypress/pageobject/Patient/PatientInsurance.ts index ad62e1be065..79d6e3b7510 100644 --- a/cypress/pageobject/Patient/PatientInsurance.ts +++ b/cypress/pageobject/Patient/PatientInsurance.ts @@ -21,9 +21,7 @@ class PatientInsurance { } clickAddInsruanceDetails() { - cy.intercept("GET", "**/api/hcx/payors/?").as("getPayors"); cy.get("[data-testid=add-insurance-button]").click(); - cy.wait("@getPayors").its("response.statusCode").should("eq", 200); } verifyPatientPolicyDetails( From e461b91390432b6db78fa503d40a1896c70e1f12 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 00:18:01 +0530 Subject: [PATCH 17/83] Patient Consultation wait corrected --- .../patient_spec/PatientConsultationCreation.cy.ts | 7 ++++--- cypress/pageobject/Patient/PatientDischarge.ts | 14 +++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index 396ca99509a..e28b5b070d3 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -98,15 +98,16 @@ describe("Patient Consultation in multiple combination", () => { cy.clickSubmitButton("Create Consultation"); cy.verifyNotification("Consultation created successfully"); // Below code for the prescription module only present while creating a new consultation - cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/?").as( - "getPrescriptions", - ); patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); + patientPrescription.waitForMedibaseStatusCode(); patientPrescription.selectMedicine(medicineOne); patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); + cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/*").as( + "getPrescriptions", + ); cy.clickSubmitButton("Submit"); cy.wait("@getPrescriptions").its("response.statusCode").should("eq", 200); cy.verifyNotification("Medicine prescribed"); diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index 70a6d550887..c51ea62c322 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -6,7 +6,19 @@ class PatientDischarge { } selectDischargeReason(reason: string) { - cy.clickAndSelectOption("#discharge_reason", reason); + if (reason == "Recoverd") { + cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/*").as( + "getPrecriptions", + ); + cy.clickAndSelectOption("#discharge_reason", reason); + cy.wait("getPrecriptions").its("response.statusCode").should("eq", 200); + } else if (reason == "Referred") { + cy.intercept("GET", "**/api/v1/getallfacilities/**").as("getFacilities"); + cy.clickAndSelectOption("#discharge_reason", reason); + cy.wait("getFacilities").its("response.statusCode").should("eq", 200); + } else { + cy.clickAndSelectOption("#discharge_reason", reason); + } } typeDischargeNote(note: string) { From b4dfc9f3391841e3a31f1b674129bdabd6ff5fd0 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 00:33:35 +0530 Subject: [PATCH 18/83] Paatient Discharge --- cypress/pageobject/Patient/PatientDischarge.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index c51ea62c322..ca5dc5dcc86 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -11,11 +11,11 @@ class PatientDischarge { "getPrecriptions", ); cy.clickAndSelectOption("#discharge_reason", reason); - cy.wait("getPrecriptions").its("response.statusCode").should("eq", 200); + cy.wait("@getPrecriptions").its("response.statusCode").should("eq", 200); } else if (reason == "Referred") { cy.intercept("GET", "**/api/v1/getallfacilities/**").as("getFacilities"); cy.clickAndSelectOption("#discharge_reason", reason); - cy.wait("getFacilities").its("response.statusCode").should("eq", 200); + cy.wait("@getFacilities").its("response.statusCode").should("eq", 200); } else { cy.clickAndSelectOption("#discharge_reason", reason); } From c2bb8ba2b08a0c109650ab3446ceffb322024428 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 00:36:52 +0530 Subject: [PATCH 19/83] Patient Consultation creation updated cypress --- cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index e28b5b070d3..bb21b03e051 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -101,7 +101,6 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); - patientPrescription.waitForMedibaseStatusCode(); patientPrescription.selectMedicine(medicineOne); patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); From acdd07c9b0d236761a4f5583d8d5a1a40629260c Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 00:40:37 +0530 Subject: [PATCH 20/83] Patient discharge updated cypress --- cypress/pageobject/Patient/PatientDischarge.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index ca5dc5dcc86..89f3844fbac 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -6,12 +6,12 @@ class PatientDischarge { } selectDischargeReason(reason: string) { - if (reason == "Recoverd") { + if (reason == "Recovered") { cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/*").as( - "getPrecriptions", + "getPrescriptions", ); cy.clickAndSelectOption("#discharge_reason", reason); - cy.wait("@getPrecriptions").its("response.statusCode").should("eq", 200); + cy.wait("@getPrescriptions").its("response.statusCode").should("eq", 200); } else if (reason == "Referred") { cy.intercept("GET", "**/api/v1/getallfacilities/**").as("getFacilities"); cy.clickAndSelectOption("#discharge_reason", reason); From 47d521b53dd3adec32ac75ec7a055492df5b7be3 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 01:04:09 +0530 Subject: [PATCH 21/83] Edit Consultation cypress test intercept added --- cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts | 2 ++ cypress/pageobject/Patient/PatientConsultation.ts | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index bb21b03e051..c1e4d7e00d5 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -379,7 +379,9 @@ describe("Patient Consultation in multiple combination", () => { it("Edit created consultation to existing patient", () => { patientPage.visitPatient("Dummy Patient Thirteen"); + cy.intercept("GET", "**/api/v1/consultation/*").as("getConsultation"); patientConsultationPage.clickEditConsultationButton(); + cy.wait("@getConsultation").its("response.statusCode").should("eq", 200); patientConsultationPage.typePatientIllnessHistory("editted"); patientConsultationPage.selectPatientDiagnosis( diagnosis5, diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index edd8ae135a4..3bdf63aa670 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -1,6 +1,5 @@ export class PatientConsultationPage { selectConsultationStatus(status: string) { - cy.wait(5000); cy.get("#route_to_facility").scrollIntoView(); cy.get("#route_to_facility").should("be.visible"); cy.clickAndSelectOption("#route_to_facility", status); @@ -110,7 +109,6 @@ export class PatientConsultationPage { "#consultation-buttons", "Edit Consultation Details", ); - cy.wait(3000); } interceptPatientDetailsAPI(): void { From a2a8cdf576d62135f10ccfb03fe7c520cb43bf3c Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 01:18:27 +0530 Subject: [PATCH 22/83] FacilityHomepage wait --- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index b4ecbb5e65b..7d03f7a16f0 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -174,6 +174,7 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); + cy.wait(2000); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); From 2b282e4dba1c183eafebacf8534b286c46c1ceac Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 19:35:45 +0530 Subject: [PATCH 23/83] PatientLogUpdate waits --- .../e2e/patient_spec/PatientLogUpdate.cy.ts | 8 +++--- .../pageobject/Patient/PatientLogupdate.ts | 27 ++++++++++++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index b0f47ec49b9..b71b0d3f24a 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -85,9 +85,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectBed(bedOne); cy.closeNotification(); patientLogupdate.clickLogupdate(); - cy.intercept("POST", "/api/v1/consultation/*/daily_rounds/").as( - "dailyRounds", - ); // Only will be using random non-unique progress note fields patientLogupdate.selectRoundType("Progress Note"); patientLogupdate.selectPatientCategory(patientCategory); @@ -112,11 +109,14 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPrescription.enterDosage("4"); patientPrescription.selectDosageFrequency("Twice daily"); cy.clickSubmitButton("Submit"); - cy.wait("@dailyRounds").its("response.statusCode").should("eq", 201); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Submit the doctors log update + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds").as( + "getDailyRounds", + ); cy.clickSubmitButton("Save and Continue"); + cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 201); cy.verifyNotification("Progress Note created successfully"); cy.closeNotification(); // modify the relevant critical care log update diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 9a5c1386e4b..d86cca4a7a8 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -1,7 +1,9 @@ class PatientLogupdate { clickLogupdate() { + cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); cy.get("#log-update").scrollIntoView(); cy.verifyAndClickElement("#log-update", "Log Update"); + cy.wait("@getPatient").its("response.statusCode").should("eq", 201); } clickSwitchBed() { @@ -14,7 +16,13 @@ class PatientLogupdate { selectBed(bed: string) { cy.typeAndSelectOption("input[name='bed']", bed); + cy.intercept("POST", "**/api/v1/consultationbed/").as( + "postConsultationBed", + ); cy.get("#update-switchbed").click(); + cy.wait("@postConsultationBed") + .its("response.statusCode") + .should("eq", 201); } selectPatientCategory(category: string) { @@ -75,18 +83,35 @@ class PatientLogupdate { clickLogUpdateViewDetails(element: string, patientCategory: string) { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( + "getLogUpdateViewDetails", + ); cy.get(element).first().contains("View Details").click(); + cy.wait("@getLogUpdateViewDetails") + .its("response.statusCode") + .should("eq", 200); } clickLogUpdateUpdateLog(element: string, patientCategory: string) { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( + "getLogUpdateViewDetails", + ); cy.get(element).first().contains("Update Log").click(); + cy.wait("@getLogUpdateViewDetails") + .its("response.statusCode") + .should("eq", 200); } clickUpdateDetail() { + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( + "getLogUpdateViewDetails", + ); cy.verifyAndClickElement("#consultation-preview", "Update Log"); - cy.wait(3000); + cy.wait("@getLogUpdateViewDetails") + .its("response.statusCode") + .should("eq", 200); } clearIntoElementById(elementId) { From f7a028147eefa7671406c6c9f0a4f77fdcc4f065 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 19:51:00 +0530 Subject: [PATCH 24/83] PatientLogUpdate waits --- cypress/pageobject/Patient/PatientLogupdate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index d86cca4a7a8..84697d9c09b 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -3,7 +3,7 @@ class PatientLogupdate { cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); cy.get("#log-update").scrollIntoView(); cy.verifyAndClickElement("#log-update", "Log Update"); - cy.wait("@getPatient").its("response.statusCode").should("eq", 201); + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); } clickSwitchBed() { From 3fa74596d0c258023b2635ed178c6ee7c6823da8 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 21:35:03 +0530 Subject: [PATCH 25/83] PatientLogUpdate waits --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index b71b0d3f24a..43fff494d97 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -82,8 +82,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(patientOne); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); - patientLogupdate.selectBed(bedOne); cy.closeNotification(); + patientLogupdate.selectBed(bedOne); patientLogupdate.clickLogupdate(); // Only will be using random non-unique progress note fields patientLogupdate.selectRoundType("Progress Note"); @@ -112,18 +112,22 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Submit the doctors log update - cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds").as( + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( "getDailyRounds", ); cy.clickSubmitButton("Save and Continue"); - cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 201); + cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 200); cy.verifyNotification("Progress Note created successfully"); cy.closeNotification(); // modify the relevant critical care log update patientLogupdate.selectCriticalCareSection("Neurological Monitoring"); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); cy.get("#left_pupil_light_reaction-option-FIXED").click(); + cy.intercept("PATCH", "**/api/v1/consultation/*/daily_rounds/*/").as( + "patchDailyRounds", + ); cy.clickSubmitButton("Update Details"); + cy.wait("@patchDailyRounds").its("response.statusCode").should("eq", 200); cy.verifyNotification( "Neurological Monitoring details succesfully updated.", ); @@ -154,8 +158,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(patientTwo); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); - patientLogupdate.selectBed(bedTwo); cy.closeNotification(); + patientLogupdate.selectBed(bedTwo); patientLogupdate.clickLogupdate(); patientLogupdate.selectRoundType("Detailed Update"); patientLogupdate.selectPatientCategory(patientCategory); @@ -236,8 +240,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(patientThree); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); - patientLogupdate.selectBed(bedThree); cy.closeNotification(); + patientLogupdate.selectBed(bedThree); patientLogupdate.clickLogupdate(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); From 60512d6296fb7e40681cf1f9de3050b9b75f7d22 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 5 Dec 2024 21:46:01 +0530 Subject: [PATCH 26/83] PatientLogUpdate waits --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 43fff494d97..06b541d72d3 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -158,8 +158,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(patientTwo); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); - cy.closeNotification(); patientLogupdate.selectBed(bedTwo); + cy.closeNotification(); patientLogupdate.clickLogupdate(); patientLogupdate.selectRoundType("Detailed Update"); patientLogupdate.selectPatientCategory(patientCategory); @@ -240,8 +240,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(patientThree); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); - cy.closeNotification(); patientLogupdate.selectBed(bedThree); + cy.closeNotification(); patientLogupdate.clickLogupdate(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); From c31f3693c41260c3da383eab45b393eb58397940 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 17:26:50 +0530 Subject: [PATCH 27/83] PatientLogUpdate new Progress log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 6 ++++++ cypress/pageobject/Patient/PatientLogupdate.ts | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 06b541d72d3..a8d441ef9f5 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -58,7 +58,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.closeNotification(); + cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); patientLogupdate.clickLogupdate(); + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectRoundType("Tele-medicine Log"); patientLogupdate.selectPatientCategory(patientCategory); @@ -80,11 +82,15 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { it("Create a new Progress log update for a admitted patient and edit it", () => { patientPage.visitPatient(patientOne); + cy.intercept("GET", "**/api/v1/consultationbed/*").as("getBed"); patientLogupdate.clickLogupdate(); + cy.wait("@getBed").its("response.statusCode").should("eq", 200); cy.verifyNotification("Please assign a bed to the patient"); cy.closeNotification(); patientLogupdate.selectBed(bedOne); + cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); patientLogupdate.clickLogupdate(); + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); // Only will be using random non-unique progress note fields patientLogupdate.selectRoundType("Progress Note"); patientLogupdate.selectPatientCategory(patientCategory); diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 84697d9c09b..2f550317614 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -1,9 +1,7 @@ class PatientLogupdate { clickLogupdate() { - cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); cy.get("#log-update").scrollIntoView(); cy.verifyAndClickElement("#log-update", "Log Update"); - cy.wait("@getPatient").its("response.statusCode").should("eq", 200); } clickSwitchBed() { From cf04eb7c63a507f4a845f3442f0a06c8a73cf6ac Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 17:36:49 +0530 Subject: [PATCH 28/83] PatientLogUpdate new Progress log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index a8d441ef9f5..de75ff6e082 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -244,11 +244,15 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { it("Create a new Normal update for a admission patient and verify its reflection in cards", () => { patientPage.visitPatient(patientThree); + cy.intercept("GET", "**/api/v1/consultationbed/*").as("getBed"); patientLogupdate.clickLogupdate(); + cy.wait("@getBed").its("response.statusCode").should("eq", 200); cy.verifyNotification("Please assign a bed to the patient"); - patientLogupdate.selectBed(bedThree); cy.closeNotification(); + patientLogupdate.selectBed(bedThree); + cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); patientLogupdate.clickLogupdate(); + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeOtherDetails(otherExamination); From 5a4d28b4a38f4b863002c50fddc2ae4d5bfb684a Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 17:49:28 +0530 Subject: [PATCH 29/83] PatientLogUpdate new Progress log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index de75ff6e082..a9ceccd8d7e 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -244,15 +244,17 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { it("Create a new Normal update for a admission patient and verify its reflection in cards", () => { patientPage.visitPatient(patientThree); - cy.intercept("GET", "**/api/v1/consultationbed/*").as("getBed"); + cy.intercept("GET", "**/api/v1/consultationbed/*").as("getConsultationBed"); patientLogupdate.clickLogupdate(); - cy.wait("@getBed").its("response.statusCode").should("eq", 200); + cy.wait("@getConsultationBed").its("response.statusCode").should("eq", 200); cy.verifyNotification("Please assign a bed to the patient"); cy.closeNotification(); patientLogupdate.selectBed(bedThree); - cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); + cy.intercept("GET", "**/api/v1/patient/*").as("getAdmissionPatient"); patientLogupdate.clickLogupdate(); - cy.wait("@getPatient").its("response.statusCode").should("eq", 200); + cy.wait("@getAdmissionPatient") + .its("response.statusCode") + .should("eq", 200); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeOtherDetails(otherExamination); From 0c51eca30659adb7fd1af1f78ae74e40eddcbee4 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 18:10:17 +0530 Subject: [PATCH 30/83] PatientLogUpdate new Normal log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index a9ceccd8d7e..d335f4d29a1 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -244,9 +244,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { it("Create a new Normal update for a admission patient and verify its reflection in cards", () => { patientPage.visitPatient(patientThree); - cy.intercept("GET", "**/api/v1/consultationbed/*").as("getConsultationBed"); patientLogupdate.clickLogupdate(); - cy.wait("@getConsultationBed").its("response.statusCode").should("eq", 200); cy.verifyNotification("Please assign a bed to the patient"); cy.closeNotification(); patientLogupdate.selectBed(bedThree); From d4dd88b1afa6513cb24757c7f0322f33c6ce3dac Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 18:33:14 +0530 Subject: [PATCH 31/83] PatientLogUpdate new Normal log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index d335f4d29a1..560cfab7b6f 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -169,7 +169,11 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); patientLogupdate.selectRoundType("Detailed Update"); patientLogupdate.selectPatientCategory(patientCategory); + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( + "getDailyRounds", + ); cy.clickSubmitButton("Save and Continue"); + cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 200); cy.verifyNotification("Detailed Update created successfully"); cy.closeNotification(); // Select two Section - First One is Respiratory Support @@ -268,7 +272,11 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectRhythm(patientRhythmType); patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); + cy.intercept("POST", "**/api/v1/consultation/*/daily_rounds/").as( + "postDailyRounds", + ); cy.clickSubmitButton("Save"); + cy.wait("@postDailyRounds").its("response.statusCode").should("eq", 201); cy.verifyNotification("Brief Update created successfully"); // Verify the card content cy.get("#basic-information").scrollIntoView(); From 36c660652c9ecc4f872713666c12ade5f284466d Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 19:41:13 +0530 Subject: [PATCH 32/83] PatientLogUpdate new Normal log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 560cfab7b6f..38569936d0f 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -273,11 +273,12 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); cy.intercept("POST", "**/api/v1/consultation/*/daily_rounds/").as( - "postDailyRounds", + "postRounds", ); cy.clickSubmitButton("Save"); - cy.wait("@postDailyRounds").its("response.statusCode").should("eq", 201); + cy.wait("@postRounds").its("response.statusCode").should("eq", 201); cy.verifyNotification("Brief Update created successfully"); + cy.closeNotification(); // Verify the card content cy.get("#basic-information").scrollIntoView(); cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]); From 228bbef32b2a86b17a5172ec4e45b3e5037de190 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 21:11:51 +0530 Subject: [PATCH 33/83] PatientLogUpdate new Normal log update --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 4 ++-- cypress/pageobject/Patient/PatientLogupdate.ts | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 38569936d0f..ecf42a8139e 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -86,8 +86,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); cy.wait("@getBed").its("response.statusCode").should("eq", 200); cy.verifyNotification("Please assign a bed to the patient"); - cy.closeNotification(); patientLogupdate.selectBed(bedOne); + cy.closeNotification(); cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); patientLogupdate.clickLogupdate(); cy.wait("@getPatient").its("response.statusCode").should("eq", 200); @@ -250,8 +250,8 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientPage.visitPatient(patientThree); patientLogupdate.clickLogupdate(); cy.verifyNotification("Please assign a bed to the patient"); - cy.closeNotification(); patientLogupdate.selectBed(bedThree); + cy.closeNotification(); cy.intercept("GET", "**/api/v1/patient/*").as("getAdmissionPatient"); patientLogupdate.clickLogupdate(); cy.wait("@getAdmissionPatient") diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 2f550317614..678b491f871 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -14,13 +14,9 @@ class PatientLogupdate { selectBed(bed: string) { cy.typeAndSelectOption("input[name='bed']", bed); - cy.intercept("POST", "**/api/v1/consultationbed/").as( - "postConsultationBed", - ); + cy.intercept("GET", "**/api/v1/assetbed/*").as("getAssetBed"); cy.get("#update-switchbed").click(); - cy.wait("@postConsultationBed") - .its("response.statusCode") - .should("eq", 201); + cy.wait("@getAssetBed").its("response.statusCode").should("eq", 200); } selectPatientCategory(category: string) { From 227ee29e88a70c91dce4fcf4dbd9c6d0ff80c03a Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 22:32:35 +0530 Subject: [PATCH 34/83] PatientLogUpdate new Progress --- cypress/pageobject/Patient/PatientLogupdate.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 678b491f871..2f550317614 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -14,9 +14,13 @@ class PatientLogupdate { selectBed(bed: string) { cy.typeAndSelectOption("input[name='bed']", bed); - cy.intercept("GET", "**/api/v1/assetbed/*").as("getAssetBed"); + cy.intercept("POST", "**/api/v1/consultationbed/").as( + "postConsultationBed", + ); cy.get("#update-switchbed").click(); - cy.wait("@getAssetBed").its("response.statusCode").should("eq", 200); + cy.wait("@postConsultationBed") + .its("response.statusCode") + .should("eq", 201); } selectPatientCategory(category: string) { From c6d36b3615cd53fc7bc2d0df00007c23fb6fc34f Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 6 Dec 2024 23:26:24 +0530 Subject: [PATCH 35/83] Patient Registration cy.wait with intercepts --- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 6 ++---- cypress/pageobject/Patient/PatientMedicalHistory.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 3d095f65993..e940fcb67f7 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -155,7 +155,6 @@ describe("Patient Creation with consultation", () => { patientPage.visitUpdatePatientUrl(); patientPage.verifyStatusCode(); patientPage.patientformvisibility(); - cy.wait(2000); // change the gender to female and input data to related changed field patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); @@ -196,11 +195,11 @@ describe("Patient Creation with consultation", () => { patientOneSecondInsuranceId, patientOneSecondInsurerName, ); - cy.intercept("GET", "**/api/v1/patient/*/").as("getPatient"); patientPage.clickUpdatePatient(); - cy.wait("@getPatient").its("response.statusCode").should("eq", 200); patientPage.verifyPatientUpdated(); + cy.intercept("GET", "**/api/v1/patient/*/").as("getPatient"); patientPage.visitPatientUrl(); + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); // Verify Female Gender change reflection, No Medical History and Insurance Details patientPage.verifyPatientDashboardDetails( patientOneUpdatedGender, @@ -218,7 +217,6 @@ describe("Patient Creation with consultation", () => { cy.get("[data-testid=patient-details]") .contains("Member ID") .scrollIntoView(); - cy.wait(2000); patientInsurance.verifyPatientPolicyDetails( patientOneFirstSubscriberId, patientOneFirstPolicyId, diff --git a/cypress/pageobject/Patient/PatientMedicalHistory.ts b/cypress/pageobject/Patient/PatientMedicalHistory.ts index bf2296b4471..94c06790fbf 100644 --- a/cypress/pageobject/Patient/PatientMedicalHistory.ts +++ b/cypress/pageobject/Patient/PatientMedicalHistory.ts @@ -34,7 +34,7 @@ class PatientMedicalHistory { patientSymptoms7: string, ) { cy.get("a").contains("Health Profile").click(); - cy.wait(2000); + cy.url().should("include", "/health-profile"); cy.get("[data-test-id=patient-health-profile]").then(($dashboard) => { cy.url().should("include", "/facility/"); expect($dashboard).to.contain(patientPresentHealth); From e417e0df0c780fac30f60757be54bef890228d77 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 07:47:30 +0530 Subject: [PATCH 36/83] Patient Registration cy.wait with intercepts --- cypress/pageobject/Patient/PatientCreation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index ac599f72626..743cd1a8772 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -91,11 +91,11 @@ export class PatientPage { } clickPatientAntenatalStatusYes() { - cy.get("#is_antenatal-option-true").click(); + cy.get("#is_antenatal-option-true").should("be.visible").click(); } clickPatientPostPartumStatusYes() { - cy.get("#is_postpartum-option-true").click(); + cy.get("#is_postpartum-option-true").should("be.visible").click(); } clickCancelButton() { From e8140a371ac3bcb8f2a5ebf55c24008b29281e4f Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 12:10:22 +0530 Subject: [PATCH 37/83] Patient Discharge cy.wait --- cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index a478750b3ac..85cd43a168f 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -107,7 +107,11 @@ describe("Patient Discharge based on multiple reason", () => { cy.closeNotification(); // submit the discharge pop-up cy.clickSubmitButton("Confirm Discharge"); + cy.intercept("POST", "**/api/v1/consultation/*/discharge_patient/").as( + "postDischarge", + ); cy.clickSubmitButton("Acknowledge & Submit"); + cy.wait("@postDischarge").its("response.statusCode").should("eq", 200); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection From 307a1b170aea8dca8226a95d5f5202d92d7eeb5e Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 21:48:58 +0530 Subject: [PATCH 38/83] Patient LogUpdate reflection cards --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index ecf42a8139e..767c1dd4a08 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -272,11 +272,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectRhythm(patientRhythmType); patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); - cy.intercept("POST", "**/api/v1/consultation/*/daily_rounds/").as( - "postRounds", - ); + cy.intercept("GET", "**/api/v1/consultation/*/").as("getConsultation"); cy.clickSubmitButton("Save"); - cy.wait("@postRounds").its("response.statusCode").should("eq", 201); + cy.wait("@getConsultation").its("response.statusCode").should("eq", 200); cy.verifyNotification("Brief Update created successfully"); cy.closeNotification(); // Verify the card content From 02fc708f056770f535a2c8ec1825da256d5cda69 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 22:08:21 +0530 Subject: [PATCH 39/83] Facility Homepage cy.wait --- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 6f01baac714..7c60438386b 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -174,7 +174,7 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); - cy.wait(2000); + facilityHome.assertFacilityInCard(facilityName); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); From d9b8539367ba7fc6cc3eed80a4e8aba0ef665547 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 23:20:49 +0530 Subject: [PATCH 40/83] Facility Homepage cy.wait --- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 7c60438386b..6f01baac714 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -174,7 +174,7 @@ describe("Facility Homepage Function", () => { facilityNotify.verifyPostNotificationReq(); cy.verifyNotification("Facility Notified"); cy.closeNotification(); - facilityHome.assertFacilityInCard(facilityName); + cy.wait(2000); // Verify the frontend error on empty message facilityHome.clickFacilityNotifyButton(); facilityNotify.verifyFacilityName(facilityName); From 5e844f921cd7fea0a06e7f062445dd97e74da32e Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 23:38:22 +0530 Subject: [PATCH 41/83] Patient Doctor Notes, File Upload cy.wait --- cypress/e2e/patient_spec/PatientHomepage.cy.ts | 6 +++++- cypress/pageobject/Patient/PatientDoctorNotes.ts | 3 ++- cypress/pageobject/Patient/PatientFileupload.ts | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index a120e282a2d..030697951e4 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -164,8 +164,12 @@ describe("Patient Homepage present functionalities", () => { .invoke("text") .then((patientOne: string) => { firstPatientPageOne = patientOne.trim(); + cy.intercept( + "GET", + "/api/v1/patient/?page=1&limit=12&is_active=True&offset=0", + ).as("getPatientPage"); pageNavigation.navigateToNextPage(); - cy.wait(2000); + cy.wait("@getPatientPage").its("response.statusCode").should("eq", 200); pageNavigation.verifyCurrentPageNumber(2); cy.get('[data-cy="patient"]') .first() diff --git a/cypress/pageobject/Patient/PatientDoctorNotes.ts b/cypress/pageobject/Patient/PatientDoctorNotes.ts index 5eac457fe8c..f1ac6b87bc5 100644 --- a/cypress/pageobject/Patient/PatientDoctorNotes.ts +++ b/cypress/pageobject/Patient/PatientDoctorNotes.ts @@ -5,14 +5,15 @@ export class PatientDoctorNotes { } addDiscussionNotes(notes: string) { - cy.wait(3000); cy.get("#discussion_notes_textarea").scrollIntoView(); cy.get("#discussion_notes_textarea").click().type(notes); } selectNurseDiscussion() { cy.get("#patient-note-tab-Nurses").scrollIntoView(); + cy.intercept("GET", "/api/v1/patient/*/notes/*").as("getPatientNotes"); cy.get("#patient-note-tab-Nurses").click(); + cy.wait("@getPatientNotes").its("response.statusCode").should("eq", 200); } verifyDiscussionMessage(text: string) { diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 140d5ca993b..96d48d8e38b 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -35,8 +35,7 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { - cy.wait(2000); - cy.get("#file-div").scrollIntoView(); + cy.get("#file-div").should("be.visible").scrollIntoView(); cy.verifyContentPresence("#file-div", [fileName]); } From 943bb79144892c71abfda32e06619ba30acb5184 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 7 Dec 2024 23:42:30 +0530 Subject: [PATCH 42/83] Patient Registration cy.waits --- cypress/pageobject/Patient/PatientCreation.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 743cd1a8772..259f6083f4e 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -91,11 +91,15 @@ export class PatientPage { } clickPatientAntenatalStatusYes() { - cy.get("#is_antenatal-option-true").should("be.visible").click(); + cy.get("#is_antenatal-option-true", { timeout: 2000 }) + .should("be.visible") + .click(); } clickPatientPostPartumStatusYes() { - cy.get("#is_postpartum-option-true").should("be.visible").click(); + cy.get("#is_postpartum-option-true", { timeout: 2000 }) + .should("be.visible") + .click(); } clickCancelButton() { From 582e982601c2377a1198b9a3360ca8473d5f6973 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 00:07:19 +0530 Subject: [PATCH 43/83] Patient File Upload cy.wait --- cypress/e2e/patient_spec/PatientHomepage.cy.ts | 2 +- cypress/pageobject/Patient/PatientCreation.ts | 4 ++-- cypress/pageobject/Patient/PatientFileupload.ts | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index 030697951e4..fdea62e6600 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -166,7 +166,7 @@ describe("Patient Homepage present functionalities", () => { firstPatientPageOne = patientOne.trim(); cy.intercept( "GET", - "/api/v1/patient/?page=1&limit=12&is_active=True&offset=0", + "/api/v1/patient/?page=2&limit=12&is_active=True&offset=0", ).as("getPatientPage"); pageNavigation.navigateToNextPage(); cy.wait("@getPatientPage").its("response.statusCode").should("eq", 200); diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 259f6083f4e..16fb93ca27f 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -91,13 +91,13 @@ export class PatientPage { } clickPatientAntenatalStatusYes() { - cy.get("#is_antenatal-option-true", { timeout: 2000 }) + cy.get("#is_antenatal-option-true", { timeout: 3000 }) .should("be.visible") .click(); } clickPatientPostPartumStatusYes() { - cy.get("#is_postpartum-option-true", { timeout: 2000 }) + cy.get("#is_postpartum-option-true", { timeout: 3000 }) .should("be.visible") .click(); } diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 96d48d8e38b..fdc188bff27 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -35,7 +35,11 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { + cy.intercept("GET", "**/api/v1/files/?file_type=CONSULTATION*").as( + "getFiles", + ); cy.get("#file-div").should("be.visible").scrollIntoView(); + cy.wait("@getFiles").its("response.statusCode").should("eq", 200); cy.verifyContentPresence("#file-div", [fileName]); } From a6f2bf16e9c355854fc30c4455a77667ad641dc0 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 00:36:06 +0530 Subject: [PATCH 44/83] Patient File Upload cy.wait --- .../e2e/patient_spec/PatientHomepage.cy.ts | 2 +- cypress/pageobject/Patient/PatientCreation.ts | 43 ++++++++++--------- .../pageobject/Patient/PatientFileupload.ts | 6 +-- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index fdea62e6600..ab9b5eec566 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -166,7 +166,7 @@ describe("Patient Homepage present functionalities", () => { firstPatientPageOne = patientOne.trim(); cy.intercept( "GET", - "/api/v1/patient/?page=2&limit=12&is_active=True&offset=0", + "/api/v1/patient/?page=2&limit=12&is_active=True&offset=12", ).as("getPatientPage"); pageNavigation.navigateToNextPage(); cy.wait("@getPatientPage").its("response.statusCode").should("eq", 200); diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 16fb93ca27f..5cfdd7116b6 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -182,26 +182,29 @@ export class PatientPage { isPostPartum = false, ) { cy.url().should("include", "/facility/"); - cy.get("[data-testid=patient-dashboard]").then(($dashboard) => { - expect($dashboard).to.contain(gender); - expect($dashboard).to.contain(age); - expect($dashboard).to.contain(patientName); - expect($dashboard).to.contain(phoneNumber); - expect($dashboard).to.contain(emergencyPhoneNumber); - //expect($dashboard).to.contain(yearOfBirth); //Commented out because new proposed UI does not have DOB. Can change later. - expect($dashboard).to.contain(bloodGroup); - expect($dashboard).to.contain(occupation); - socioeconomicStatus && expect($dashboard).to.contain(socioeconomicStatus); - domesticHealthcareSupport && - expect($dashboard).to.contain(domesticHealthcareSupport); - - if (isAntenatal) { - expect($dashboard).to.contain("Antenatal"); - } - if (isPostPartum) { - expect($dashboard).to.contain("Post-partum"); - } - }); + cy.get("[data-testid=patient-dashboard]") + .should("be.visible") + .then(($dashboard) => { + expect($dashboard).to.contain(gender); + expect($dashboard).to.contain(age); + expect($dashboard).to.contain(patientName); + expect($dashboard).to.contain(phoneNumber); + expect($dashboard).to.contain(emergencyPhoneNumber); + //expect($dashboard).to.contain(yearOfBirth); //Commented out because new proposed UI does not have DOB. Can change later. + expect($dashboard).to.contain(bloodGroup); + expect($dashboard).to.contain(occupation); + socioeconomicStatus && + expect($dashboard).to.contain(socioeconomicStatus); + domesticHealthcareSupport && + expect($dashboard).to.contain(domesticHealthcareSupport); + + if (isAntenatal) { + expect($dashboard).to.contain("Antenatal"); + } + if (isPostPartum) { + expect($dashboard).to.contain("Post-partum"); + } + }); } verifyPatientLocationDetails( diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index fdc188bff27..9f22e95c5ee 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -35,11 +35,7 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { - cy.intercept("GET", "**/api/v1/files/?file_type=CONSULTATION*").as( - "getFiles", - ); cy.get("#file-div").should("be.visible").scrollIntoView(); - cy.wait("@getFiles").its("response.statusCode").should("eq", 200); cy.verifyContentPresence("#file-div", [fileName]); } @@ -52,8 +48,10 @@ export class PatientFileUpload { clickUploadFile() { cy.intercept("POST", "**/api/v1/files/").as("uploadFile"); + cy.intercept("GET", "**/api/v1/files/**").as("getFiles"); cy.get("#upload_file_button").click(); cy.wait("@uploadFile").its("response.statusCode").should("eq", 201); + cy.wait("@getFiles").its("response.statusCode").should("eq", 200); } archiveFile() { From c88bce85d9cb21fcb8a80837d3657490e6f037ce Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 09:29:53 +0530 Subject: [PATCH 45/83] Patient File Upload cy.wait --- cypress/pageobject/Patient/PatientFileupload.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 9f22e95c5ee..fe8e749ebe6 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -92,7 +92,9 @@ export class PatientFileUpload { clickSaveFileName() { cy.intercept("PATCH", "**/api/v1/files/**").as("saveFileName"); + cy.intercept("GET", "**/api/v1/files/**").as("getFiles"); cy.clickSubmitButton("Proceed"); cy.wait("@saveFileName").its("response.statusCode").should("eq", 200); + cy.wait("@getFiles").its("response.statusCode").should("eq", 200); } } From 18f1ccd438ff9d41efc8ec1443e849b8d019ca44 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 10:38:06 +0530 Subject: [PATCH 46/83] Patient Registration wait --- cypress/pageobject/Patient/PatientCreation.ts | 4 ++-- cypress/pageobject/Patient/PatientFileupload.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 5cfdd7116b6..6e6f6365e9d 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -91,13 +91,13 @@ export class PatientPage { } clickPatientAntenatalStatusYes() { - cy.get("#is_antenatal-option-true", { timeout: 3000 }) + cy.get("#is_antenatal-option-true", { timeout: 10000 }) .should("be.visible") .click(); } clickPatientPostPartumStatusYes() { - cy.get("#is_postpartum-option-true", { timeout: 3000 }) + cy.get("#is_postpartum-option-true", { timeout: 10000 }) .should("be.visible") .click(); } diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index fe8e749ebe6..9f22e95c5ee 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -92,9 +92,7 @@ export class PatientFileUpload { clickSaveFileName() { cy.intercept("PATCH", "**/api/v1/files/**").as("saveFileName"); - cy.intercept("GET", "**/api/v1/files/**").as("getFiles"); cy.clickSubmitButton("Proceed"); cy.wait("@saveFileName").its("response.statusCode").should("eq", 200); - cy.wait("@getFiles").its("response.statusCode").should("eq", 200); } } From 48eb1a1f7320417f93762f04d7d2defc2ec6adda Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 10:58:03 +0530 Subject: [PATCH 47/83] Patient Registration Edit Button --- cypress/pageobject/Patient/PatientCreation.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 6e6f6365e9d..13c0a343171 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -91,15 +91,11 @@ export class PatientPage { } clickPatientAntenatalStatusYes() { - cy.get("#is_antenatal-option-true", { timeout: 10000 }) - .should("be.visible") - .click(); + cy.get("#is_antenatal-option-true").click(); } clickPatientPostPartumStatusYes() { - cy.get("#is_postpartum-option-true", { timeout: 10000 }) - .should("be.visible") - .click(); + cy.get("#is_postpartum-option-true").click(); } clickCancelButton() { From 2c0082920283e766015ca3d9b073b86efb4cc895 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 11:11:51 +0530 Subject: [PATCH 48/83] Patient Edit details --- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 1 + cypress/pageobject/Patient/PatientFileupload.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index e940fcb67f7..7a881eaaec9 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -155,6 +155,7 @@ describe("Patient Creation with consultation", () => { patientPage.visitUpdatePatientUrl(); patientPage.verifyStatusCode(); patientPage.patientformvisibility(); + cy.wait(3000); // change the gender to female and input data to related changed field patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 9f22e95c5ee..de274e7572b 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -35,6 +35,7 @@ export class PatientFileUpload { } verifyUploadFilePresence(fileName: string) { + cy.wait(2000); cy.get("#file-div").should("be.visible").scrollIntoView(); cy.verifyContentPresence("#file-div", [fileName]); } From 29906d219014b76a776d292e262e7ba9dd7a42e3 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 11:24:16 +0530 Subject: [PATCH 49/83] Patient File Upload with waits --- cypress/pageobject/Patient/PatientFileupload.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index de274e7572b..7495fb29f9a 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -49,10 +49,8 @@ export class PatientFileUpload { clickUploadFile() { cy.intercept("POST", "**/api/v1/files/").as("uploadFile"); - cy.intercept("GET", "**/api/v1/files/**").as("getFiles"); cy.get("#upload_file_button").click(); cy.wait("@uploadFile").its("response.statusCode").should("eq", 201); - cy.wait("@getFiles").its("response.statusCode").should("eq", 200); } archiveFile() { From 1099d9aa318d6f752b863963dc9050739365f621 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 8 Dec 2024 11:34:54 +0530 Subject: [PATCH 50/83] Patient File Upload with waits --- cypress/pageobject/Patient/PatientFileupload.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 7495fb29f9a..140d5ca993b 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -36,7 +36,7 @@ export class PatientFileUpload { verifyUploadFilePresence(fileName: string) { cy.wait(2000); - cy.get("#file-div").should("be.visible").scrollIntoView(); + cy.get("#file-div").scrollIntoView(); cy.verifyContentPresence("#file-div", [fileName]); } From 1ccab9c92cd6ba9a277b64e38a47e4521736bb2c Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 11 Dec 2024 09:49:09 +0530 Subject: [PATCH 51/83] Reusable functions for intercepts in cypress testcases --- .../e2e/facility_spec/FacilityInventory.cy.ts | 12 ++--- .../PatientConsultationCreation.cy.ts | 10 ++-- .../PatientConsultationDischarge.cy.ts | 12 +++-- .../e2e/patient_spec/PatientHomepage.cy.ts | 7 +-- .../e2e/patient_spec/PatientLogUpdate.cy.ts | 40 ++++++-------- .../patient_spec/PatientRegistration.cy.ts | 4 +- cypress/e2e/users_spec/UsersCreation.cy.ts | 8 +-- .../pageobject/Facility/FacilityCreation.ts | 20 ++++++- .../pageobject/Patient/PatientConsultation.ts | 8 +++ cypress/pageobject/Patient/PatientCreation.ts | 8 +++ .../pageobject/Patient/PatientDischarge.ts | 10 ++++ .../pageobject/Patient/PatientLogupdate.ts | 52 ++++++++++++------- .../pageobject/Patient/PatientPrescription.ts | 10 ++++ cypress/pageobject/Users/UserCreation.ts | 8 +++ cypress/pageobject/Users/UserProfilePage.ts | 8 +++ cypress/pageobject/utils/paginationHelpers.ts | 11 ++++ 16 files changed, 157 insertions(+), 71 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityInventory.cy.ts b/cypress/e2e/facility_spec/FacilityInventory.cy.ts index 56ae04ae76a..b79998fd5cd 100644 --- a/cypress/e2e/facility_spec/FacilityInventory.cy.ts +++ b/cypress/e2e/facility_spec/FacilityInventory.cy.ts @@ -25,9 +25,9 @@ describe("Inventory Management Section", () => { it("Add New Inventory | Modify data and delete last entry ", () => { // add a new item - cy.intercept("GET", "/api/v1/items/**").as("getItems"); + facilityPage.interceptManageInventoryItem(); facilityPage.clickManageInventory(); - cy.wait("@getItems").its("response.statusCode").should("eq", 200); + facilityPage.verifyManageInventoryItem(); facilityPage.fillInventoryDetails("PPE", "Add Stock", "10"); facilityPage.clickAddInventory(); facilityPage.verifySuccessNotification("Inventory created successfully"); @@ -61,12 +61,10 @@ describe("Inventory Management Section", () => { cy.closeNotification(); // Verify Backend minimum badge facilityPage.verifyBadgeWithText(".badge-danger", "Low Stock"); - cy.intercept("GET", "**/api/v1/facility/*/min_quantity/**").as( - "getMinQuantity", - ); + facilityPage.interceptMinimumQuantity(); // modify with manual minimum badge - facilityPage.clickAddMinimumQuanitity(); - cy.wait("@getMinQuantity").its("response.statusCode").should("eq", 200); + facilityPage.clickAddMinimumQuantity(); + facilityPage.verifyMinimumQuantity(); cy.get("body").then(($body) => { if ($body.find("#update-minimum-quantity").is(":visible")) { // If the 'update-minimum-quantity' element is visible, click it diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index c1e4d7e00d5..eaccdb2a6d0 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -104,11 +104,9 @@ describe("Patient Consultation in multiple combination", () => { patientPrescription.selectMedicine(medicineOne); patientPrescription.enterDosage("3"); patientPrescription.selectDosageFrequency("Twice daily"); - cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/*").as( - "getPrescriptions", - ); + patientPrescription.interceptPrescriptions(); cy.clickSubmitButton("Submit"); - cy.wait("@getPrescriptions").its("response.statusCode").should("eq", 200); + patientPrescription.verifyPrescription(); cy.verifyNotification("Medicine prescribed"); patientPrescription.clickReturnToDashboard(); // Verify the data's across the dashboard @@ -379,9 +377,9 @@ describe("Patient Consultation in multiple combination", () => { it("Edit created consultation to existing patient", () => { patientPage.visitPatient("Dummy Patient Thirteen"); - cy.intercept("GET", "**/api/v1/consultation/*").as("getConsultation"); + patientConsultationPage.interceptConsultation(); patientConsultationPage.clickEditConsultationButton(); - cy.wait("@getConsultation").its("response.statusCode").should("eq", 200); + patientConsultationPage.verifyConsultation(); patientConsultationPage.typePatientIllnessHistory("editted"); patientConsultationPage.selectPatientDiagnosis( diagnosis5, diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index 85cd43a168f..adcec153fb7 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -35,7 +35,9 @@ describe("Patient Discharge based on multiple reason", () => { patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason4); cy.clickSubmitButton("Confirm Discharge"); + patientDischarge.interceptDischargePatient(); cy.clickSubmitButton("Acknowledge & Submit"); + patientDischarge.verifyDischargePatient(); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -53,7 +55,9 @@ describe("Patient Discharge based on multiple reason", () => { patientDischarge.typeDischargeNote(patientDeathCause); patientDischarge.typeDoctorName(doctorName); cy.clickSubmitButton("Confirm Discharge"); + patientDischarge.interceptDischargePatient(); cy.clickSubmitButton("Acknowledge & Submit"); + patientDischarge.verifyDischargePatient(); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -77,7 +81,9 @@ describe("Patient Discharge based on multiple reason", () => { // select a non-registered facility and perform the discharge patientDischarge.typeReferringFacility(referringFreetextFacility); cy.clickSubmitButton("Confirm Discharge"); + patientDischarge.interceptDischargePatient(); cy.clickSubmitButton("Acknowledge & Submit"); + patientDischarge.verifyDischargePatient(); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection @@ -107,12 +113,10 @@ describe("Patient Discharge based on multiple reason", () => { cy.closeNotification(); // submit the discharge pop-up cy.clickSubmitButton("Confirm Discharge"); - cy.intercept("POST", "**/api/v1/consultation/*/discharge_patient/").as( - "postDischarge", - ); + patientDischarge.interceptDischargePatient(); cy.clickSubmitButton("Acknowledge & Submit"); - cy.wait("@postDischarge").its("response.statusCode").should("eq", 200); cy.verifyNotification("Patient Discharged Successfully"); + patientDischarge.verifyDischargePatient(); cy.closeNotification(); // Verify the consultation dashboard reflection cy.verifyContentPresence("#consultation-buttons", ["Recovered"]); diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index ab9b5eec566..1f1bc101636 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -164,12 +164,9 @@ describe("Patient Homepage present functionalities", () => { .invoke("text") .then((patientOne: string) => { firstPatientPageOne = patientOne.trim(); - cy.intercept( - "GET", - "/api/v1/patient/?page=2&limit=12&is_active=True&offset=12", - ).as("getPatientPage"); + pageNavigation.interceptPatientNavigation(); pageNavigation.navigateToNextPage(); - cy.wait("@getPatientPage").its("response.statusCode").should("eq", 200); + pageNavigation.verifyPatientNavigation(); pageNavigation.verifyCurrentPageNumber(2); cy.get('[data-cy="patient"]') .first() diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 767c1dd4a08..f141df14253 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -58,9 +58,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.closeNotification(); - cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); + patientPage.interceptgetPatient(); patientLogupdate.clickLogupdate(); - cy.wait("@getPatient").its("response.statusCode").should("eq", 200); + patientPage.verifygetPatientResponse(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectRoundType("Tele-medicine Log"); patientLogupdate.selectPatientCategory(patientCategory); @@ -82,15 +82,15 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { it("Create a new Progress log update for a admitted patient and edit it", () => { patientPage.visitPatient(patientOne); - cy.intercept("GET", "**/api/v1/consultationbed/*").as("getBed"); + patientLogupdate.interceptConsultationBed(); patientLogupdate.clickLogupdate(); - cy.wait("@getBed").its("response.statusCode").should("eq", 200); + patientLogupdate.verifyConsultationBed(); cy.verifyNotification("Please assign a bed to the patient"); patientLogupdate.selectBed(bedOne); cy.closeNotification(); - cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); + patientPage.interceptgetPatient(); patientLogupdate.clickLogupdate(); - cy.wait("@getPatient").its("response.statusCode").should("eq", 200); + patientPage.verifygetPatientResponse(); // Only will be using random non-unique progress note fields patientLogupdate.selectRoundType("Progress Note"); patientLogupdate.selectPatientCategory(patientCategory); @@ -118,22 +118,18 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); // Submit the doctors log update - cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( - "getDailyRounds", - ); + patientLogupdate.interceptDailyRounds(); cy.clickSubmitButton("Save and Continue"); - cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 200); + patientLogupdate.verifyDailyRounds(); cy.verifyNotification("Progress Note created successfully"); cy.closeNotification(); // modify the relevant critical care log update patientLogupdate.selectCriticalCareSection("Neurological Monitoring"); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); cy.get("#left_pupil_light_reaction-option-FIXED").click(); - cy.intercept("PATCH", "**/api/v1/consultation/*/daily_rounds/*/").as( - "patchDailyRounds", - ); + patientLogupdate.interceptpatchDailyRounds(); cy.clickSubmitButton("Update Details"); - cy.wait("@patchDailyRounds").its("response.statusCode").should("eq", 200); + patientLogupdate.verifypatchDailyRounds(); cy.verifyNotification( "Neurological Monitoring details succesfully updated.", ); @@ -169,11 +165,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickLogupdate(); patientLogupdate.selectRoundType("Detailed Update"); patientLogupdate.selectPatientCategory(patientCategory); - cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( - "getDailyRounds", - ); + patientLogupdate.interceptDailyRounds(); cy.clickSubmitButton("Save and Continue"); - cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 200); + patientLogupdate.verifyDailyRounds(); cy.verifyNotification("Detailed Update created successfully"); cy.closeNotification(); // Select two Section - First One is Respiratory Support @@ -252,11 +246,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Please assign a bed to the patient"); patientLogupdate.selectBed(bedThree); cy.closeNotification(); - cy.intercept("GET", "**/api/v1/patient/*").as("getAdmissionPatient"); + patientPage.interceptgetPatient(); patientLogupdate.clickLogupdate(); - cy.wait("@getAdmissionPatient") - .its("response.statusCode") - .should("eq", 200); + patientPage.verifygetPatientResponse(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeOtherDetails(otherExamination); @@ -272,9 +264,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.selectRhythm(patientRhythmType); patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click(); - cy.intercept("GET", "**/api/v1/consultation/*/").as("getConsultation"); + patientConsultationPage.interceptConsultation(); cy.clickSubmitButton("Save"); - cy.wait("@getConsultation").its("response.statusCode").should("eq", 200); + patientConsultationPage.verifyConsultation(); cy.verifyNotification("Brief Update created successfully"); cy.closeNotification(); // Verify the card content diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 7a881eaaec9..3a719c61845 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -198,9 +198,9 @@ describe("Patient Creation with consultation", () => { ); patientPage.clickUpdatePatient(); patientPage.verifyPatientUpdated(); - cy.intercept("GET", "**/api/v1/patient/*/").as("getPatient"); + patientPage.interceptgetPatient(); patientPage.visitPatientUrl(); - cy.wait("@getPatient").its("response.statusCode").should("eq", 200); + patientPage.verifygetPatientResponse(); // Verify Female Gender change reflection, No Medical History and Insurance Details patientPage.verifyPatientDashboardDetails( patientOneUpdatedGender, diff --git a/cypress/e2e/users_spec/UsersCreation.cy.ts b/cypress/e2e/users_spec/UsersCreation.cy.ts index 947d5b6ce87..bc34d57fa63 100644 --- a/cypress/e2e/users_spec/UsersCreation.cy.ts +++ b/cypress/e2e/users_spec/UsersCreation.cy.ts @@ -108,9 +108,9 @@ describe("User Creation", () => { userProfilePage.clearWorkingHours(); userProfilePage.typeWorkingHours(weeklyWorkingHrs); userProfilePage.typeDateOfBirth(dob); - cy.intercept("PATCH", "/api/v1/users/*").as("updateUser"); + userProfilePage.interceptUpdateUsers(); userProfilePage.clickUpdateButton(); - cy.wait("@updateUser").its("response.statusCode").should("eq", 200); + userProfilePage.verifyUpdateUsersResponse(); cy.verifyContentPresence("#contactno-profile-details", [ "+91" + phoneNumber, ]); @@ -158,9 +158,9 @@ describe("User Creation", () => { userCreationPage.selectGender(gender); userCreationPage.selectState(state); userCreationPage.selectDistrict(district); - cy.intercept("POST", "/api/v1/users/add_user/").as("createUser"); + userCreationPage.interceptCreateUser(); userCreationPage.clickSaveUserButton(); - cy.wait("@createUser").its("response.statusCode").should("eq", 201); + userCreationPage.verifyCreateUser(); cy.verifyNotification("User added successfully"); userPage.typeInSearchInput(username); userPage.checkUsernameText(username); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index caf4d4ef4ea..cd890468bc0 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -321,10 +321,18 @@ class FacilityPage { cy.url().should("include", "/assets?facility="); } + interceptManageInventoryItem() { + cy.intercept("GET", "/api/v1/items/**").as("getItems"); + } + clickManageInventory() { cy.contains("Manage Inventory").click(); } + verifyManageInventoryItem() { + cy.wait("@getItems").its("response.statusCode").should("eq", 200); + } + fillInventoryDetails(name: string, status: string, quantity: string) { cy.get("div#isIncoming").click(); cy.get("div#isIncoming ul li").contains(status).click(); @@ -435,10 +443,20 @@ class FacilityPage { cy.get(badgeClass).contains(text).should("exist"); } - clickAddMinimumQuanitity() { + interceptMinimumQuantity() { + cy.intercept("GET", "**/api/v1/facility/*/min_quantity/**").as( + "getMinQuantity", + ); + } + + clickAddMinimumQuantity() { cy.get("#add-minimum-quantity").click(); } + verifyMinimumQuantity() { + cy.wait("@getMinQuantity").its("response.statusCode").should("eq", 200); + } + clickUpdateMinimumQuantity() { cy.get("#update-minimum-quantity").first().click(); } diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 3bdf63aa670..8ef4554277f 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -111,6 +111,14 @@ export class PatientConsultationPage { ); } + interceptConsultation() { + cy.intercept("GET", "**/api/v1/consultation/*").as("getConsultation"); + } + + verifyConsultation() { + cy.wait("@getConsultation").its("response.statusCode").should("eq", 200); + } + interceptPatientDetailsAPI(): void { cy.intercept("GET", "**/api/v1/patient/**").as("patientDetails"); } diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index 13c0a343171..def06eee3d2 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -155,6 +155,14 @@ export class PatientPage { cy.wait("@updatePatient").its("response.statusCode").should("eq", 200); } + interceptgetPatient() { + cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); + } + + verifygetPatientResponse() { + cy.wait("@getPatient").its("response.statusCode").should("eq", 200); + } + verifyPatientUpdated() { cy.url().should("include", "/patient"); } diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index 89f3844fbac..58805255088 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -36,6 +36,16 @@ class PatientDischarge { typeDoctorName(doctorName: string) { cy.get("#death_confirmed_by").type(doctorName); } + + interceptDischargePatient() { + cy.intercept("POST", "**/api/v1/consultation/*/discharge_patient/").as( + "postDischarge", + ); + } + + verifyDischargePatient() { + cy.wait("@postDischarge").its("response.statusCode").should("eq", 200); + } } export default PatientDischarge; diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 2f550317614..bbe7c157e15 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -4,6 +4,14 @@ class PatientLogupdate { cy.verifyAndClickElement("#log-update", "Log Update"); } + interceptConsultationBed() { + cy.intercept("GET", "**/api/v1/consultationbed/*").as("getBed"); + } + + verifyConsultationBed() { + cy.wait("@getBed").its("response.statusCode").should("eq", 200); + } + clickSwitchBed() { cy.get("#switch-bed").click(); } @@ -78,38 +86,46 @@ class PatientLogupdate { cy.get("#rhythm_detail").click().type(rhythm); } + interceptDailyRounds() { + cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( + "getDailyRounds", + ); + } + + verifyDailyRounds() { + cy.wait("@getDailyRounds").its("response.statusCode").should("eq", 200); + } + + interceptpatchDailyRounds() { + cy.intercept("PATCH", "**/api/v1/consultation/*/daily_rounds/*/").as( + "patchDailyRounds", + ); + } + + verifypatchDailyRounds() { + cy.wait("@patchDailyRounds").its("response.statusCode").should("eq", 200); + } + clickLogUpdateViewDetails(element: string, patientCategory: string) { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); - cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( - "getLogUpdateViewDetails", - ); + this.interceptDailyRounds(); cy.get(element).first().contains("View Details").click(); - cy.wait("@getLogUpdateViewDetails") - .its("response.statusCode") - .should("eq", 200); + this.verifyDailyRounds(); } clickLogUpdateUpdateLog(element: string, patientCategory: string) { cy.get(element).scrollIntoView(); cy.verifyContentPresence(element, [patientCategory]); - cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( - "getLogUpdateViewDetails", - ); + this.interceptDailyRounds(); cy.get(element).first().contains("Update Log").click(); - cy.wait("@getLogUpdateViewDetails") - .its("response.statusCode") - .should("eq", 200); + this.verifyDailyRounds(); } clickUpdateDetail() { - cy.intercept("GET", "**/api/v1/consultation/*/daily_rounds/*/").as( - "getLogUpdateViewDetails", - ); + this.interceptDailyRounds(); cy.verifyAndClickElement("#consultation-preview", "Update Log"); - cy.wait("@getLogUpdateViewDetails") - .its("response.statusCode") - .should("eq", 200); + this.verifyDailyRounds(); } clearIntoElementById(elementId) { diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts index 4c8e43a6145..89b14efc7b7 100644 --- a/cypress/pageobject/Patient/PatientPrescription.ts +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -80,6 +80,16 @@ export class PatientPrescription { cy.clickAndSelectOption("#frequency", frequency); } + interceptPrescriptions() { + cy.intercept("GET", "**/api/v1/consultation/*/prescriptions/*").as( + "getPrescriptions", + ); + } + + verifyPrescription() { + cy.wait("@getPrescriptions").its("response.statusCode").should("eq", 200); + } + clickReturnToDashboard() { cy.verifyAndClickElement( "[data-testid='return-to-patient-dashboard']", diff --git a/cypress/pageobject/Users/UserCreation.ts b/cypress/pageobject/Users/UserCreation.ts index d8d386402b7..83acbc8a1f0 100644 --- a/cypress/pageobject/Users/UserCreation.ts +++ b/cypress/pageobject/Users/UserCreation.ts @@ -48,4 +48,12 @@ export class UserCreationPage { clickSaveUserButton() { cy.clickSubmitButton("Save User"); } + + interceptCreateUser() { + cy.intercept("POST", "/api/v1/users/add_user/").as("createUser"); + } + + verifyCreateUser() { + cy.wait("@createUser").its("response.statusCode").should("eq", 201); + } } diff --git a/cypress/pageobject/Users/UserProfilePage.ts b/cypress/pageobject/Users/UserProfilePage.ts index 882be0b7b9b..50959bb7cf7 100644 --- a/cypress/pageobject/Users/UserProfilePage.ts +++ b/cypress/pageobject/Users/UserProfilePage.ts @@ -11,6 +11,14 @@ export default class UserProfilePage { cy.get("#video_connect_link").click().clear().type(link); } + interceptUpdateUsers() { + cy.intercept("PATCH", "/api/v1/users/*").as("updateUser"); + } + + verifyUpdateUsersResponse() { + cy.wait("@updateUser").its("response.statusCode").should("eq", 200); + } + clickUpdateButton() { cy.clickSubmitButton("Update"); } diff --git a/cypress/pageobject/utils/paginationHelpers.ts b/cypress/pageobject/utils/paginationHelpers.ts index edbabec5523..710dcebed82 100644 --- a/cypress/pageobject/utils/paginationHelpers.ts +++ b/cypress/pageobject/utils/paginationHelpers.ts @@ -10,4 +10,15 @@ export const pageNavigation = { navigateToPreviousPage() { cy.get("button#prev-pages").click(); }, + + interceptPatientNavigation() { + cy.intercept( + "GET", + "/api/v1/patient/?page=2&limit=12&is_active=True&offset=12", + ).as("getPatientPage"); + }, + + verifyPatientNavigation() { + cy.wait("@getPatientPage").its("response.statusCode").should("eq", 200); + }, }; From eee4f1a90cc429ade775c08f221d410beb913ecd Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 11 Dec 2024 10:05:56 +0530 Subject: [PATCH 52/83] Reusable functions for intercepts in cypress testcases --- cypress/e2e/patient_spec/PatientLogUpdate.cy.ts | 12 ++++++------ cypress/e2e/patient_spec/PatientRegistration.cy.ts | 4 ++-- cypress/pageobject/Patient/PatientCreation.ts | 4 ++-- cypress/pageobject/utils/paginationHelpers.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index f141df14253..da46a6c093e 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -58,9 +58,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.clickSubmitButton("Update Consultation"); cy.verifyNotification("Consultation updated successfully"); cy.closeNotification(); - patientPage.interceptgetPatient(); + patientPage.interceptGetPatient(); patientLogupdate.clickLogupdate(); - patientPage.verifygetPatientResponse(); + patientPage.verifyGetPatientResponse(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectRoundType("Tele-medicine Log"); patientLogupdate.selectPatientCategory(patientCategory); @@ -88,9 +88,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Please assign a bed to the patient"); patientLogupdate.selectBed(bedOne); cy.closeNotification(); - patientPage.interceptgetPatient(); + patientPage.interceptGetPatient(); patientLogupdate.clickLogupdate(); - patientPage.verifygetPatientResponse(); + patientPage.verifyGetPatientResponse(); // Only will be using random non-unique progress note fields patientLogupdate.selectRoundType("Progress Note"); patientLogupdate.selectPatientCategory(patientCategory); @@ -246,9 +246,9 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.verifyNotification("Please assign a bed to the patient"); patientLogupdate.selectBed(bedThree); cy.closeNotification(); - patientPage.interceptgetPatient(); + patientPage.interceptGetPatient(); patientLogupdate.clickLogupdate(); - patientPage.verifygetPatientResponse(); + patientPage.verifyGetPatientResponse(); patientLogupdate.typePhysicalExamination(physicalExamination); patientLogupdate.selectPatientCategory(patientCategory); patientLogupdate.typeOtherDetails(otherExamination); diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 3a719c61845..374e5383287 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -198,9 +198,9 @@ describe("Patient Creation with consultation", () => { ); patientPage.clickUpdatePatient(); patientPage.verifyPatientUpdated(); - patientPage.interceptgetPatient(); + patientPage.interceptGetPatient(); patientPage.visitPatientUrl(); - patientPage.verifygetPatientResponse(); + patientPage.verifyGetPatientResponse(); // Verify Female Gender change reflection, No Medical History and Insurance Details patientPage.verifyPatientDashboardDetails( patientOneUpdatedGender, diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index def06eee3d2..1d59b5fa27b 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -155,11 +155,11 @@ export class PatientPage { cy.wait("@updatePatient").its("response.statusCode").should("eq", 200); } - interceptgetPatient() { + interceptGetPatient() { cy.intercept("GET", "**/api/v1/patient/*").as("getPatient"); } - verifygetPatientResponse() { + verifyGetPatientResponse() { cy.wait("@getPatient").its("response.statusCode").should("eq", 200); } diff --git a/cypress/pageobject/utils/paginationHelpers.ts b/cypress/pageobject/utils/paginationHelpers.ts index 710dcebed82..7a1e16cc261 100644 --- a/cypress/pageobject/utils/paginationHelpers.ts +++ b/cypress/pageobject/utils/paginationHelpers.ts @@ -14,7 +14,7 @@ export const pageNavigation = { interceptPatientNavigation() { cy.intercept( "GET", - "/api/v1/patient/?page=2&limit=12&is_active=True&offset=12", + "/api/v1/patient/?page=*&limit=*&is_active=True&offset=*", ).as("getPatientPage"); }, From 4dda5aac10d66c7082f6f379fe8a0d470f8210cf Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 11 Dec 2024 13:00:05 +0530 Subject: [PATCH 53/83] User Manage Test Cases updated --- cypress/pageobject/Users/ManageUserPage.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/pageobject/Users/ManageUserPage.ts b/cypress/pageobject/Users/ManageUserPage.ts index 67e7df74d23..5da0e3d2cf8 100644 --- a/cypress/pageobject/Users/ManageUserPage.ts +++ b/cypress/pageobject/Users/ManageUserPage.ts @@ -370,9 +370,7 @@ export class ManageUserPage { } clickAddSkillButton() { - cy.intercept("GET", "**/api/v1/skill/**").as("getSkills"); cy.get("#add-skill-button").click(); - cy.wait("@getSkills").its("response.statusCode").should("eq", 200); } interceptAddSkill() { From c7c035bbf282bb7abde650d813fbee9c7ae4c233 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 11 Dec 2024 13:35:44 +0530 Subject: [PATCH 54/83] UserManage test cases --- cypress/e2e/users_spec/UsersManage.cy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index e961c57f4f5..fab7a022b5e 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -293,6 +293,7 @@ describe("Manage User", () => { manageUserPage.clickProfessionalInfoViewButton(); manageUserPage.verifyQualificationDoesntExist(); manageUserPage.verifyYoeAndCouncilRegistrationDoesntExist(); + //Adding working hours manageUserPage.clickProfessionalInfoEditButton(); manageUserPage.clearProfessionalInfo(); manageUserPage.typeInWeeklyWorkingHours("200"); From d835081d758ca326a1acb39e4ee4408271c53ecd Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Wed, 11 Dec 2024 13:53:16 +0530 Subject: [PATCH 55/83] UserManage --- cypress/e2e/users_spec/UsersManage.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index fab7a022b5e..e961c57f4f5 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -293,7 +293,6 @@ describe("Manage User", () => { manageUserPage.clickProfessionalInfoViewButton(); manageUserPage.verifyQualificationDoesntExist(); manageUserPage.verifyYoeAndCouncilRegistrationDoesntExist(); - //Adding working hours manageUserPage.clickProfessionalInfoEditButton(); manageUserPage.clearProfessionalInfo(); manageUserPage.typeInWeeklyWorkingHours("200"); From 145edecf5037021bbc3307e099cb8eaeb5a6d6ce Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Thu, 12 Dec 2024 23:35:36 +0530 Subject: [PATCH 56/83] AddSkillButton with username --- cypress/e2e/users_spec/UsersManage.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/users_spec/UsersManage.cy.ts b/cypress/e2e/users_spec/UsersManage.cy.ts index 49730c8ebac..dd7e3b4dfd6 100644 --- a/cypress/e2e/users_spec/UsersManage.cy.ts +++ b/cypress/e2e/users_spec/UsersManage.cy.ts @@ -236,7 +236,7 @@ describe("Manage User", () => { manageUserPage.verifyLinkedSkillsTabPage(); manageUserPage.selectSkillFromDropdown(linkedskill); manageUserPage.interceptAddSkill(); - manageUserPage.clickAddSkillButton(); + manageUserPage.clickAddSkillButton(usernameforworkinghour); manageUserPage.verifyAddSkillResponse(); manageUserPage.assertSkillInAddedUserSkills(linkedskill); manageUserPage.navigateToProfile(); From fede9a6631a4721e540f734b4a6313c9888abdd8 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 13 Dec 2024 13:19:22 +0530 Subject: [PATCH 57/83] AssetsManage and AssetHomepage cypress tests --- cypress/e2e/assets_spec/AssetsManage.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/assets_spec/AssetsManage.cy.ts b/cypress/e2e/assets_spec/AssetsManage.cy.ts index 32dc5791bd3..6e385a2d744 100644 --- a/cypress/e2e/assets_spec/AssetsManage.cy.ts +++ b/cypress/e2e/assets_spec/AssetsManage.cy.ts @@ -105,7 +105,7 @@ describe("Asset", () => { }); it("Verify Facility Asset Page Redirection", () => { - facilityHome.navigateToFacilityHomepage(); + facilityHome.navigateToFacilityHomepage(); //Facility page facilityHome.typeFacilitySearch(fillFacilityName); advanceFilters.verifyFilterBadgePresence( "Facility/District Name", From 962d6cafa789b762cd3c2ed2293edd7640e6761d Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Fri, 13 Dec 2024 13:32:14 +0530 Subject: [PATCH 58/83] FacilityCreation cypress tests --- cypress/e2e/assets_spec/AssetsManage.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/assets_spec/AssetsManage.cy.ts b/cypress/e2e/assets_spec/AssetsManage.cy.ts index 6e385a2d744..32dc5791bd3 100644 --- a/cypress/e2e/assets_spec/AssetsManage.cy.ts +++ b/cypress/e2e/assets_spec/AssetsManage.cy.ts @@ -105,7 +105,7 @@ describe("Asset", () => { }); it("Verify Facility Asset Page Redirection", () => { - facilityHome.navigateToFacilityHomepage(); //Facility page + facilityHome.navigateToFacilityHomepage(); facilityHome.typeFacilitySearch(fillFacilityName); advanceFilters.verifyFilterBadgePresence( "Facility/District Name", From 8f0b0f2e952df86dc28d8acc4afd185f758b2aca Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 14 Dec 2024 20:13:59 +0530 Subject: [PATCH 59/83] Facility deletion test case resolve --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 5fed40ea83a..f644c9829d3 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -243,7 +243,7 @@ describe("Facility Creation", () => { facilityPage.clickManageFacilityDropdown(); facilityPage.clickDeleteFacilityOption(); facilityPage.confirmDeleteFacility(); - cy.verifyNotification(`${facilityName} deleted successfully`); + cy.verifyNotification("Facility deleted successfully"); }); it("Create a new facility with single bed and doctor capacity", () => { From c9518014e2b811b15c81115addcdf0d565c7ea8f Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sat, 14 Dec 2024 20:39:44 +0530 Subject: [PATCH 60/83] Facility creation error resolved --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 1 + cypress/pageobject/Facility/FacilityCreation.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index f644c9829d3..18f21009a92 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -183,6 +183,7 @@ describe("Facility Creation", () => { facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.fillOxygenDetails(testFacilityData.oxygen); facilityPage.submitForm(); + cy.verifyNotification("Facility added successfully"); cy.closeNotification(); // add the bed capacity facilityPage.selectBedType("Oxygen Supported Bed"); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 8e2c185b362..f44f4bc0a0b 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -89,7 +89,9 @@ class FacilityPage { } submitForm() { + cy.intercept("POST", "**/api/v1/facility/").as("postFacility"); cy.get("button#submit").click(); + cy.wait("@postFacility").its("response.statusCode").should("eq", 201); } selectBedType(bedType: string) { From edafae36d4ad45db3dc7477f0bd048dd7e4d8002 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 15 Dec 2024 11:51:03 +0530 Subject: [PATCH 61/83] fixed the cypress test --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 1 - cypress/pageobject/Facility/FacilityCreation.ts | 2 -- 2 files changed, 3 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 18f21009a92..f644c9829d3 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -183,7 +183,6 @@ describe("Facility Creation", () => { facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.fillOxygenDetails(testFacilityData.oxygen); facilityPage.submitForm(); - cy.verifyNotification("Facility added successfully"); cy.closeNotification(); // add the bed capacity facilityPage.selectBedType("Oxygen Supported Bed"); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index f44f4bc0a0b..8e2c185b362 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -89,9 +89,7 @@ class FacilityPage { } submitForm() { - cy.intercept("POST", "**/api/v1/facility/").as("postFacility"); cy.get("button#submit").click(); - cy.wait("@postFacility").its("response.statusCode").should("eq", 201); } selectBedType(bedType: string) { From dd9bc77bc919da75098b94c6de4d30fa241d4023 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 15 Dec 2024 12:10:51 +0530 Subject: [PATCH 62/83] fixed the cypress test --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index f644c9829d3..b86be84d4dc 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -183,7 +183,6 @@ describe("Facility Creation", () => { facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.fillOxygenDetails(testFacilityData.oxygen); facilityPage.submitForm(); - cy.closeNotification(); // add the bed capacity facilityPage.selectBedType("Oxygen Supported Bed"); facilityPage.fillTotalCapacity(bedCapacity); From 46607cd5b27717bfc1a437f4bf7c02e56179db82 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 15 Dec 2024 12:31:55 +0530 Subject: [PATCH 63/83] fcility creation test --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index b86be84d4dc..2123949ebf1 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -182,7 +182,8 @@ describe("Facility Creation", () => { facilityPage.fillBasicDetails(testFacilityData.basic); facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.fillOxygenDetails(testFacilityData.oxygen); - facilityPage.submitForm(); + // facilityPage.submitForm(); + cy.clickSubmitButton("Save Facility"); // add the bed capacity facilityPage.selectBedType("Oxygen Supported Bed"); facilityPage.fillTotalCapacity(bedCapacity); From 31258b837d04f99b7699cb5984cc2e7f3c8f7490 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Sun, 15 Dec 2024 12:44:57 +0530 Subject: [PATCH 64/83] fcility creation test --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 2123949ebf1..b86be84d4dc 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -182,8 +182,7 @@ describe("Facility Creation", () => { facilityPage.fillBasicDetails(testFacilityData.basic); facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.fillOxygenDetails(testFacilityData.oxygen); - // facilityPage.submitForm(); - cy.clickSubmitButton("Save Facility"); + facilityPage.submitForm(); // add the bed capacity facilityPage.selectBedType("Oxygen Supported Bed"); facilityPage.fillTotalCapacity(bedCapacity); From 9e2a124ce5d30c71345bcf0e75735589a06003fd Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 12:28:04 +0530 Subject: [PATCH 65/83] Facility creation display error --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index d2893166745..d446fe47d09 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -126,7 +126,7 @@ describe("Facility Creation with multiple user roles", () => { facilityPage.visitCreateFacilityPage(); facilityPage.clickSaveFacilityButton(); cy.verifyErrorMessages(facilityErrorMessage); - // Verify the user access based error message + // Verify the User access based error message facilityPage.fillBasicDetails(testFacilityData.basic); facilityPage.fillPincode("682001"); facilityPage.selectStateOnPincode("Kerala"); From fadca5e1d69074b365efd445c85f2738e3b048f1 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 12:38:35 +0530 Subject: [PATCH 66/83] Facility creation display error --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index d446fe47d09..d2893166745 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -126,7 +126,7 @@ describe("Facility Creation with multiple user roles", () => { facilityPage.visitCreateFacilityPage(); facilityPage.clickSaveFacilityButton(); cy.verifyErrorMessages(facilityErrorMessage); - // Verify the User access based error message + // Verify the user access based error message facilityPage.fillBasicDetails(testFacilityData.basic); facilityPage.fillPincode("682001"); facilityPage.selectStateOnPincode("Kerala"); From 13ebbee56e59b757b55e92b6c4a356811727e708 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 13:22:00 +0530 Subject: [PATCH 67/83] Facility creation display error --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 ++ cypress/pageobject/Facility/FacilityCreation.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index d2893166745..a0baf09815e 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -133,7 +133,9 @@ describe("Facility Creation with multiple user roles", () => { facilityPage.selectDistrictOnPincode("Kottayam"); facilityPage.selectLocalBody("Arpookara"); facilityPage.selectWard("5"); + facilityPage.interceptFacility(); facilityPage.clickSaveFacilityButton(); + facilityPage.verifyErrorFacility(); facilityPage.verifyErrorNotification( "You do not have permission to perform this action.", ); diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index f42effa7e0f..2ea72acc5eb 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -63,6 +63,14 @@ class FacilityPage { cy.verifyAndClickElement("#submit", "Save Facility"); } + interceptFacility() { + cy.intercept("POST", "**/api/v1/facility/").as("postFacility"); + } + + verifyErrorFacility() { + cy.wait("@postFacility").its("response.statusCode").should("eq", 403); + } + verifyFacilityCreatedNotification() { cy.verifyNotification("Facility added successfully"); cy.closeNotification(); From 1a63161a3f3b55b2c2c80d62aa3748e9e4cefab3 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 13:36:14 +0530 Subject: [PATCH 68/83] Patient Discharge recovered test case --- cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index adcec153fb7..50af6052581 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -115,8 +115,8 @@ describe("Patient Discharge based on multiple reason", () => { cy.clickSubmitButton("Confirm Discharge"); patientDischarge.interceptDischargePatient(); cy.clickSubmitButton("Acknowledge & Submit"); - cy.verifyNotification("Patient Discharged Successfully"); patientDischarge.verifyDischargePatient(); + cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); // Verify the consultation dashboard reflection cy.verifyContentPresence("#consultation-buttons", ["Recovered"]); From 68830a8419470de5730417bcdf7b3b63e1e71fec Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 14:40:24 +0530 Subject: [PATCH 69/83] Facility Homepage bed capacity test case --- cypress/e2e/facility_spec/FacilityHomepage.cy.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 0aa8518a6d1..c43106ba869 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -196,7 +196,9 @@ describe("Facility Homepage Function", () => { }); it("Verify the bed capacity badge reflection", () => { + facilityHome.interceptFacilitySearchReq(); facilityHome.typeFacilitySearch(facilityWithNoAvailableBeds); + facilityHome.verifyFacilitySearchReq(); facilityHome.assertFacilityInCard(facilityWithNoAvailableBeds); cy.url().then((url) => { const facilityUrl = url.toString(); From 035370be7dcf5ff0e3f412bf75df9c0f411183ee Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 16:19:02 +0530 Subject: [PATCH 70/83] Facility Creation test cases --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 ++ cypress/pageobject/Facility/FacilityCreation.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index a0baf09815e..f3c0e52f14d 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -77,7 +77,9 @@ describe("Facility Creation with multiple user roles", () => { }); facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.selectLocation("Kochi, Kerala"); + facilityPage.interceptFacility(); facilityPage.clickSaveFacilityButton(); + facilityPage.verifyFacilityRes(); facilityPage.verifyFacilityCreatedNotification(); // verify the facility card info cy.verifyContentPresence("#facility-details-card", [ diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 2ea72acc5eb..daf5bf7a131 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -67,6 +67,10 @@ class FacilityPage { cy.intercept("POST", "**/api/v1/facility/").as("postFacility"); } + verifyFacilityRes() { + cy.wait("@postFacility").its("response.statusCode").should("eq", 401); + } + verifyErrorFacility() { cy.wait("@postFacility").its("response.statusCode").should("eq", 403); } From ff719a6da2da05dc5b7f3ee2c290724dd8485f91 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 16:47:44 +0530 Subject: [PATCH 71/83] Facility Creation test cases --- cypress/pageobject/Facility/FacilityCreation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index daf5bf7a131..1fab563d30e 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -68,7 +68,7 @@ class FacilityPage { } verifyFacilityRes() { - cy.wait("@postFacility").its("response.statusCode").should("eq", 401); + cy.wait("@postFacility").its("response.statusCode").should("eq", 201); } verifyErrorFacility() { From 75936d7745219c94ff7bb33323fe31cd22bfe728 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 17:00:51 +0530 Subject: [PATCH 72/83] Facility Creation test cases --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 -- cypress/pageobject/Facility/FacilityCreation.ts | 4 ---- 2 files changed, 6 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index f3c0e52f14d..a0baf09815e 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -77,9 +77,7 @@ describe("Facility Creation with multiple user roles", () => { }); facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.selectLocation("Kochi, Kerala"); - facilityPage.interceptFacility(); facilityPage.clickSaveFacilityButton(); - facilityPage.verifyFacilityRes(); facilityPage.verifyFacilityCreatedNotification(); // verify the facility card info cy.verifyContentPresence("#facility-details-card", [ diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 1fab563d30e..2ea72acc5eb 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -67,10 +67,6 @@ class FacilityPage { cy.intercept("POST", "**/api/v1/facility/").as("postFacility"); } - verifyFacilityRes() { - cy.wait("@postFacility").its("response.statusCode").should("eq", 201); - } - verifyErrorFacility() { cy.wait("@postFacility").its("response.statusCode").should("eq", 403); } From 86492c3cab1da47cfafb8a7747b3f8e5823818cd Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 19:28:12 +0530 Subject: [PATCH 73/83] commented notification for check --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index a0baf09815e..8dcd5f6e007 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -78,7 +78,7 @@ describe("Facility Creation with multiple user roles", () => { facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.selectLocation("Kochi, Kerala"); facilityPage.clickSaveFacilityButton(); - facilityPage.verifyFacilityCreatedNotification(); + // facilityPage.verifyFacilityCreatedNotification(); // verify the facility card info cy.verifyContentPresence("#facility-details-card", [ facilityName, From 0c2705efd5c95577db0ddf3c498bd2dd14a8a179 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Mon, 16 Dec 2024 19:42:37 +0530 Subject: [PATCH 74/83] Facility creation test cases --- cypress/e2e/facility_spec/FacilityCreation.cy.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index 8dcd5f6e007..d2893166745 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -78,7 +78,7 @@ describe("Facility Creation with multiple user roles", () => { facilityPage.fillLocationDetails(testFacilityData.location); facilityPage.selectLocation("Kochi, Kerala"); facilityPage.clickSaveFacilityButton(); - // facilityPage.verifyFacilityCreatedNotification(); + facilityPage.verifyFacilityCreatedNotification(); // verify the facility card info cy.verifyContentPresence("#facility-details-card", [ facilityName, @@ -133,9 +133,7 @@ describe("Facility Creation with multiple user roles", () => { facilityPage.selectDistrictOnPincode("Kottayam"); facilityPage.selectLocalBody("Arpookara"); facilityPage.selectWard("5"); - facilityPage.interceptFacility(); facilityPage.clickSaveFacilityButton(); - facilityPage.verifyErrorFacility(); facilityPage.verifyErrorNotification( "You do not have permission to perform this action.", ); From d09b794a599089b6c9ab6c9f8bfd00648ec1f80e Mon Sep 17 00:00:00 2001 From: Mahendar Chikolla <119734520+Mahendar0701@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:40:17 +0530 Subject: [PATCH 75/83] Search UI for discharge patients (#9320) --- .../Facility/DischargedPatientsList.tsx | 202 ++++++++---------- 1 file changed, 95 insertions(+), 107 deletions(-) diff --git a/src/components/Facility/DischargedPatientsList.tsx b/src/components/Facility/DischargedPatientsList.tsx index 4fb8910f7a1..74bb6d95626 100644 --- a/src/components/Facility/DischargedPatientsList.tsx +++ b/src/components/Facility/DischargedPatientsList.tsx @@ -1,5 +1,5 @@ import { Link, navigate } from "raviger"; -import { useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import CountBlock from "@/CAREUI/display/Count"; @@ -11,13 +11,11 @@ import PaginatedList from "@/CAREUI/misc/PaginatedList"; import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/Page"; +import SearchByMultipleFields from "@/components/Common/SearchByMultipleFields"; import SortDropdownMenu from "@/components/Common/SortDropdown"; import Tabs from "@/components/Common/Tabs"; import { getDiagnosesByIds } from "@/components/Diagnosis/utils"; import { ICD11DiagnosisModel } from "@/components/Facility/models"; -import PhoneNumberFormField from "@/components/Form/FormFields/PhoneNumberFormField"; -import { FieldChangeEvent } from "@/components/Form/FormFields/Utils"; -import SearchInput from "@/components/Form/SearchInput"; import { DIAGNOSES_FILTER_LABELS, DiagnosesFilterKey, @@ -52,16 +50,79 @@ const DischargedPatientsList = ({ pathParams: { id: facility_external_id }, }); - const { qParams, updateQuery, advancedFilter, FilterBadges, updatePage } = - useFilters({ - limit: 12, - cacheBlacklist: [ - "name", - "patient_no", - "phone_number", - "emergency_phone_number", - ], - }); + const { + qParams, + updateQuery, + advancedFilter, + FilterBadges, + updatePage, + clearSearch, + } = useFilters({ + limit: 12, + cacheBlacklist: [ + "name", + "patient_no", + "phone_number", + "emergency_phone_number", + ], + }); + + const searchOptions = [ + { + key: "name", + label: "Name", + type: "text" as const, + placeholder: "search_by_patient_name", + value: qParams.name || "", + shortcutKey: "n", + }, + { + key: "patient_no", + label: "IP/OP No", + type: "text" as const, + placeholder: "search_by_patient_no", + value: qParams.patient_no || "", + shortcutKey: "u", + }, + { + key: "phone_number", + label: "Phone Number", + type: "phone" as const, + placeholder: "Search_by_phone_number", + value: qParams.phone_number || "", + shortcutKey: "p", + }, + { + key: "emergency_contact_number", + label: "Emergency Contact Phone Number", + type: "phone" as const, + placeholder: "search_by_emergency_phone_number", + value: qParams.emergency_phone_number || "", + shortcutKey: "e", + }, + ]; + + const handleSearch = useCallback( + (key: string, value: string) => { + const isValidPhoneNumber = (val: string) => + val.length >= 13 || val === ""; + + const updatedQuery = { + phone_number: + key === "phone_number" && isValidPhoneNumber(value) + ? value + : undefined, + name: key === "name" ? value : undefined, + patient_no: key === "patient_no" ? value : undefined, + emergency_phone_number: + key === "emergency_contact_number" && isValidPhoneNumber(value) + ? value + : undefined, + }; + updateQuery(updatedQuery); + }, + [updateQuery], + ); useEffect(() => { if (!qParams.phone_number && phone_number.length >= 13) { @@ -200,56 +261,11 @@ const DischargedPatientsList = ({ }); }; - const queryField = (name: string, defaultValue?: T) => { - return { - name, - value: qParams[name] || defaultValue, - onChange: (e: FieldChangeEvent) => updateQuery({ [e.name]: e.value }), - className: "grow w-full mb-2", - }; - }; const [diagnoses, setDiagnoses] = useState([]); const [phone_number, setPhoneNumber] = useState(""); - const [phoneNumberError, setPhoneNumberError] = useState(""); const [emergency_phone_number, setEmergencyPhoneNumber] = useState(""); - const [emergencyPhoneNumberError, setEmergencyPhoneNumberError] = - useState(""); const [count, setCount] = useState(0); - - const setPhoneNum = (phone_number: string) => { - setPhoneNumber(phone_number); - if (phone_number.length >= 13) { - setPhoneNumberError(""); - updateQuery({ phone_number }); - return; - } - - if (phone_number === "+91" || phone_number === "") { - setPhoneNumberError(""); - qParams.phone_number && updateQuery({ phone_number: null }); - return; - } - - setPhoneNumberError("Enter a valid number"); - }; - - const setEmergencyPhoneNum = (emergency_phone_number: string) => { - setEmergencyPhoneNumber(emergency_phone_number); - if (emergency_phone_number.length >= 13) { - setEmergencyPhoneNumberError(""); - updateQuery({ emergency_phone_number }); - return; - } - - if (emergency_phone_number === "+91" || emergency_phone_number === "") { - setEmergencyPhoneNumberError(""); - qParams.emergency_phone_number && - updateQuery({ emergency_phone_number: null }); - return; - } - - setEmergencyPhoneNumberError("Enter a valid number"); - }; + const [isLoading, setIsLoading] = useState(false); return ( } > -
-
-
- -
-
-
-
-
- - -
-
- setPhoneNum(e.value)} - error={phoneNumberError} - types={["mobile", "landline"]} - /> - setEmergencyPhoneNum(e.value)} - error={emergencyPhoneNumberError} - types={["mobile", "landline"]} - /> -
-
+
+
+
+
setCount(query.data?.count || 0)} + queryCB={(query) => { + setCount(query.data?.count || 0); + setIsLoading(query.loading); + }} initialPage={qParams.page} onPageChange={updatePage} > From 754c9a484f662a392a9508895a6d5603de9dd63b Mon Sep 17 00:00:00 2001 From: JavidSumra <112365664+JavidSumra@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:40:38 +0530 Subject: [PATCH 76/83] Fixes UI Bug Issue in Symptom Editor (#9270) --- src/components/Common/DateInputV2.tsx | 1 + .../Form/FormFields/AutocompleteMultiselect.tsx | 8 +++++--- src/components/Form/FormFields/DateFormField.tsx | 5 ++++- src/components/Form/ModelCrudEditor.tsx | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/Common/DateInputV2.tsx b/src/components/Common/DateInputV2.tsx index 20027a004d2..8ca937aed72 100644 --- a/src/components/Common/DateInputV2.tsx +++ b/src/components/Common/DateInputV2.tsx @@ -331,6 +331,7 @@ const DateInputV2: React.FC = ({ data-scribe-ignore className={`cui-input-base cursor-pointer disabled:cursor-not-allowed ${className}`} placeholder={placeholder ?? t("select_date")} + title={placeholder} value={value ? dayjs(value).format(dateFormat) : ""} />
diff --git a/src/components/Form/FormFields/AutocompleteMultiselect.tsx b/src/components/Form/FormFields/AutocompleteMultiselect.tsx index 3c537dffa32..8dad2f3ff0d 100644 --- a/src/components/Form/FormFields/AutocompleteMultiselect.tsx +++ b/src/components/Form/FormFields/AutocompleteMultiselect.tsx @@ -171,16 +171,18 @@ export const AutocompleteMutliSelect = ( {!props.disabled && ( -
+
val.option) ? "-top-5" : ""}`} + > {props.isLoading ? ( ) : ( )}
diff --git a/src/components/Form/FormFields/DateFormField.tsx b/src/components/Form/FormFields/DateFormField.tsx index e867c24dd51..a3d26fa5554 100644 --- a/src/components/Form/FormFields/DateFormField.tsx +++ b/src/components/Form/FormFields/DateFormField.tsx @@ -37,7 +37,10 @@ const DateFormField = (props: Props) => { return ( ( onClick={() => handleDelete(props.item.id)} className="w-full text-xl text-red-500 hover:text-red-700 disabled:grayscale md:w-auto" > - {" "} + {t("remove")} )} From fa51d9f61e65890d3c6b62622d286a6aa75c1391 Mon Sep 17 00:00:00 2001 From: Kamishetty Rishith <119791436+Rishith25@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:46:11 +0530 Subject: [PATCH 77/83] Occupancy bed tooltip fully visible in mobile view (#9235) --- src/components/Common/Sidebar/Sidebar.tsx | 38 +++++++----------- src/components/Facility/FacilityCard.tsx | 37 +++++++++++------ src/components/ui/tooltip.tsx | 48 ++++++++++++++++------- 3 files changed, 71 insertions(+), 52 deletions(-) diff --git a/src/components/Common/Sidebar/Sidebar.tsx b/src/components/Common/Sidebar/Sidebar.tsx index 423d0d6f18b..e6d9edbc2dd 100644 --- a/src/components/Common/Sidebar/Sidebar.tsx +++ b/src/components/Common/Sidebar/Sidebar.tsx @@ -6,12 +6,7 @@ import { useTranslation } from "react-i18next"; import CareIcon, { IconName } from "@/CAREUI/icons/CareIcon"; import SlideOver from "@/CAREUI/interactive/SlideOver"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip"; +import { TooltipComponent, TooltipProvider } from "@/components/ui/tooltip"; import { ShrinkedSidebarItem, @@ -243,24 +238,19 @@ const ToggleShrink = ({ shrinked, toggle }: ToggleShrinkProps) => { const { t } = useTranslation(); return ( - - - - - -

{shrinked ? t("expand_sidebar") : t("collapse_sidebar")}

-
-
+ + +
); }; diff --git a/src/components/Facility/FacilityCard.tsx b/src/components/Facility/FacilityCard.tsx index fbebe8a8d0a..2f6ecec204b 100644 --- a/src/components/Facility/FacilityCard.tsx +++ b/src/components/Facility/FacilityCard.tsx @@ -6,6 +6,8 @@ import { useTranslation } from "react-i18next"; import Chip from "@/CAREUI/display/Chip"; import CareIcon from "@/CAREUI/icons/CareIcon"; +import { TooltipComponent, TooltipProvider } from "@/components/ui/tooltip"; + import { Avatar } from "@/components/Common/Avatar"; import ButtonV2, { Cancel, Submit } from "@/components/Common/ButtonV2"; import DialogModal from "@/components/Common/Dialog"; @@ -98,19 +100,28 @@ export const FacilityCard = (props: { > {facility.name} -
0.85 ? "justify-center rounded-md border border-red-600 bg-red-500 p-1 font-bold text-white" : "text-secondary-700"}`} - > - - {t("live_patients_total_beds")} - {" "} - -
- {t("occupancy")}: {facility.patient_count} /{" "} - {facility.bed_count}{" "} -
-
+ + +
+ 0.85 + ? "justify-center rounded-md border border-red-600 bg-red-500 p-1 font-bold text-white" + : "text-secondary-700" + }`} + > + +
+ {t("occupancy")}: {facility.patient_count} /{" "} + {facility.bed_count} +
+
+
+
, +const TooltipContent = TooltipPrimitive.Content; + +const TooltipComponent = React.forwardRef< + React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, sideOffset = 4, ...props }, ref) => ( - -)); -TooltipContent.displayName = TooltipPrimitive.Content.displayName; +>(({ children, content, sideOffset = 4, className }, ref) => { + const [open, setOpen] = React.useState(false); + return ( + + + setOpen(!open)}> + {children} + + + {content} + + + + ); +}); -export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; +export { + TooltipComponent, + TooltipTrigger, + TooltipContent, + TooltipProvider, + Tooltip, +}; From fad3f8c8cd8f7b774aafcf42c02b733c735adaf4 Mon Sep 17 00:00:00 2001 From: Kamishetty Rishith <119791436+Rishith25@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:47:51 +0530 Subject: [PATCH 78/83] Disallowing out of date range (#9201) --- src/components/Common/DateInputV2.tsx | 274 +++++++++++++++++++------- 1 file changed, 208 insertions(+), 66 deletions(-) diff --git a/src/components/Common/DateInputV2.tsx b/src/components/Common/DateInputV2.tsx index 8ca937aed72..8debee7ac7b 100644 --- a/src/components/Common/DateInputV2.tsx +++ b/src/components/Common/DateInputV2.tsx @@ -89,15 +89,18 @@ const DateInputV2: React.FC = ({ ); break; case "month": - setDatePickerHeaderDate((prev) => - dayjs(prev).subtract(1, "year").toDate(), - ); + setDatePickerHeaderDate((prev) => { + const newDate = dayjs(prev).subtract(1, "year").toDate(); + if (min && newDate < min) { + return new Date(min.getFullYear(), min.getMonth(), 1); + } + return newDate; + }); break; case "year": - setDatePickerHeaderDate((prev) => - dayjs(prev).subtract(1, "year").toDate(), - ); - setYear((prev) => dayjs(prev).subtract(10, "year").toDate()); + if (!min || year.getFullYear() - 10 >= min.getFullYear()) { + setYear((prev) => dayjs(prev).subtract(10, "year").toDate()); + } break; } }; @@ -108,11 +111,18 @@ const DateInputV2: React.FC = ({ setDatePickerHeaderDate((prev) => dayjs(prev).add(1, "month").toDate()); break; case "month": - setDatePickerHeaderDate((prev) => dayjs(prev).add(1, "year").toDate()); + setDatePickerHeaderDate((prev) => { + const newDate = dayjs(prev).add(1, "year").toDate(); + if (max && newDate > max) { + return new Date(max.getFullYear(), max.getMonth(), 1); + } + return newDate; + }); break; case "year": - setDatePickerHeaderDate((prev) => dayjs(prev).add(1, "year").toDate()); - setYear((prev) => dayjs(prev).add(10, "year").toDate()); + if (!max || year.getFullYear() + 10 <= max.getFullYear()) { + setYear((prev) => dayjs(prev).add(10, "year").toDate()); + } break; } }; @@ -209,6 +219,33 @@ const DateInputV2: React.FC = ({ return true; }; + const isMonthWithinConstraints = (month: number) => { + const year = datePickerHeaderDate.getFullYear(); + + if (min && year < min.getFullYear()) return false; + if (max && year > max.getFullYear()) return false; + + const firstDay = new Date(year, month, 1); + const lastDay = new Date(year, month + 1, 0); + if (min && lastDay < min) return false; + if (max && firstDay > max) return false; + + return true; + }; + + const isYearWithinConstraints = (year: number) => { + if (min && year < min.getFullYear()) return false; + if (max && year > max.getFullYear()) return false; + + const yearStart = new Date(year, 0, 1); + const yearEnd = new Date(year, 11, 31); + + if (min && yearEnd < min) return false; + if (max && yearStart > max) return false; + + return true; + }; + const isSelectedMonth = (month: number) => month === datePickerHeaderDate.getMonth(); @@ -216,25 +253,48 @@ const DateInputV2: React.FC = ({ year === datePickerHeaderDate.getFullYear(); const setMonthValue = (month: number) => () => { - setDatePickerHeaderDate( - new Date( + if (isMonthWithinConstraints(month)) { + const lastDayOfMonth = new Date( datePickerHeaderDate.getFullYear(), - month, - datePickerHeaderDate.getDate(), - ), - ); - setType("date"); + month + 1, + 0, + ).getDate(); + const newDate = Math.min(datePickerHeaderDate.getDate(), lastDayOfMonth); + setDatePickerHeaderDate( + new Date(datePickerHeaderDate.getFullYear(), month, newDate), + ); + setType("date"); + } else { + Notification.Error({ + msg: outOfLimitsErrorMessage ?? "Cannot select month out of range", + }); + } }; - + //min and max setting for year const setYearValue = (year: number) => () => { - setDatePickerHeaderDate( - new Date( + if (isYearWithinConstraints(year)) { + const newDate = new Date( year, datePickerHeaderDate.getMonth(), datePickerHeaderDate.getDate(), - ), - ); - setType("date"); + ); + if (min && year === min.getFullYear() && newDate < min) { + setDatePickerHeaderDate( + new Date(min.getFullYear(), min.getMonth(), min.getDate()), + ); + } else if (max && year === max.getFullYear() && newDate > max) { + setDatePickerHeaderDate( + new Date(max.getFullYear(), max.getMonth(), max.getDate()), + ); + } else { + setDatePickerHeaderDate(newDate); + } + setType("date"); + } else { + Notification.Error({ + msg: outOfLimitsErrorMessage ?? "Cannot select year out of range", + }); + } }; useEffect(() => { @@ -372,23 +432,62 @@ const DateInputV2: React.FC = ({
- + {type === "date" && ( + + )} + {type === "month" && ( + + )} + + {type === "year" && ( + + )}
{type === "date" && ( @@ -412,23 +511,62 @@ const DateInputV2: React.FC = ({

- + {type === "date" && ( + + )} + {type === "month" && ( + + )} + + {type === "year" && ( + + )}
{type === "date" && ( @@ -511,10 +649,12 @@ const DateInputV2: React.FC = ({ key={i} id={`month-${i}`} className={classNames( - "w-1/4 cursor-pointer rounded-lg px-2 py-4 text-center text-sm font-semibold", - value && isSelectedMonth(i) - ? "bg-primary-500 text-white" - : "text-secondary-700 hover:bg-secondary-300", + "w-1/4 rounded-lg px-2 py-4 text-center text-sm font-semibold", + isSelectedMonth(i) + ? "bg-primary-500 text-white cursor-pointer" + : isMonthWithinConstraints(i) + ? "text-secondary-700 hover:bg-secondary-300 cursor-pointer" + : "!text-secondary-400 !cursor-not-allowed", )} onClick={setMonthValue(i)} > @@ -534,16 +674,18 @@ const DateInputV2: React.FC = ({ {Array(12) .fill(null) .map((_, i) => { - const y = year.getFullYear() - 11 + i; + const y = year.getFullYear() - 10 + i; return (
From 5be34d7245c4569bb66620edcafc681f653ee9ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:45:57 +0530 Subject: [PATCH 79/83] Bump @sentry/browser from 8.42.0 to 8.45.1 (#9473) Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 8.42.0 to 8.45.1. - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/8.45.1/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/8.42.0...8.45.1) --- updated-dependencies: - dependency-name: "@sentry/browser" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 60 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 94a84d3d179..c6076acd00a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-toast": "^1.2.2", "@radix-ui/react-tooltip": "^1.1.4", - "@sentry/browser": "^8.42.0", + "@sentry/browser": "^8.45.1", "@tanstack/react-query": "^5.62.3", "@tanstack/react-query-devtools": "^5.62.7", "@yudiel/react-qr-scanner": "^2.0.8", @@ -4796,50 +4796,50 @@ ] }, "node_modules/@sentry-internal/browser-utils": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.42.0.tgz", - "integrity": "sha512-xzgRI0wglKYsPrna574w1t38aftuvo44gjOKFvPNGPnYfiW9y4m+64kUz3JFbtanvOrKPcaITpdYiB4DeJXEbA==", + "version": "8.45.1", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.45.1.tgz", + "integrity": "sha512-sZwtP3zAzDsjUS7WkMW5VGbvSl7hGKTMc8gAJbpEsrybMxllIP13zzMRwpeFF11RnnvbrZ/FtAeX58Mvj0jahA==", "license": "MIT", "dependencies": { - "@sentry/core": "8.42.0" + "@sentry/core": "8.45.1" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/feedback": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.42.0.tgz", - "integrity": "sha512-dkIw5Wdukwzngg5gNJ0QcK48LyJaMAnBspqTqZ3ItR01STi6Z+6+/Bt5XgmrvDgRD+FNBinflc5zMmfdFXXhvw==", + "version": "8.45.1", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.45.1.tgz", + "integrity": "sha512-zCKptzki4SLnG+s8je8dgnppOKFjiiO4GVBc4fh7uL8zjNPBnxW8wK4SrPfAEKVYaHUzkKc5vixwUqcpmfLLGw==", "license": "MIT", "dependencies": { - "@sentry/core": "8.42.0" + "@sentry/core": "8.45.1" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/replay": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.42.0.tgz", - "integrity": "sha512-oNcJEBlDfXnRFYC5Mxj5fairyZHNqlnU4g8kPuztB9G5zlsyLgWfPxzcn1ixVQunth2/WZRklDi4o1ZfyHww7w==", + "version": "8.45.1", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.45.1.tgz", + "integrity": "sha512-cOA9CodNSR9+hmICDaGIDUvWiwxQxeMHk/esbjB8uAW8HG4CYTG3CTYTZmlmou7DuysfMd4JNuFmDFBj+YU5/A==", "license": "MIT", "dependencies": { - "@sentry-internal/browser-utils": "8.42.0", - "@sentry/core": "8.42.0" + "@sentry-internal/browser-utils": "8.45.1", + "@sentry/core": "8.45.1" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry-internal/replay-canvas": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.42.0.tgz", - "integrity": "sha512-XrPErqVhPsPh/oFLVKvz7Wb+Fi2J1zCPLeZCxWqFuPWI2agRyLVu0KvqJyzSpSrRAEJC/XFzuSVILlYlXXSfgA==", + "version": "8.45.1", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.45.1.tgz", + "integrity": "sha512-qiPg6XwOwkiMMe/8Qf3EhXCqkSlSnWLlorYngIbdkV2klbWjd7vKnqkFJF4PnaS0g7kkZr7nh+MdzpyLyuj2Mw==", "license": "MIT", "dependencies": { - "@sentry-internal/replay": "8.42.0", - "@sentry/core": "8.42.0" + "@sentry-internal/replay": "8.45.1", + "@sentry/core": "8.45.1" }, "engines": { "node": ">=14.18" @@ -4898,25 +4898,25 @@ } }, "node_modules/@sentry/browser": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.42.0.tgz", - "integrity": "sha512-lStrEk609KJHwXfDrOgoYVVoFFExixHywxSExk7ZDtwj2YPv6r6Y1gogvgr7dAZj7jWzadHkxZ33l9EOSJBfug==", + "version": "8.45.1", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.45.1.tgz", + "integrity": "sha512-/KvYhQSRg8m9kotG8h9FrfXCWRlebrvdfXKjj1oE9SyZ2LmR8Ze9AcEw1qzsBsa1F1D/a5FQbUJahSoLBkaQPA==", "license": "MIT", "dependencies": { - "@sentry-internal/browser-utils": "8.42.0", - "@sentry-internal/feedback": "8.42.0", - "@sentry-internal/replay": "8.42.0", - "@sentry-internal/replay-canvas": "8.42.0", - "@sentry/core": "8.42.0" + "@sentry-internal/browser-utils": "8.45.1", + "@sentry-internal/feedback": "8.45.1", + "@sentry-internal/replay": "8.45.1", + "@sentry-internal/replay-canvas": "8.45.1", + "@sentry/core": "8.45.1" }, "engines": { "node": ">=14.18" } }, "node_modules/@sentry/core": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.42.0.tgz", - "integrity": "sha512-ac6O3pgoIbU6rpwz6LlwW0wp3/GAHuSI0C5IsTgIY6baN8rOBnlAtG6KrHDDkGmUQ2srxkDJu9n1O6Td3cBCqw==", + "version": "8.45.1", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.45.1.tgz", + "integrity": "sha512-1fGmkr0paZshh38mD29c4CfkRkgFoYDaAGyDLoGYfTbEph/lU8RHB2HWzN93McqNdMEhl1DRRyqIasUZoPlqSA==", "license": "MIT", "engines": { "node": ">=14.18" diff --git a/package.json b/package.json index e5eaf3342c9..00ec917f6fb 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-toast": "^1.2.2", "@radix-ui/react-tooltip": "^1.1.4", - "@sentry/browser": "^8.42.0", + "@sentry/browser": "^8.45.1", "@tanstack/react-query": "^5.62.3", "@tanstack/react-query-devtools": "^5.62.7", "@yudiel/react-qr-scanner": "^2.0.8", From 20efe330d4c2d26306f4b1797b79401b17f99e26 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Tue, 17 Dec 2024 18:35:23 +0530 Subject: [PATCH 80/83] Patient registration form url intercept --- cypress/pageobject/Patient/PatientCreation.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index af5d87d233e..e219e235218 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -182,7 +182,9 @@ export class PatientPage { } visitPatientUrl() { + this.interceptGetPatient(); cy.visit(patient_url); + this.verifyGetPatientResponse(); } visitConsultationPage() { From 6fe4087408d5991822b3051b197499e7af5c40c3 Mon Sep 17 00:00:00 2001 From: Rishith25 Date: Tue, 17 Dec 2024 18:49:41 +0530 Subject: [PATCH 81/83] Patient registration form url intercept --- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 53ae66817b6..9cf6d5b79e5 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -154,8 +154,8 @@ describe("Patient Creation with consultation", () => { patientPage.visitUpdatePatientUrl(); patientPage.verifyStatusCode(); patientPage.patientformvisibility(); - cy.wait(3000); // change the gender to female and input data to related changed field + cy.wait(3000); patientPage.selectPatientGender(patientOneUpdatedGender); patientPage.typePatientDateOfBirth(patientDateOfBirth); patientPage.clickPatientAntenatalStatusYes(); From 266e1c5979c704c69677425f7d5f20b3348262f5 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:28:45 +0530 Subject: [PATCH 82/83] debug the facility creation --- .../e2e/facility_spec/FacilityCreation.cy.ts | 1 - .../pageobject/Facility/FacilityCreation.ts | 36 +++---------------- .../pageobject/utils/advanceFilterHelpers.ts | 8 +++++ 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/cypress/e2e/facility_spec/FacilityCreation.cy.ts b/cypress/e2e/facility_spec/FacilityCreation.cy.ts index d2893166745..4a07a665896 100644 --- a/cypress/e2e/facility_spec/FacilityCreation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityCreation.cy.ts @@ -65,7 +65,6 @@ describe("Facility Creation with multiple user roles", () => { beforeEach(() => { cy.viewport(1280, 720); cy.restoreLocalStorage(); - cy.awaitUrl("/facility"); }); it("Create a new facility with all fields | Edit Existing Data | Verify its reflection", () => { diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts index 2ea72acc5eb..969023c6dc0 100644 --- a/cypress/pageobject/Facility/FacilityCreation.ts +++ b/cypress/pageobject/Facility/FacilityCreation.ts @@ -21,7 +21,7 @@ export interface FacilityData { class FacilityPage { visitCreateFacilityPage() { cy.intercept("GET", "**/facility/create").as("getCreateFacilities"); - cy.visit("/facility/create"); + cy.awaitUrl("/facility/create"); cy.wait("@getCreateFacilities") .its("response.statusCode") .should("eq", 200); @@ -44,8 +44,7 @@ class FacilityPage { } selectWard(ward: string) { - cy.get("div#ward button").click(); - cy.get("[role='option']").contains(ward).click(); + advanceFilters.selectWard(ward); } typeFacilityAddress(address: string, clearBeforeTyping: boolean = false) { @@ -275,39 +274,12 @@ class FacilityPage { .should("eq", 201); } - getStateElement() { - return cy.get("#state"); - } - - getDistrictElement() { - return cy.get("#district"); - } - selectStateOnPincode(stateName: string) { - this.getStateElement() - .scrollIntoView() - .wait(2000) - .should("be.visible") - .then(($element) => { - const text = $element.text(); - if (!text.includes(stateName)) { - this.getStateElement().click(); - cy.get("li[role=option]").contains(stateName).click(); - } - }); + advanceFilters.selectState(stateName); } selectDistrictOnPincode(districtName: string) { - this.getDistrictElement().as("district").scrollIntoView().wait(2000); - cy.get("@district") - .should("be.visible") - .then(($element) => { - const text = $element.text(); - if (!text.includes(districtName)) { - this.getDistrictElement().click(); - cy.get("li[role=option]").contains(districtName).click(); - } - }); + advanceFilters.selectDistrict(districtName); } verifyPpeQuantity(text: string) { diff --git a/cypress/pageobject/utils/advanceFilterHelpers.ts b/cypress/pageobject/utils/advanceFilterHelpers.ts index 22925fc2c23..613f4af2f23 100644 --- a/cypress/pageobject/utils/advanceFilterHelpers.ts +++ b/cypress/pageobject/utils/advanceFilterHelpers.ts @@ -4,17 +4,25 @@ export const advanceFilters = { }, selectState(state: string) { + cy.wait(200); cy.clickAndSelectOption("#state", state); }, selectDistrict(district: string) { + cy.wait(200); cy.clickAndSelectOption("#district", district); }, selectLocalBody(localBody: string) { + cy.wait(200); cy.clickAndSelectOption("#local_body", localBody); }, + selectWard(ward: string) { + cy.wait(200); + cy.clickAndSelectOption("#ward", ward); + }, + applySelectedFilter() { cy.verifyAndClickElement("#apply-filter", "Apply"); }, From a984390a5749faa876743671fcc1fb4a42ad6b68 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:24:08 +0530 Subject: [PATCH 83/83] removed hardcorded pagination verification --- cypress/e2e/patient_spec/PatientHomepage.cy.ts | 2 -- cypress/e2e/patient_spec/PatientRegistration.cy.ts | 2 +- cypress/pageobject/Patient/PatientCreation.ts | 4 ++-- cypress/pageobject/utils/paginationHelpers.ts | 11 ----------- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index cb0474eb008..8f5ac03a9ef 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -160,9 +160,7 @@ describe("Patient Homepage present functionalities", () => { .invoke("text") .then((patientOne: string) => { firstPatientPageOne = patientOne.trim(); - pageNavigation.interceptPatientNavigation(); pageNavigation.navigateToNextPage(); - pageNavigation.verifyPatientNavigation(); pageNavigation.verifyCurrentPageNumber(2); cy.get('[data-cy="patient"]') .first() diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 9cf6d5b79e5..5601f994c53 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -247,7 +247,7 @@ describe("Patient Creation with consultation", () => { // allow the transfer button of a patient patientTransfer.clickAllowPatientTransferButton(); // Verify the patient error message for the same facility - cy.awaitUrl("/patients"); + cy.visit("/patients"); patientPage.createPatient(); patientPage.selectFacility(patientTransferFacility); patientPage.patientformvisibility(); diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index e219e235218..bdc65c7d431 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -183,7 +183,7 @@ export class PatientPage { visitPatientUrl() { this.interceptGetPatient(); - cy.visit(patient_url); + cy.awaitUrl(patient_url); this.verifyGetPatientResponse(); } @@ -240,7 +240,7 @@ export class PatientPage { expect($dashboard).to.contain(patientName); expect($dashboard).to.contain(phoneNumber); expect($dashboard).to.contain(emergencyPhoneNumber); - //expect($dashboard).to.contain(yearOfBirth); //Commented out because new proposed UI does not have DOB. Can change later. + expect($dashboard).to.contain(yearOfBirth); expect($dashboard).to.contain(bloodGroup); expect($dashboard).to.contain(occupation); socioeconomicStatus && diff --git a/cypress/pageobject/utils/paginationHelpers.ts b/cypress/pageobject/utils/paginationHelpers.ts index 7a1e16cc261..edbabec5523 100644 --- a/cypress/pageobject/utils/paginationHelpers.ts +++ b/cypress/pageobject/utils/paginationHelpers.ts @@ -10,15 +10,4 @@ export const pageNavigation = { navigateToPreviousPage() { cy.get("button#prev-pages").click(); }, - - interceptPatientNavigation() { - cy.intercept( - "GET", - "/api/v1/patient/?page=*&limit=*&is_active=True&offset=*", - ).as("getPatientPage"); - }, - - verifyPatientNavigation() { - cy.wait("@getPatientPage").its("response.statusCode").should("eq", 200); - }, };