Skip to content

Commit

Permalink
Merge branch 'develop' into location_question
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Feb 6, 2025
2 parents d3a677f + 85866da commit d97a09e
Show file tree
Hide file tree
Showing 54 changed files with 2,367 additions and 1,474 deletions.
5 changes: 2 additions & 3 deletions cypress/e2e/patient_spec/patient_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
PatientFormData,
patientCreation,
} from "@/pageObject/Patients/PatientCreation";
import { patientDashboard } from "@/pageObject/Patients/PatientDashboard";
import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter";
import { patientVerify } from "@/pageObject/Patients/PatientVerify";
import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
Expand Down Expand Up @@ -126,7 +125,7 @@ describe("Patient Management", () => {
.clickSubmitEncounter()
.assertEncounterCreationSuccess();

patientDashboard.verifyEncounterPatientInfo([
patientEncounter.verifyEncounterPatientInfo([
ENCOUNTER_TYPE,
ENCOUNTER_STATUS,
ENCOUNTER_PRIORITY,
Expand Down Expand Up @@ -154,7 +153,7 @@ describe("Patient Management", () => {
.clickSubmitEncounter()
.assertEncounterCreationSuccess();

patientDashboard.verifyEncounterPatientInfo([
patientEncounter.verifyEncounterPatientInfo([
ENCOUNTER_TYPE,
ENCOUNTER_STATUS,
ENCOUNTER_PRIORITY,
Expand Down
35 changes: 35 additions & 0 deletions cypress/e2e/patient_spec/patient_details.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { PatientDetails } from "@/pageObject/Patients/PatientDetails";
import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter";
import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";

const facilityCreation = new FacilityCreation();
const patientEncounter = new PatientEncounter();
const patientDetails = new PatientDetails();

describe("Patient Management", () => {
beforeEach(() => {
cy.loginByApi("devdoctor");
cy.visit("/");
});

it("Assign users to a patient", () => {
const userName = "nihal-nurse";
const userRole = "Nurse";
facilityCreation.selectFacility("GHC Trikaripur");
patientEncounter
.navigateToEncounters()
.openFirstEncounterDetails()
.clickPatientDetailsButton();
patientDetails
.clickUsersTab()
.clickAssignUserButton()
.selectUserToAssign(userName)
.selectUserRole(userRole)
.confirmUserAssignment()
.verifyUserAssignmentSuccess()
.verifyUserContent([userName])
.clickRemoveUserButton()
.confirmUserRemoval()
.verifyUserRemovalSuccess();
});
});
4 changes: 4 additions & 0 deletions cypress/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
"devnurse": {
"username": "dev-nurse",
"password": "Test@123"
},
"devdoctor": {
"username": "developdoctor",
"password": "Test@123"
}
}
8 changes: 0 additions & 8 deletions cypress/pageObject/Patients/PatientDashboard.ts

This file was deleted.

61 changes: 61 additions & 0 deletions cypress/pageObject/Patients/PatientDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export class PatientDetails {
clickUsersTab() {
cy.verifyAndClickElement('[data-cy="tab-users"]', "Users");
return this;
}

clickAssignUserButton() {
cy.verifyAndClickElement('[data-cy="assign-user-button"]', "Assign User");
return this;
}

selectUserToAssign(username: string) {
cy.typeAndSelectOption(
'[data-cy="patient-user-selector-container"]',
username,
false,
);
return this;
}

selectUserRole(role: string) {
cy.clickAndSelectOption('[data-cy="patient-user-role-select"]', role);
return this;
}

confirmUserAssignment() {
cy.verifyAndClickElement(
'[data-cy="patient-user-assign-button"]',
"Assign to Patient",
);
return this;
}

verifyUserAssignmentSuccess() {
cy.verifyNotification("User added to patient successfully");
return this;
}

clickRemoveUserButton() {
cy.get('[data-cy="patient-user-remove-button"]').first().click();
return this;
}

confirmUserRemoval() {
cy.verifyAndClickElement(
'[data-cy="patient-user-remove-confirm-button"]',
"Remove",
);
return this;
}

verifyUserContent(expectedTexts: string[]) {
cy.verifyContentPresence('[data-cy="patient-users"]', expectedTexts);
return this;
}

verifyUserRemovalSuccess() {
cy.verifyNotification("User removed successfully");
return this;
}
}
5 changes: 5 additions & 0 deletions cypress/pageObject/Patients/PatientEncounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class PatientEncounter {
return this;
}

verifyEncounterPatientInfo(contents: string[]) {
cy.verifyContentPresence("#patient-infobadges", contents);
return this;
}

// Questionnaire actions
addQuestionnaire(questionnaireName: string) {
cy.get('[data-cy="add-questionnaire-button"]').click();
Expand Down
Loading

0 comments on commit d97a09e

Please sign in to comment.