diff --git a/cypress/e2e/assets_spec/assets_manage.cy.ts b/cypress/e2e/assets_spec/assets_manage.cy.ts
index d04a7733c0d..af3efb917dd 100644
--- a/cypress/e2e/assets_spec/assets_manage.cy.ts
+++ b/cypress/e2e/assets_spec/assets_manage.cy.ts
@@ -1,4 +1,5 @@
///
+import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { v4 as uuidv4 } from "uuid";
import LoginPage from "../../pageobject/Login/LoginPage";
@@ -84,7 +85,9 @@ describe("Asset", () => {
"Test note for asset creation!"
);
+ assetPage.interceptAssetCreation();
assetPage.clickCreateAsset();
+ assetPage.verifyAssetCreation();
assetPage.verifySuccessNotification("Asset created successfully");
assetSearchPage.typeSearchKeyword("New Test Asset 2");
@@ -104,7 +107,8 @@ describe("Asset", () => {
"Manufacturer's Name Edited",
"Customer Support's Name Edited",
"Vendor's Name Edited",
- "Test note for asset creation edited!"
+ "Test note for asset creation edited!",
+ "25122021"
);
assetPage.clickUpdateAsset();
@@ -112,11 +116,71 @@ describe("Asset", () => {
assetPage.verifySuccessNotification("Asset updated successfully");
});
+ it("Configure an asset", () => {
+ assetPage.openCreatedAsset();
+ assetPage.spyAssetConfigureApi();
+ assetPage.configureAsset(
+ "Host name",
+ "192.168.1.64",
+ "remote_user",
+ "2jCkrCRSeahzKEU",
+ "d5694af2-21e2-4a39-9bad-2fb98d9818bd"
+ );
+ assetPage.clickConfigureAsset();
+ assetPage.verifyAssetConfiguration(200);
+ });
+
+ it("Add an vital monitor asset and configure it", () => {
+ assetPage.createAsset();
+ assetPage.selectFacility("Dummy Facility 1");
+ assetPage.selectLocation("Camera Loc");
+ assetPage.selectAssetType("Internal");
+ assetPage.selectAssetClass("HL7 Vitals Monitor");
+
+ const qr_id_1 = uuidv4();
+
+ assetPage.enterAssetDetails(
+ "New Test Asset Vital",
+ "Test Description",
+ "Working",
+ qr_id_1,
+ "Manufacturer's Name",
+ "2025-12-25",
+ "Customer Support's Name",
+ phone_number,
+ "email@support.com",
+ "Vendor's Name",
+ serialNumber,
+ "25122021",
+ "Test note for asset creation!"
+ );
+ assetPage.interceptAssetCreation();
+ assetPage.clickCreateAsset();
+ assetPage.verifyAssetCreation();
+
+ assetSearchPage.typeSearchKeyword("New Test Asset Vital");
+ assetSearchPage.pressEnter();
+
+ assetPage.openCreatedAsset();
+ assetPage.configureVitalAsset("Host name", "192.168.1.64");
+ assetPage.clickConfigureVital();
+ });
+
it("Delete an Asset", () => {
assetPage.openCreatedAsset();
+ assetPage.interceptDeleteAssetApi();
assetPage.deleteAsset();
+ assetPage.verifyDeleteStatus();
+ });
+
+ it("Import new asset", () => {
+ assetPage.selectImportOption();
+ assetPage.selectImportFacility("Dummy Facility 1");
+ assetPage.importAssetFile();
+ assetPage.selectImportLocation("Camera Locations");
+ assetPage.clickImportAsset();
- assetPage.verifySuccessNotification("Asset deleted successfully");
+ assetPage.verifySuccessNotification("Assets imported successfully");
});
afterEach(() => {
diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts
index 46afbb13d03..af639783a80 100644
--- a/cypress/e2e/patient_spec/patient_crud.cy.ts
+++ b/cypress/e2e/patient_spec/patient_crud.cy.ts
@@ -1,12 +1,13 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
-
-const username = "devdistrictadmin";
-const password = "Coronasafe@123";
-const phone_number = "9" + Math.floor(100000000 + Math.random() * 900000000);
-const emergency_phone_number =
- "9" + Math.floor(100000000 + Math.random() * 900000000);
+import LoginPage from "../../pageobject/Login/LoginPage";
+import { PatientPage } from "../../pageobject/Patient/PatientCreation";
+import { UpdatePatientPage } from "../../pageobject/Patient/PatientUpdate";
+import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";
+import {
+ emergency_phone_number,
+ phone_number,
+} from "../../pageobject/constants";
const yearOfBirth = "2023";
-let patient_url = "";
const calculateAge = () => {
const currentYear = new Date().getFullYear();
@@ -14,8 +15,13 @@ const calculateAge = () => {
};
describe("Patient Creation with consultation", () => {
+ const loginPage = new LoginPage();
+ const patientPage = new PatientPage();
+ const updatePatientPage = new UpdatePatientPage();
+ const patientConsultationPage = new PatientConsultationPage();
+
before(() => {
- cy.loginByApi(username, password);
+ loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});
@@ -25,208 +31,105 @@ describe("Patient Creation with consultation", () => {
});
it("Create a new patient with no consultation", () => {
- cy.get("#add-patient-details").should("be.visible");
- cy.get("#add-patient-details").click();
- cy.get("input[name='facilities']")
- .type("dummy facility")
- .then(() => {
- cy.get("[role='option']").first().click();
- });
- cy.get("button").should("contain", "Select");
- cy.get("button").get("#submit").click();
- cy.get("#phone_number-div").type(phone_number);
- cy.get("#emergency_phone_number-div").type(emergency_phone_number);
- cy.get("#date_of_birth").should("be.visible").click();
- cy.get("#date-input").click().type("01082023");
- cy.get("[data-testid=name] input").type("Test E2E User");
- cy.get("[data-testid=Gender] button")
- .click()
- .then(() => {
- cy.get("[role='option']").contains("Male").click();
- });
- cy.get("[data-testid=current-address] textarea").type(
- "Test Patient Address"
+ patientPage.createPatient();
+ patientPage.selectFacility("dummy facility");
+ patientPage.enterPatientDetails(
+ phone_number,
+ emergency_phone_number,
+ "Test E2E User",
+ "Male",
+ "Test Patient Address",
+ "682001",
+ "1: PAZHAMTHOTTAM",
+ "O+",
+ "01012001"
);
- cy.get("[data-testid=permanent-address] input").check();
- cy.get("#pincode").type("682001");
- cy.get("[data-testid=localbody] button")
- .click()
- .then(() => {
- cy.get("[role='option']").first().click();
- });
- cy.get("[data-testid=ward-respective-lsgi] button")
- .click()
- .then(() => {
- cy.get("[role='option']").contains("1: PAZHAMTHOTTAM").click();
- });
- cy.get("[name=medical_history_check_1]").check();
- cy.get("[data-testid=blood-group] button")
- .click()
- .then(() => {
- cy.get("[role='option']").contains("O+").click();
- });
- cy.get("button[data-testid='submit-button']").click();
+ patientPage.clickCreatePatient();
- cy.get("h2").should("contain", "Create Consultation");
- cy.url().should("include", "/patient");
- cy.url().then((url) => {
- cy.log(url);
- patient_url = url.split("/").slice(0, -1).join("/");
- cy.log(patient_url);
- });
+ patientPage.verifyPatientIsCreated();
+ patientPage.saveCreatedPatientUrl();
});
it("Patient Detail verification post registration", () => {
- cy.log(patient_url);
- cy.awaitUrl(patient_url);
- cy.url().should("include", "/facility/");
- cy.get("[data-testid=patient-dashboard]").should("contain", calculateAge());
- cy.get("[data-testid=patient-dashboard]").should(
- "contain",
- "Test E2E User"
- );
- cy.get("[data-testid=patient-dashboard]").should("contain", phone_number);
- cy.get("[data-testid=patient-dashboard]").should(
- "contain",
- emergency_phone_number
+ patientPage.interceptFacilities();
+ patientPage.visitCreatedPatient();
+ patientPage.verifyStatusCode();
+ const age = calculateAge();
+ patientPage.verifyPatientDetails(
+ age,
+ "Test E2E User",
+ phone_number,
+ emergency_phone_number,
+ yearOfBirth,
+ "O+"
);
- cy.get("[data-testid=patient-dashboard]").should("contain", yearOfBirth);
- cy.get("[data-testid=patient-dashboard]").should("contain", "O+");
});
it("Edit the patient details", () => {
- cy.intercept("GET", "**/facility/*/patient/**").as("getFacilities");
- cy.awaitUrl(patient_url + "/update");
- cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
- cy.wait(10000);
- cy.get("#address").scrollIntoView();
- cy.get("#address").should("be.visible");
- cy.get("#address").type("Test Patient Address Edited");
- cy.get("[data-testid=name] input").clear();
- cy.get("[data-testid=name] input").type("Test E2E User Edited");
- cy.get("#phone_number-div").clear();
- cy.get("#phone_number-div").type("+91").type(phone_number);
- cy.get("#emergency_phone_number-div").clear();
- cy.get("#emergency_phone_number-div")
- .type("+91")
- .type(emergency_phone_number);
- cy.get("#present_health").type("Severe Cough");
- cy.get("#ongoing_medication").type("Paracetamol");
- cy.get("#allergies").type("Dust");
- cy.get("[name=medical_history_check_1]").uncheck();
- cy.get("[name=medical_history_check_2]").check();
- cy.get("#medical_history_2").type("2 months ago");
- cy.get("[name=medical_history_check_3]").check();
- cy.get("#medical_history_3").type("1 month ago");
- cy.get("button").get("[data-testid=add-insurance-button]").click();
- cy.get("#subscriber_id").type("SUB123");
- cy.get("#policy_id").type("P123");
- cy.get("#insurer_id").type("GICOFINDIA");
- cy.get("#insurer_name").type("GICOFINDIA");
- cy.get("[data-testid=blood-group] button")
- .click()
- .then(() => {
- cy.get("[role='option']").contains("O+").click();
- });
- cy.get("button[data-testid='submit-button']").click();
- cy.url().should("include", "/patient");
- cy.url().then((url) => {
- cy.log(url);
- patient_url = url.split("/").slice(0, -1).join("/");
- cy.log(patient_url);
- });
- });
-
- it("Patient Detail verification post edit", () => {
- cy.log(patient_url);
- cy.awaitUrl(patient_url);
- cy.url().should("include", "/facility/");
- cy.get("[data-testid=patient-dashboard]").should(
- "contain",
- "Test E2E User Edited"
- );
- cy.get("[data-testid=patient-dashboard]").should("contain", phone_number);
- const patientDetails_values: string[] = [
+ patientPage.interceptFacilities();
+ patientPage.visitUpdatePatientUrl();
+ patientPage.verifyStatusCode();
+ updatePatientPage.enterPatientDetails(
+ "Test E2E User Edited",
+ "O+",
+ phone_number,
+ emergency_phone_number,
+ "Test Patient Address Edited",
"Severe Cough",
"Paracetamol",
"Dust",
- "Diabetes",
- "2 months ago",
- "Heart Disease",
- "1 month ago",
- ];
+ ["2 months ago", "1 month ago"],
+ "SUB123",
+ "P123",
+ "GICOFINDIA",
+ "GICOFINDIA"
+ );
+ updatePatientPage.clickUpdatePatient();
- patientDetails_values.forEach((value) => {
- cy.get("[data-testid=patient-details]").should("contain", value);
- });
+ updatePatientPage.verifyPatientUpdated();
+ updatePatientPage.saveUpdatedPatientUrl();
});
- it("Create a New consultation to existing patient", () => {
- cy.intercept("GET", "**/api/v1/patient/**").as("getFacilities");
- cy.visit(patient_url + "/consultation");
- cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
- cy.get("#history_of_present_illness").scrollIntoView;
- cy.get("#history_of_present_illness").should("be.visible");
- cy.get("#history_of_present_illness").click().type("histroy");
- cy.get("#consultation_status")
- .click()
- .then(() => {
- cy.get("[role='option']").contains("Out-patient (walk in)").click();
- });
- cy.get("#symptoms")
- .click()
- .then(() => {
- cy.get("[role='option']").contains("ASYMPTOMATIC").click();
- });
- cy.get("#symptoms").click();
-
- cy.get("#examination_details")
- .click()
- .type("Examination details and Clinical conditions");
- cy.get("#weight").click().type("70");
- cy.get("#height").click().type("170");
- cy.get("#patient_no").type("IP007");
-
- cy.intercept("GET", "**/icd/**").as("getIcdResults");
- cy.get(
- "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']"
- )
- .click()
- .type("1A");
- cy.get("#icd11_diagnoses_object [role='option']")
- .contains("1A03 Intestinal infections due to Escherichia coli")
- .click();
- cy.get("label[for='icd11_diagnoses_object']").click();
- cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200);
+ it("Patient Detail verification post edit", () => {
+ patientPage.interceptFacilities();
+ updatePatientPage.visitUpdatedPatient();
+ patientPage.verifyStatusCode();
- cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A");
- cy.get("#icd11_principal_diagnosis [role='option']")
- .contains("1A03 Intestinal infections due to Escherichia coli")
- .click();
+ updatePatientPage.verifyPatientDetails(
+ "Test E2E User Edited",
+ phone_number,
+ "Severe Cough",
+ "Paracetamol",
+ "Dust"
+ );
+ });
- cy.get("#consultation_notes").click().type("generalnote");
- cy.get("#verified_by").click().type("generalnote");
- cy.get("#submit").click();
+ it("Create a New consultation to existing patient", () => {
+ patientPage.interceptFacilities();
+ updatePatientPage.visitConsultationPage();
+ patientPage.verifyStatusCode();
+ patientConsultationPage.fillIllnessHistory("history");
+ patientConsultationPage.selectConsultationStatus("Out-patient (walk in)");
+ patientConsultationPage.selectSymptoms("ASYMPTOMATIC");
+
+ patientConsultationPage.enterConsultationDetails(
+ "Examination details and Clinical conditions",
+ "70",
+ "170",
+ "IP007",
+ "generalnote",
+ "generalnote"
+ );
+ patientConsultationPage.submitConsultation();
// Below code for the prescription module only present while creating a new consultation
- cy.contains("button", "Add Prescription Medication")
- .should("be.visible")
- .click();
- cy.intercept("GET", "**/api/v1/medibase/**").as("getFacilities");
- cy.get(
- "div#medicine_object input[placeholder='Select'][role='combobox']"
- ).click();
- cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
- cy.get("div#medicine_object input[placeholder='Select'][role='combobox']")
- .click()
- .type("dolo{enter}");
- cy.get("#dosage").type("3", { force: true });
- cy.get("#frequency")
- .click()
- .then(() => {
- cy.get("div#frequency [role='option']").contains("Twice daily").click();
- });
- cy.get("button#submit").should("be.visible").click();
- cy.get("[data-testid='return-to-patient-dashboard']").click();
+ patientConsultationPage.clickAddPrescription();
+ patientConsultationPage.interceptMediaBase();
+ patientConsultationPage.selectMedicinebox();
+ patientConsultationPage.waitForMediabaseStatusCode();
+ patientConsultationPage.prescribeMedicine();
+ patientConsultationPage.enterDosage("3");
+ patientConsultationPage.selectDosageFrequency("Twice daily");
+ patientConsultationPage.submitPrescriptionAndReturn();
});
afterEach(() => {
diff --git a/cypress/fixtures/sampleAsset.xlsx b/cypress/fixtures/sampleAsset.xlsx
new file mode 100644
index 00000000000..f8e234ce447
Binary files /dev/null and b/cypress/fixtures/sampleAsset.xlsx differ
diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts
index d24c93d0197..fdaf802d4b7 100644
--- a/cypress/pageobject/Asset/AssetCreation.ts
+++ b/cypress/pageobject/Asset/AssetCreation.ts
@@ -1,4 +1,5 @@
// assetPage.ts
+import { cy, expect } from "local-cypress";
export class AssetPage {
createAsset() {
@@ -74,6 +75,14 @@ export class AssetPage {
cy.get("[data-testid=asset-notes-input] textarea").type(notes);
}
+ interceptAssetCreation() {
+ cy.intercept("POST", "**/api/v1/asset/").as("createAsset");
+ }
+
+ verifyAssetCreation() {
+ cy.wait("@createAsset").its("response.statusCode").should("eq", 201);
+ }
+
clickCreateAsset() {
cy.get("#submit").contains("Create Asset").click();
}
@@ -87,7 +96,9 @@ export class AssetPage {
}
openCreatedAsset() {
+ cy.intercept("GET", "**/api/v1/asset/**").as("getAsset");
cy.get("[data-testid=created-asset-list]").first().click();
+ cy.wait("@getAsset").its("response.statusCode").should("eq", 200);
}
editAssetDetails(
@@ -97,7 +108,8 @@ export class AssetPage {
manufacturer: string,
supportName: string,
vendorName: string,
- notes: string
+ notes: string,
+ lastServicedOn: string
) {
cy.get("[data-testid=asset-update-button]").click();
cy.get("[data-testid=asset-name-input] input").clear().type(name);
@@ -114,18 +126,71 @@ export class AssetPage {
cy.get("[data-testid=asset-vendor-name-input] input")
.clear()
.type(vendorName);
+ cy.get(
+ "[data-testid=asset-last-serviced-on-input] input[type='text']"
+ ).click();
+ cy.get("#date-input").click().type(lastServicedOn);
cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes);
}
+ configureAsset(
+ hostName: string,
+ localIp: string,
+ userName: string,
+ password: string,
+ streamUuid: string
+ ) {
+ cy.get("[data-testid=asset-configure-button]").click();
+ cy.get("[name=middleware_hostname]").type(hostName);
+ cy.get("[name=camera_address]").type(localIp);
+ cy.get("[name=username]").type(userName);
+ cy.get("[name=password]").type(password);
+ cy.get("[name=stream_uuid]").type(streamUuid);
+ }
+
+ configureVitalAsset(hostName: string, localIp: string) {
+ cy.get("[data-testid=asset-configure-button]").click();
+ cy.get("#middlewareHostname").type(hostName);
+ cy.get("#localipAddress").type(localIp);
+ }
+
+ spyAssetConfigureApi() {
+ cy.intercept(/\/api\/v1\/asset/).as("asset");
+ }
+
+ verifyAssetConfiguration(statusCode: number) {
+ cy.wait("@asset").then((interception) => {
+ expect(interception.response.statusCode).to.equal(statusCode);
+ });
+ }
+
+ clickConfigureAsset() {
+ cy.get("#submit").contains("Set Configuration").click();
+ }
+
+ clickConfigureVital() {
+ cy.intercept("PATCH", "**/api/v1/asset/**").as("postConfiguration");
+ cy.get("#submit").contains("Save Configuration").click();
+ cy.wait("@postConfiguration").its("response.statusCode").should("eq", 200);
+ }
+
clickUpdateAsset() {
cy.get("#submit").contains("Update").click();
}
+ interceptDeleteAssetApi() {
+ cy.intercept("DELETE", "**/api/v1/asset/**").as("deleteAsset");
+ }
+
deleteAsset() {
cy.get("[data-testid=asset-delete-button]").click();
cy.get("#submit").contains("Confirm").click();
}
+ verifyDeleteStatus() {
+ cy.wait("@deleteAsset").its("response.statusCode").should("eq", 204);
+ }
+
verifyEmptyAssetNameError() {
cy.get("[data-testid=asset-name-input] span").should(
"contain",
@@ -160,4 +225,34 @@ export class AssetPage {
"Please enter valid phone number"
);
}
+
+ selectImportFacility(facilityName: string) {
+ cy.get("input[name='facilities']")
+ .type(facilityName)
+ .then(() => {
+ cy.get("[role='option']").contains(facilityName).click();
+ });
+ }
+
+ selectImportOption() {
+ cy.get("[data-testid=import-asset-button]").click();
+ cy.get(".import-assets-button").click();
+ }
+
+ importAssetFile() {
+ cy.get("[data-testid=import-asset-file]")
+ .selectFile("cypress/fixtures/sampleAsset.xlsx", { force: true })
+ .wait(100);
+ }
+
+ selectImportLocation(locationName: string) {
+ cy.get("[data-testid=select-import-location]").click();
+ cy.get("li[role=option]").contains(locationName).click();
+ }
+
+ clickImportAsset() {
+ cy.intercept("POST", "**/api/v1/asset/").as("importAsset");
+ cy.get("#submit").contains("Import").click();
+ cy.wait("@importAsset").its("response.statusCode").should("eq", 201);
+ }
}
diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts
new file mode 100644
index 00000000000..315ef455aaa
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientConsultation.ts
@@ -0,0 +1,108 @@
+export class PatientConsultationPage {
+ selectConsultationStatus(status: string) {
+ cy.get("#consultation_status")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(status).click();
+ });
+ }
+
+ selectSymptoms(symptoms: string) {
+ cy.get("#symptoms")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(symptoms).click();
+ });
+ }
+
+ fillIllnessHistory(history: string) {
+ cy.get("#history_of_present_illness").scrollIntoView;
+ cy.get("#history_of_present_illness").should("be.visible");
+ cy.get("#history_of_present_illness").click().type(history);
+ }
+
+ enterConsultationDetails(
+ examinationDetails: string,
+ weight: string,
+ height: string,
+ ipNumber: string,
+ consulationNotes: string,
+ verificationBy: string
+ ) {
+ cy.get("#symptoms").click();
+ cy.get("#examination_details").click().type(examinationDetails);
+ cy.get("#weight").click().type(height);
+ cy.get("#height").click().type(weight);
+ cy.get("#patient_no").type(ipNumber);
+ cy.intercept("GET", "**/icd/**").as("getIcdResults");
+ cy.get(
+ "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']"
+ )
+ .click()
+ .type("1A");
+ cy.get("#icd11_diagnoses_object [role='option']")
+ .contains("1A03 Intestinal infections due to Escherichia coli")
+ .click();
+ cy.get("label[for='icd11_diagnoses_object']").click();
+ cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200);
+
+ cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A");
+ cy.get("#icd11_principal_diagnosis [role='option']")
+ .contains("1A03 Intestinal infections due to Escherichia coli")
+ .click();
+
+ cy.get("#consultation_notes").click().type(consulationNotes);
+ cy.get("#verified_by").click().type(verificationBy);
+ }
+
+ submitConsultation() {
+ cy.get("#submit").click();
+ }
+
+ clickAddPrescription() {
+ cy.contains("button", "Add Prescription Medication")
+ .should("be.visible")
+ .click();
+ }
+
+ interceptMediaBase() {
+ cy.intercept("GET", "**/api/v1/medibase/**").as("getMediaBase");
+ }
+
+ prescribeMedicine() {
+ cy.get("div#medicine_object input[placeholder='Select'][role='combobox']")
+ .click()
+ .type("dolo{enter}");
+ }
+
+ selectMedicinebox() {
+ cy.get(
+ "div#medicine_object input[placeholder='Select'][role='combobox']"
+ ).click();
+ }
+
+ waitForMediabaseStatusCode() {
+ cy.wait("@getMediaBase").its("response.statusCode").should("eq", 200);
+ }
+
+ enterDosage(doseAmount: string) {
+ cy.get("#dosage").type(doseAmount, { force: true });
+ }
+
+ selectDosageFrequency(frequency: string) {
+ cy.get("#frequency")
+ .click()
+ .then(() => {
+ cy.get("div#frequency [role='option']").contains(frequency).click();
+ });
+ }
+
+ submitPrescriptionAndReturn() {
+ cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/").as(
+ "submitPrescription"
+ );
+ cy.get("button#submit").should("be.visible").click();
+ cy.get("[data-testid='return-to-patient-dashboard']").click();
+ cy.wait("@submitPrescription").its("response.statusCode").should("eq", 201);
+ }
+}
diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts
new file mode 100644
index 00000000000..9b8df4a287e
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientCreation.ts
@@ -0,0 +1,127 @@
+// PatientPage.ts
+
+let patient_url = "";
+
+export class PatientPage {
+ createPatient() {
+ cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
+ cy.get("#add-patient-details").should("be.visible");
+ cy.get("#add-patient-details").click();
+ cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
+ }
+
+ selectFacility(facilityName: string) {
+ cy.get("input[name='facilities']")
+ .type(facilityName)
+ .then(() => {
+ cy.get("[role='option']").first().click();
+ });
+ cy.get("button").should("contain", "Select");
+ cy.get("button").get("#submit").click();
+ }
+
+ interceptCreatePatientAPI() {
+ cy.intercept("GET", "**/facility/*/patient/**").as("createPatient");
+ }
+
+ verifyCreatedPatientResponse() {
+ cy.wait("@createPatient").its("response.statusCode").should("eq", 200);
+ }
+
+ enterPatientDetails(
+ phoneNumber: string,
+ emergencyPhoneNumber: string,
+ patientName: string,
+ gender: string,
+ address: string,
+ pincode: string,
+ wardName: string,
+ bloodGroup: string,
+ dateOfBirth: string
+ ) {
+ cy.get("#phone_number-div").type(phoneNumber);
+ cy.get("#emergency_phone_number-div").type(emergencyPhoneNumber);
+ cy.get("#date_of_birth").should("be.visible").click();
+ cy.get("#date-input").click().type(dateOfBirth);
+ cy.get("[data-testid=name] input").type(patientName);
+ cy.get("[data-testid=Gender] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(gender).click();
+ });
+ cy.get("[data-testid=current-address] textarea").type(address);
+ cy.get("[data-testid=permanent-address] input").check();
+ cy.get("#pincode").type(pincode);
+ cy.get("[data-testid=localbody] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").first().click();
+ });
+ cy.get("[data-testid=ward-respective-lsgi] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(wardName).click();
+ });
+ cy.get("[name=medical_history_check_1]").check();
+ cy.get("[data-testid=blood-group] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(bloodGroup).click();
+ });
+ }
+
+ clickCreatePatient() {
+ cy.intercept("POST", "**/api/v1/patient/").as("createPatient");
+ cy.get("button[data-testid='submit-button']").click();
+ cy.wait("@createPatient").its("response.statusCode").should("eq", 201);
+ }
+
+ verifyPatientIsCreated() {
+ cy.get("h2").should("contain", "Create Consultation");
+ cy.url().should("include", "/patient");
+ }
+
+ saveCreatedPatientUrl() {
+ cy.url().then((url) => {
+ cy.log(url);
+ patient_url = url.split("/").slice(0, -1).join("/");
+ cy.log(patient_url);
+ });
+ }
+
+ visitCreatedPatient() {
+ cy.awaitUrl(patient_url);
+ }
+
+ verifyPatientDetails(
+ age: number,
+ patientName: string,
+ phoneNumber: string,
+ emergencyPhoneNumber: string,
+ yearOfBirth: string,
+ bloodGroup: string
+ ) {
+ cy.url().should("include", "/facility/");
+ cy.get("[data-testid=patient-dashboard]").should("contain", age);
+ cy.get("[data-testid=patient-dashboard]").should("contain", patientName);
+ cy.get("[data-testid=patient-dashboard]").should("contain", phoneNumber);
+ cy.get("[data-testid=patient-dashboard]").should(
+ "contain",
+ emergencyPhoneNumber
+ );
+ cy.get("[data-testid=patient-dashboard]").should("contain", yearOfBirth);
+ cy.get("[data-testid=patient-dashboard]").should("contain", bloodGroup);
+ }
+
+ visitUpdatePatientUrl() {
+ cy.awaitUrl(patient_url + "/update");
+ }
+
+ interceptFacilities() {
+ cy.intercept("GET", "**/facility/*/patient/**").as("getFacilities");
+ }
+
+ verifyStatusCode() {
+ cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
+ }
+}
diff --git a/cypress/pageobject/Patient/PatientUpdate.ts b/cypress/pageobject/Patient/PatientUpdate.ts
new file mode 100644
index 00000000000..b26ef678679
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientUpdate.ts
@@ -0,0 +1,97 @@
+let patient_url = "";
+
+export class UpdatePatientPage {
+ enterPatientDetails(
+ patientName: string,
+ bloodGroup: string,
+ phoneNumber: string,
+ emergencyPhoneNumber: string,
+ address: string,
+ currentHealthCondition: string,
+ ongoingMedication: string,
+ allergies: string,
+ medicalHistory: string[],
+ subscriberId: string,
+ policyId: string,
+ insuranceId: string,
+ insuranceName: string
+ ) {
+ cy.wait(10000);
+ cy.get("#address").scrollIntoView();
+ cy.get("#address").should("be.visible");
+ cy.get("#address").type(address);
+ cy.get("[data-testid=name] input").clear();
+ cy.get("[data-testid=name] input").type(patientName);
+ cy.get("#phone_number-div").clear();
+ cy.get("#phone_number-div").type("+91").type(phoneNumber);
+ cy.get("#emergency_phone_number-div").clear();
+ cy.get("#emergency_phone_number-div")
+ .type("+91")
+ .type(emergencyPhoneNumber);
+ cy.get("#present_health").type(currentHealthCondition);
+ cy.get("#ongoing_medication").type(ongoingMedication);
+ cy.get("#allergies").type(allergies);
+ cy.get("[name=medical_history_check_1]").uncheck();
+ cy.get("[name=medical_history_check_2]").check();
+ cy.get("#medical_history_2").type(medicalHistory[0]);
+ cy.get("[name=medical_history_check_3]").check();
+ cy.get("#medical_history_3").type(medicalHistory[1]);
+ cy.get("button").get("[data-testid=add-insurance-button]").click();
+ cy.get("#subscriber_id").type(subscriberId);
+ cy.get("#policy_id").type(policyId);
+ cy.get("#insurer_id").type(insuranceId);
+ cy.get("#insurer_name").type(insuranceName);
+ cy.get("[data-testid=blood-group] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(bloodGroup).click();
+ });
+ }
+
+ clickUpdatePatient() {
+ cy.intercept("PUT", "**/api/v1/patient/**").as("updatePatient");
+ cy.get("button").get("[data-testid=submit-button]").click();
+ cy.wait("@updatePatient").its("response.statusCode").should("eq", 200);
+ }
+
+ verifyPatientUpdated() {
+ cy.url().should("include", "/patient");
+ }
+
+ saveUpdatedPatientUrl() {
+ cy.url().then((url) => {
+ cy.log(url);
+ patient_url = url.split("/").slice(0, -1).join("/");
+ cy.log(patient_url);
+ });
+ }
+
+ visitUpdatedPatient() {
+ cy.awaitUrl(patient_url);
+ }
+
+ verifyPatientDetails(
+ patientName: string,
+ phoneNumber: string,
+ presentHealth: string,
+ ongoingMedication: string,
+ allergies: string
+ ) {
+ cy.url().should("include", "/facility/");
+ cy.get("[data-testid=patient-dashboard]").should("contain", patientName);
+ cy.get("[data-testid=patient-dashboard]").should("contain", phoneNumber);
+ cy.get("[data-testid=patient-present-health]").should(
+ "contain",
+ presentHealth
+ );
+ cy.get("[data-testid=patient-ongoing-medication]").should(
+ "contain",
+ ongoingMedication
+ );
+ cy.get("[data-testid=patient-allergies]").should("contain", allergies);
+ }
+
+ visitConsultationPage() {
+ cy.visit(patient_url + "/consultation");
+ }
+}
diff --git a/cypress/pageobject/constants.ts b/cypress/pageobject/constants.ts
new file mode 100644
index 00000000000..72e0d31c662
--- /dev/null
+++ b/cypress/pageobject/constants.ts
@@ -0,0 +1,4 @@
+export const phone_number =
+ "9" + Math.floor(100000000 + Math.random() * 900000000);
+export const emergency_phone_number =
+ "9" + Math.floor(100000000 + Math.random() * 900000000);
diff --git a/src/Components/Assets/AssetImportModal.tsx b/src/Components/Assets/AssetImportModal.tsx
index b5b0110096a..548df2901ec 100644
--- a/src/Components/Assets/AssetImportModal.tsx
+++ b/src/Components/Assets/AssetImportModal.tsx
@@ -220,7 +220,7 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => {
-
+
{