Skip to content

Commit

Permalink
fix the cypress failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Sep 24, 2024
1 parent 6a60d96 commit 7714369
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ REACT_APP_COVER_IMAGE_ALT=https://cdn.ohc.network/care_logo.svg
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
Expand Down
191 changes: 99 additions & 92 deletions cypress/e2e/patient_spec/PatientLogUpdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
const patientLogupdate = new PatientLogupdate();
const patientInvestigation = new PatientInvestigation();
const patientPrescription = new PatientPrescription();
const domicilaryPatient = "Dummy Patient 11";
const patientCategory = "Moderate";
const additionalSymptoms = "Fever";
const physicalExamination = "physical examination details";
Expand All @@ -33,6 +32,14 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
const patientInsulinDosage = "56";
const patientFluidBalance = "500";
const patientNetBalance = "1000";
const patientOne = "Dummy Patient 9";
const bedOne = "Dummy Bed 5";
const patientTwo = "Dummy Patient 10";
const bedTwo = "Dummy Bed 2";
const patientThree = "Dummy Patient 8";
const bedThree = "Dummy Bed 3";
const patientFour = "Dummy Patient 12";
const domicilaryPatient = "Dummy Patient 11";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -45,15 +52,83 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
cy.awaitUrl("/patients");
});

it("Create a basic critical care log update for a admitted patient and edit it", () => {
patientPage.visitPatient("Dummy Patient 10");
it("Create a new Progress log update for a admitted patient and edit it", () => {
patientPage.visitPatient(patientOne);
patientLogupdate.clickLogupdate();
cy.verifyNotification("Please assign a bed to the patient");
patientLogupdate.selectBed("Dummy Bed 2");
patientLogupdate.selectBed(bedOne);
cy.closeNotification();
patientLogupdate.clickLogupdate();
// Only will be using random non-unique progress note fields
patientLogupdate.selectRoundType("Progress Note");
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.selectSymptomsDate("01012024");
patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]);
patientLogupdate.typeTemperature(patientTemperature);
// add diagnosis
patientConsultationPage.selectPatientDiagnosis(
"1A06",
"add-icd11-diagnosis-as-differential",
);
// add a investigation for the patient
patientInvestigation.clickAddInvestigation();
patientInvestigation.selectInvestigation("Vitals (GROUP)");
patientInvestigation.clickInvestigationCheckbox();
patientInvestigation.selectInvestigationFrequency("6");
// add a medicine for the patient
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine("DOLO");
patientPrescription.enterDosage("4");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.closeNotification();
// Submit the doctors log update
cy.submitButton("Save and Continue");
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.submitButton("Update Details");
cy.verifyNotification(
"Neurological Monitoring details succesfully updated.",
);
cy.closeNotification();
// Final Submission of the form
cy.submitButton("Complete");
cy.verifyNotification("Progress Note Log Update filed successfully");
cy.closeNotification();
// Verify the data reflection
cy.contains("button", "Daily Rounds").click();
patientLogupdate.clickLogUpdateViewDetails(
"#dailyround-entry",
patientCategory,
);
cy.verifyContentPresence("#consultation-preview", [
patientCategory,
patientTemperature,
]);
// verify the edit functionality
patientLogupdate.clickUpdateDetail();
patientLogupdate.typeSystolic(patientModifiedSystolic);
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.verifyNotification("Progress Note updated successfully");
});

it("Create a basic critical care log update for a admitted patient and edit it", () => {
patientPage.visitPatient(patientTwo);
patientLogupdate.clickLogupdate();
cy.verifyNotification("Please assign a bed to the patient");
patientLogupdate.selectBed(bedTwo);
cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.selectRoundType("Detailed Update");
patientLogupdate.selectPatientCategory(patientCategory);
cy.submitButton("Save and Continue");
cy.verifyNotification("Detailed Update created successfully");
cy.closeNotification();
Expand Down Expand Up @@ -127,76 +202,38 @@ 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("Dummy Patient 12");
it("Create a new Normal update for a admission patient and verify its reflection in cards", () => {
patientPage.visitPatient(patientThree);
patientLogupdate.clickLogupdate();
cy.verifyNotification("Please assign a bed to the patient");
patientLogupdate.selectBed("Dummy Bed 4");
patientLogupdate.selectBed(bedThree);
cy.closeNotification();
patientLogupdate.clickLogupdate();
// Only will be using random non-unique progress note fields
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.selectRoundType("Progress Note");
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.selectSymptomsDate("01012024");
patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]);
patientLogupdate.clickAddSymptom();
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
patientLogupdate.typeTemperature(patientTemperature);
// add diagnosis
patientConsultationPage.selectPatientDiagnosis(
"1A06",
"add-icd11-diagnosis-as-differential",
);
// add a investigation for the patient
patientInvestigation.clickAddInvestigation();
patientInvestigation.selectInvestigation("Vitals (GROUP)");
patientInvestigation.clickInvestigationCheckbox();
patientInvestigation.selectInvestigationFrequency("6");
// add a medicine for the patient
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine("DOLO");
patientPrescription.enterDosage("4");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.closeNotification();
// Submit the doctors log update
cy.submitButton("Save and Continue");
cy.verifyNotification("Progress Note created successfully");
cy.closeNotification();
// modify the relevant critical care log update
patientLogupdate.selectCriticalCareSection("Neurological Monitoring");
patientLogupdate.typeRespiratory(patientRespiratory);
patientLogupdate.typeSpo2(patientSpo2);
patientLogupdate.selectRhythm(patientRhythmType);
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-option-RESPONDS_TO_PAIN").click();
cy.get("#left_pupil_light_reaction-option-FIXED").click();
cy.submitButton("Update Details");
cy.verifyNotification(
"Neurological Monitoring details succesfully updated.",
);
cy.closeNotification();
// Final Submission of the form
cy.submitButton("Complete");
cy.verifyNotification("Progress Note Log Update filed successfully");
cy.closeNotification();
// Verify the data reflection
cy.contains("button", "Daily Rounds").click();
patientLogupdate.clickLogUpdateViewDetails(
"#dailyround-entry",
patientCategory,
);
cy.verifyContentPresence("#consultation-preview", [
patientCategory,
patientTemperature,
]);
// verify the edit functionality
patientLogupdate.clickUpdateDetail();
patientLogupdate.typeSystolic(patientModifiedSystolic);
patientLogupdate.typeDiastolic(patientModifiedDiastolic);
cy.submitButton("Continue");
cy.verifyNotification("Progress Note updated successfully");
cy.submitButton("Save");
cy.wait(2000);
cy.verifyNotification("Brief Update created successfully");
// Verify the card content
cy.get("#basic-information").scrollIntoView();
cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]);
});

it("Create a new TeleIcu log update for a domicilary care patient", () => {
patientPage.visitPatient("Dummy Patient 11");
patientPage.visitPatient(patientFour);
patientConsultationPage.clickEditConsultationButton();
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
cy.submitButton("Update Consultation");
Expand Down Expand Up @@ -283,36 +320,6 @@ 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("Dummy Patient 13");
patientLogupdate.clickLogupdate();
cy.verifyNotification("Please assign a bed to the patient");
patientLogupdate.selectBed("Dummy Bed 6");
cy.closeNotification();
patientLogupdate.clickLogupdate();
patientLogupdate.typePhysicalExamination(physicalExamination);
patientLogupdate.typeOtherDetails(otherExamination);
patientLogupdate.selectSymptomsDate("01012024");
patientLogupdate.typeAndMultiSelectSymptoms("fe", ["Fever"]);
patientLogupdate.clickAddSymptom();
patientLogupdate.selectPatientCategory(patientCategory);
patientLogupdate.typeSystolic(patientSystolic);
patientLogupdate.typeDiastolic(patientDiastolic);
patientLogupdate.typePulse(patientPulse);
patientLogupdate.typeTemperature(patientTemperature);
patientLogupdate.typeRespiratory(patientRespiratory);
patientLogupdate.typeSpo2(patientSpo2);
patientLogupdate.selectRhythm(patientRhythmType);
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();
cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]);
});

it("Create a Normal Log update to verify MEWS Score Functionality", () => {
patientPage.visitPatient(domicilaryPatient);
patientConsultationPage.clickEditConsultationButton();
Expand Down
19 changes: 15 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.13",
"@types/cypress": "^1.1.3",
"@types/events": "^3.0.3",
"@types/google.maps": "^3.55.8",
"@types/lodash-es": "^4.17.12",
Expand All @@ -103,7 +104,7 @@
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"autoprefixer": "^10.4.19",
"cypress": "^13.14.1",
"cypress": "^13.14.2",
"cypress-localstorage-commands": "^2.2.5",
"cypress-split": "^1.23.2",
"eslint-config-prettier": "^9.1.0",
Expand Down

0 comments on commit 7714369

Please sign in to comment.