Skip to content

Commit

Permalink
Merge pull request #7740 from coronasafe/staging
Browse files Browse the repository at this point in the history
Production Release v24.18.0
  • Loading branch information
gigincg authored Apr 30, 2024
2 parents 8b7b37c + c635344 commit 5845abf
Show file tree
Hide file tree
Showing 59 changed files with 2,247 additions and 1,353 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins:
eslint:
enabled: true
enabled: false
channel: "eslint-7"
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: "stale"
stale-pr-label: "stale"
stale-issue-message: "Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, @aparnacoronasafe, This issue has been automatically marked as stale because it has not had any recent activity."
stale-issue-message: "Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity."
stale-pr-message: "Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions."
close-pr-message: "Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, This pr has been automatically closed because it has not had any recent activity. Thank you for your contributions. Feel free to repopen the pr."
close-pr-message: "Hi, @coronasafe/care-frontend-maintainers, This PR has been automatically closed due to inactivity. Thank you for your contributions. Feel free to re-open the PR."
exempt-issue-labels: "blocked,waiting for related PR,waiting for back end,help wanted,work-in-progress,In Progress,wishlist,EPIC"
exempt-pr-labels: "tested,needs testing,need Review,waiting for related PR,waiting for back end,help wanted,blocked,work-in-progress,In Progress"
days-before-issue-stale: 14
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/external_results_spec/external_result.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe("Edit Profile Testing", () => {
cy.intercept("POST", "/api/v1/external_result/bulk_upsert").as("import");
cy.get("div").contains("Import/Export").click();
cy.get("div").contains("Import Results").click();
cy.get("[id=result-upload]")
.selectFile("cypress/fixtures/externalresultsample.csv")
cy.get("[data-testid=import-file]")
.selectFile("cypress/fixtures/externalresultsample.csv", { force: true })
.wait(100);
cy.get("button").contains("Save").click();
cy.submitButton("Import");
cy.wait("@import").then((interception) => {
expect(interception.response.statusCode).to.equal(202);
});
Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ describe("Facility Creation", () => {
facilityPage.clickConfigureFacilityOption();
facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live");
facilityPage.clickupdateMiddleWare();
facilityPage.verifySuccessNotification("Facility updated successfully");
facilityPage.verifySuccessNotification(
"Facility middleware updated successfully"
);
});

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Facility Manage Functions", () => {
const facilityMiddleware = "dev-middleware.coronasafe.live";
const facilityUpdatedMiddleware = "updated.coronasafe.live";
const facilityMiddlewareSuccessfullNotification =
"Facility updated successfully";
"Facility middleware updated successfully";
const facilityHfridUpdateButton = "Link Health Facility";
const facilityHfridToastNotificationText =
/Health Facility config updated successfully|Health ID registration failed/;
Expand Down
16 changes: 11 additions & 5 deletions cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room"
);
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
patientConsultationPage.typePatientIllnessHistory(patientIllnessHistory);
patientConsultationPage.typePatientExaminationHistory(
patientExaminationHistory
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room"
);
// Asymptomatic
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
// CRITICAL category
patientConsultationPage.selectPatientCategory("Critical");
patientConsultationPage.selectPatientSuggestion("Declare Death");
Expand Down Expand Up @@ -234,7 +234,7 @@ describe("Patient Consultation in multiple combination", () => {
);
patientConsultationPage.selectPatientWard("Dummy Location 1");
// Asymptomatic
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
// Abnormal category
patientConsultationPage.selectPatientCategory("Abnormal");
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
Expand Down Expand Up @@ -294,7 +294,10 @@ describe("Patient Consultation in multiple combination", () => {
// verify the free text in referring facility name
patientConsultationPage.typeReferringFacility("Life Care Hospital");
// Vomiting and Nausea symptoms
patientConsultationPage.selectSymptoms(["VOMITING", "SORE THROAT"]);
patientConsultationPage.typeAndMultiSelectSymptoms("s", [
"SPUTUM",
"SORE THROAT",
]);
// Stable category
patientConsultationPage.selectPatientCategory("Stable");
// Date of symptoms
Expand Down Expand Up @@ -339,7 +342,10 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room"
);
// Select the Symptoms - Sore throat and fever symptoms
patientConsultationPage.selectSymptoms(["FEVER", "SORE THROAT"]);
patientConsultationPage.typeAndMultiSelectSymptoms("b", [
"BREATHLESSNESS",
"BLEEDING",
]);
// Comfort Care category
patientConsultationPage.selectPatientCategory("Comfort Care");
// Date of symptoms
Expand Down
127 changes: 127 additions & 0 deletions cypress/e2e/patient_spec/patient_discharge.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import PatientDischarge from "../../pageobject/Patient/PatientDischarge";
import PatientPrescription from "../../pageobject/Patient/PatientPrescription";

describe("Patient Discharge based on multiple reason", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientDischarge = new PatientDischarge();
const patientPrescription = new PatientPrescription();
const patientDischargeReason1 = "Recovered";
const patientDischargeReason2 = "Referred";
const patientDischargeReason3 = "Expired";
const patientDischargeReason4 = "LAMA";
const patientDischargeAdvice = "Discharge Advice";
const patientMedicine = "ZOLE";
const referringFacility = "Dummy Shifting Center, Ernakulam";
const referringFreetextFacility = "Aster Mims";
const patientDeathCause = "Cause Of Death";
const doctorName = "Custom Doctor";

before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/patients");
});

it("Discharge a LAMA patient in the consultation", () => {
patientPage.visitPatient("Dummy Patient 12");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason4);
cy.submitButton("Confirm Discharge");
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["LAMA"]);
// verify the discharge information card
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason4,
]);
});

it("Discharge a expired patient in the consultation", () => {
patientPage.visitPatient("Dummy Patient 13");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason3);
patientDischarge.typeDischargeNote(patientDeathCause);
patientDischarge.typeDoctorName(doctorName);
cy.submitButton("Confirm Discharge");
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["EXPIRED"]);
// verify the discharge information card
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason3,
patientDeathCause,
doctorName,
]);
});

it("Discharge patient with referred reason to a facility", () => {
patientPage.visitPatient("Dummy Patient 16");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason2);
patientDischarge.typeDischargeNote(patientDischargeAdvice);
// select a registrated facility from dropdown and clear
patientDischarge.typeReferringFacility(referringFacility);
patientDischarge.clickClearButton();
// select a non-registered facility and perform the discharge
patientDischarge.typeReferringFacility(referringFreetextFacility);
cy.wait(2000);
cy.submitButton("Confirm Discharge");
cy.wait(2000);
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["Referred"]);
// Verify the dashboard and discharge information
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason2,
patientDischargeAdvice,
referringFreetextFacility,
]);
});

it("Discharge a recovered patient with all relevant fields", () => {
patientPage.visitPatient("Dummy Patient 15");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason1);
patientDischarge.typeDischargeNote(patientDischargeAdvice);
// Prescribe a medicine for the patient
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(patientMedicine);
patientPrescription.enterDosage("4");
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.wait(2000);
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["Recovered"]);
// Verify the dashboard and discharge information
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason1,
patientDischargeAdvice,
patientMedicine,
]);
});

afterEach(() => {
cy.saveLocalStorage();
});
});
8 changes: 0 additions & 8 deletions cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ describe("Patient", () => {
cy.verifyNotification("Medicine prescribed");
});

it("Discharge a patient", () => {
patientPage.visitPatient("Dummy Patient 6");
patientConsultationPage.clickDischargePatient();
patientConsultationPage.selectDischargeReason("Recovered");
patientConsultationPage.addDischargeNotes("Discharge notes");
patientConsultationPage.confirmDischarge();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Manage User", () => {
cy.awaitUrl("/users");
});

it("linking skills for a users and verify its reflection in profile", () => {
it("linking skills for users and verify its reflection in profile", () => {
// select the district user and select one skill link and verify its profile reflection
userPage.typeInSearchInput(usernameforworkinghour);
userPage.checkUsernameText(usernameforworkinghour);
Expand All @@ -49,7 +49,7 @@ describe("Manage User", () => {
manageUserPage.navigateToProfile();
userCreationPage.verifyElementContainsText(
"username-profile-details",
usernameforworkinghour
usernameforworkinghour,
);
manageUserPage.assertSkillInAlreadyLinkedSkills(linkedskill);
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/externalresultsample.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
District,srf id,name,age,age in,gender,mobile number,address,ward,local body,local body type,source,Sample Collection Date,result date,test type,lab name,sample type,patient status,Is Repeat,patient category,result
District,SRF ID,Name,Age,Age in,Gender,Mobile Number,Address,Ward,Local Body,Local Body Type,Source,Sample Collection Date,Result Date,Test Type,Lab Name,Sample Type,Patient Status,Is Repeat,Patient Category,Result
Ernakulam,00/EKM/0000,Test Upload,24,years,m,8888888888,Upload test address,7,Poothrikka,grama panchayath,Secondary contact aparna,2020-10-14,2020-10-14,Antigen,Karothukuzhi Laboratory,Ag-SD_Biosensor_Standard_Q_COVID-19_Ag_detection_kit,Asymptomatic,NO,Cat 17: All individuals who wish to get themselves tested,Negative
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class AssetPage {
}

importAssetFile() {
cy.get("[data-testid=import-asset-file]")
cy.get("[data-testid=import-file]")
.selectFile("cypress/fixtures/sampleAsset.xlsx", { force: true })
.wait(100);
}
Expand Down
32 changes: 4 additions & 28 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export class PatientConsultationPage {
selectSymptoms(symptoms) {
cy.clickAndMultiSelectOption("#symptoms", symptoms);
}

typeAndMultiSelectSymptoms(input, symptoms) {
cy.typeAndMultiSelectOption("#symptoms", input, symptoms);
}
selectSymptomsDate(selector: string, date: string) {
cy.clickAndTypeDate(selector, date);
}
Expand Down Expand Up @@ -100,7 +102,7 @@ export class PatientConsultationPage {
cy.get("button").contains("Manage Patient").click();
cy.verifyAndClickElement(
"#consultation-buttons",
"Edit Consultation Details"
"Edit Consultation Details",
);
cy.wait(3000);
}
Expand Down Expand Up @@ -130,30 +132,4 @@ export class PatientConsultationPage {
cy.get("#add_doctor_note_button").click();
cy.wait("@postDoctorNotes").its("response.statusCode").should("eq", 201);
}

clickDischargePatient() {
cy.get("#show-more").scrollIntoView();
cy.get("#show-more").click();
cy.contains("p", "Discharge from CARE").click();
}

selectDischargeReason(reason: string) {
cy.get("#discharge_reason")
.click()
.then(() => {
cy.get("[role='option']").contains(reason).click();
});
}

addDischargeNotes(notes: string) {
cy.get("#discharge_notes").type(notes);
}

confirmDischarge() {
cy.intercept("POST", "**/api/v1/consultation/*/discharge_patient/").as(
"dischargePatient"
);
cy.get("#submit").contains("Confirm Discharge").click();
cy.wait("@dischargePatient").its("response.statusCode").should("eq", 200);
}
}
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class PatientPage {
}

selectPatientOccupation(occupation: string) {
cy.clickAndSelectOption("#occupation", occupation);
cy.searchAndSelectOption("#occupation", occupation);
}

clickCreatePatient() {
Expand Down
29 changes: 29 additions & 0 deletions cypress/pageobject/Patient/PatientDischarge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class PatientDischarge {
clickDischarge() {
cy.get("#show-more").scrollIntoView();
cy.verifyAndClickElement("#show-more", "Manage Patient");
cy.verifyAndClickElement("#show-more", "Discharge from CARE");
}

selectDischargeReason(reason: string) {
cy.clickAndSelectOption("#discharge_reason", reason);
}

typeDischargeNote(note: string) {
cy.get("#discharge_notes").type(note);
}

typeReferringFacility(facility: string) {
cy.searchAndSelectOption("#facility-referredto", facility);
}

clickClearButton() {
cy.get("#clear-button").click();
}

typeDoctorName(doctorName: string) {
cy.get("#death_confirmed_by").type(doctorName);
}
}

export default PatientDischarge;
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PatientLogupdate {
}

typeAdditionalSymptoms(symptoms: string) {
cy.clickAndSelectOption("#additional_symptoms", symptoms);
cy.searchAndSelectOption("#additional_symptoms", symptoms);
}

typeSystolic(systolic: string) {
Expand Down
15 changes: 15 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ Cypress.Commands.add(
});
}
);
Cypress.Commands.add(
"typeAndMultiSelectOption",
(selector: string, input: string, options: string | string[]) => {
const optionArray = Array.isArray(options) ? options : [options];
cy.get(selector)
.click()
.type(input)
.then(() => {
optionArray.forEach((options) => {
cy.get("[role='option']").contains(options).click();
});
cy.get(selector).click();
});
}
);

Cypress.Commands.add(
"clickAndSelectOption",
Expand Down
Loading

0 comments on commit 5845abf

Please sign in to comment.