Skip to content

Commit

Permalink
Merge branch 'develop' into issue-ohcnetwork#10074
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishith25 committed Jan 23, 2025
2 parents 194ecb3 + 074d97a commit 4bda006
Show file tree
Hide file tree
Showing 66 changed files with 1,413 additions and 1,064 deletions.
8 changes: 5 additions & 3 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FacilityCreation } from "../../pageObject/facility/FacilityCreation";
import { generatePhoneNumber } from "../../utils/commonUtils";
import { generateFacilityData } from "../../utils/facilityData";
import { FacilityCreation } from "pageObject/facility/FacilityCreation";
import { generatePhoneNumber } from "utils/commonUtils";
import { generateFacilityData } from "utils/facilityData";

const LOCATION_HIERARCHY = {
localBody: "Aluva",
Expand All @@ -12,6 +12,8 @@ describe("Facility Management", () => {
const facilityType = "Primary Health Centre";

beforeEach(() => {
// Set larger viewport to ensure all elements are visible
cy.viewport(1920, 1080);
cy.visit("/login");
cy.loginByApi("nurse");
});
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/patient_spec/patient_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { patientCreation } from "pageObject/Patients/PatientCreation";
import { patientDashboard } from "pageObject/Patients/PatientDashboard";
import { patientVerify } from "pageObject/Patients/PatientVerify";
import { FacilityCreation } from "pageObject/facility/FacilityCreation";

import {
generateAddress,
generateName,
generatePhoneNumber,
} from "../../utils/commonUtils";
} from "utils/commonUtils";

const facilityCreation = new FacilityCreation();
const ENCOUNTER_TYPE = "Observation";
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { UserCreation } from "../../pageObject/Users/UserCreation";
import { FacilityCreation } from "../../pageObject/facility/FacilityCreation";
import { UserCreation } from "pageObject/Users/UserCreation";
import { FacilityCreation } from "pageObject/facility/FacilityCreation";
import {
generateName,
generatePhoneNumber,
generateUsername,
} from "../../utils/commonUtils";
} from "utils/commonUtils";

describe("User Creation", () => {
const facilityCreation = new FacilityCreation();
Expand All @@ -30,8 +30,8 @@ describe("User Creation", () => {
confirmPassword: defaultPassword,
email: `${generateUsername(firstName)}@test.com`,
phoneNumber: generatePhoneNumber(),
dateOfBirth: "1990-01-01",
userType: "Doctor",
gender: "Male",
state: "Kerala",
district: "Ernakulam",
localBody: "Aluva",
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageObject/Patients/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class PatientCreation {
}

selectLocalBody(localBody: string) {
cy.typeAndSelectOption('[data-cy="select-local_body"]', localBody);
cy.typeAndSelectOption('[data-cy="select-local_body"]', localBody, false);
return this;
}

Expand Down
17 changes: 8 additions & 9 deletions cypress/pageObject/Users/UserCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export interface UserData {
password?: string;
email?: string;
phoneNumber?: string;
dateOfBirth?: string;
userType?: string;
state?: string;
district?: string;
localBody?: string;
ward?: string;
gender?: string;
}

export class UserCreation {
Expand Down Expand Up @@ -78,17 +78,11 @@ export class UserCreation {
label: "Alternate Phone Number",
message: "Phone number must start with +91 followed by 10 digits",
},
{ label: "Date of Birth", message: "Required" },
{ label: "State", message: "Required" },
]);
return this;
}

fillDateOfBirth(dateOfBirth: string) {
cy.typeIntoField('[data-cy="dob-input"]', dateOfBirth);
return this;
}

selectUserType(userType: string) {
cy.clickAndSelectOption('[data-cy="user-type-select"]', userType);
return this;
Expand All @@ -105,7 +99,7 @@ export class UserCreation {
}

selectLocalBody(localBody: string) {
cy.clickAndSelectOption('[data-cy="select-local_body"]', localBody);
cy.typeAndSelectOption('[data-cy="select-local_body"]', localBody, false);
return this;
}

Expand All @@ -114,6 +108,11 @@ export class UserCreation {
return this;
}

selectGender(gender: string) {
cy.clickAndSelectOption('[data-cy="gender-select"]', gender);
return this;
}

fillUserDetails(userData: UserData & { confirmPassword?: string }) {
if (userData.userType) this.selectUserType(userData.userType);
if (userData.firstName) this.fillFirstName(userData.firstName);
Expand All @@ -125,7 +124,7 @@ export class UserCreation {
}
if (userData.email) this.fillEmail(userData.email);
if (userData.phoneNumber) this.fillPhoneNumber(userData.phoneNumber);
if (userData.dateOfBirth) this.fillDateOfBirth(userData.dateOfBirth);
if (userData.gender) this.selectGender(userData.gender);
if (userData.state) this.selectState(userData.state);
if (userData.district) this.selectDistrict(userData.district);
if (userData.localBody) this.selectLocalBody(userData.localBody);
Expand Down
8 changes: 7 additions & 1 deletion cypress/pageObject/facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ export class FacilityCreation {
}

fillLocationHierarchy(location: { localBody: string; ward: string }) {
cy.typeAndSelectOption('[data-cy="select-local_body"]', location.localBody);
// Don't verify selection for local body (false parameter)
cy.typeAndSelectOption(
'[data-cy="select-local_body"]',
location.localBody,
false,
);
// Verify selection for ward (default behavior)
cy.typeAndSelectOption('[data-cy="select-ward"]', location.ward);
return this;
}
Expand Down
35 changes: 23 additions & 12 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,30 @@ Cypress.Commands.add("clickCancelButton", (buttonText = "Cancel") => {

Cypress.Commands.add(
"typeAndSelectOption",
(selector: string, value: string) => {
(selector: string, value: string, verify: boolean = true) => {
// Click to open the dropdown
cy.get(selector).click();

// Type in the command input
cy.get("[cmdk-input]").should("be.visible").clear().type(value);

// Select the filtered option from command menu
cy.get("[cmdk-list]")
.find("[cmdk-item]")
.contains(value)
.should("be.visible")
.click();
cy.get(selector)
.click()
.then(() => {
// Type in the command input
cy.get("[cmdk-input]")
.should("be.visible")
.type(value)
.then(() => {
// Select the filtered option from command menu
cy.get("[cmdk-list]")
.find("[cmdk-item]")
.contains(value)
.should("be.visible")
.click()
.then(() => {
// Verify the selected value is present in the selector (if verify is true)
if (verify) {
cy.get(selector).should("contain", value);
}
});
});
});
},
);

Expand Down
3 changes: 2 additions & 1 deletion cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ declare global {
clickCancelButton(buttonText?: string): Chainable<Element>;
typeAndSelectOption(
element: string,
referance: string,
reference: string,
skipVerification?: boolean,
): Chainable<Element>;
clickAndMultiSelectOption(
selector: string,
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"react-hook-form": "^7.53.2",
"react-i18next": "^15.2.0",
"react-infinite-scroll-component": "^6.1.0",
"react-intersection-observer": "^9.15.0",
"react-intersection-observer": "^9.15.1",
"react-pdf": "^9.2.1",
"react-webcam": "^7.2.0",
"recharts": "^2.15.0",
Expand Down
17 changes: 17 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
"add_skill": "Add Skill",
"add_spoke": "Add Spoke Facility",
"add_tags": "Add Tags",
"add_user": "Add User",
"additional_information": "Additional Information",
"additional_instructions": "Additional Instructions",
"address": "Address",
Expand Down Expand Up @@ -380,6 +381,7 @@
"all_patients": "All Patients",
"allergen": "Allergen",
"allergies": "Allergies",
"allergies_empty_message": "No allergies recorded",
"allow_transfer": "Allow Transfer",
"allowed_formats_are": "Allowed formats are {{formats}}.",
"already_a_member": "Already a member?",
Expand Down Expand Up @@ -454,6 +456,7 @@
"audit_log": "Audit Log",
"auth_login_title": "Authorized Login",
"auth_method_unsupported": "This authentication method is not supported, please try a different method",
"authored_on": "Authored On",
"authorize_shift_delete": "Authorize shift delete",
"auto_generated_for_care": "Auto Generated for Care",
"autofilled_fields": "Autofilled Fields",
Expand Down Expand Up @@ -702,15 +705,18 @@
"create_tag": "Create Tag",
"create_template": "Create Template",
"create_user": "Create User",
"create_user_and_add_to_org": "Create a new user and add them to the organization.",
"created": "Created",
"created_by": "Created By",
"created_date": "Created Date",
"created_on": "Created On",
"creating": "Creating...",
"creating_facility": "Creating Facility...",
"critical": "Critical",
"criticality": "Criticality",
"csv_file_in_the_specified_format": "Select a CSV file in the specified format",
"current_address": "Current Address",
"current_organizations": "Current Organizations",
"current_password": "Current Password",
"current_role": "Current Role",
"current_status": "Current Status",
Expand Down Expand Up @@ -764,6 +770,7 @@
"diagnosis__unconfirmed": "Unconfirmed",
"diagnosis_already_added": "This diagnosis was already added",
"diagnosis_at_discharge": "Diagnosis at Discharge",
"diagnosis_empty_message": "No diagnoses recorded",
"diastolic": "Diastolic",
"didnt_receive_a_message": "Didn't receive a message?",
"diet_preference": "Diet Preference",
Expand Down Expand Up @@ -831,6 +838,7 @@
"edit_profile": "Edit Profile",
"edit_role": "Edit Role",
"edit_schedule_template": "Edit Schedule Template",
"edit_user": "Edit User",
"edit_user_profile": "Edit Profile",
"edit_user_role": "Edit User Role",
"edited_by": "Edited by",
Expand Down Expand Up @@ -904,6 +912,7 @@
"encounter_discharge_disposition__snf": "Skilled nursing facility",
"encounter_duration_confirmation": "The duration of this encounter would be",
"encounter_id": "Encounter ID",
"encounter_manage_organization_description": "Add or remove organizations from this encouter",
"encounter_marked_as_complete": "Encounter Completed",
"encounter_notes__all_discussions": "All Discussions",
"encounter_notes__be_first_to_send": "Be the first to send a message",
Expand Down Expand Up @@ -1232,6 +1241,7 @@
"last_modified": "Last Modified",
"last_modified_by": "Last Modified By",
"last_name": "Last Name",
"last_occurrence": "Last Occurrence",
"last_online": "Last Online",
"last_serviced_on": "Last Serviced On",
"last_updated_by": "Last updated by",
Expand Down Expand Up @@ -1375,6 +1385,7 @@
"next_week_short": "Next wk",
"no": "No",
"no_address_provided": "No address provided",
"no_allergies_recorded": "No allergies recorded",
"no_appointments": "No appointments found",
"no_attachments_found": "This communication has no attachments.",
"no_availabilities_yet": "No availabilities yet",
Expand Down Expand Up @@ -1406,6 +1417,7 @@
"no_notices_for_you": "No notices for you.",
"no_observations": "No Observations",
"no_ongoing_medications": "No Ongoing Medications",
"no_organizations_added_yet": "No organizations added yet",
"no_organizations_found": "No Organizations Found",
"no_organizations_selected": "No organizations selected",
"no_patient_record_found": "No Patient Records Found",
Expand Down Expand Up @@ -1768,6 +1780,7 @@
"required_quantity": "Required Quantity",
"reschedule": "Reschedule",
"reschedule_appointment": "Reschedule Appointment",
"reschedule_appointment_with": "Reschedule Appointment with",
"rescheduled": "Rescheduled",
"rescheduling": "Rescheduling...",
"resend_otp": "Resend OTP",
Expand Down Expand Up @@ -2014,6 +2027,7 @@
"subscribed_successfully": "Subscribed Successfully",
"subscription_error": "Subscription Error",
"subscription_failed": "Subscription Failed",
"substance": "Substance",
"suggested_investigations": "Suggested Investigations",
"suggestion": "Suggestion",
"summary": "Summary",
Expand All @@ -2023,6 +2037,7 @@
"switch_camera_is_not_available": "Switch camera is not available.",
"symptom": "Symptom",
"symptoms": "Symptoms",
"symptoms_empty_message": "No symptoms recorded",
"systolic": "Systolic",
"tachycardia": "Tachycardia",
"tag_name": "Tag Name",
Expand Down Expand Up @@ -2143,6 +2158,7 @@
"update_shift_request": "Update Shift Request",
"update_status": "Update Status",
"update_status_details": "Update Status/Details",
"update_user": "Update User",
"update_user_role_organization": "Update the role for this user in the organization",
"update_volunteer": "Reassign Volunteer",
"updated": "Updated",
Expand Down Expand Up @@ -2180,6 +2196,7 @@
"user_removed_success": "User removed from organization successfully",
"user_role_update_success": "User role updated successfully",
"user_type": "User Type",
"user_updated_successfully": "User updated successfully",
"username": "Username",
"username_already_exists": "This username already exists",
"username_available": "Username is available",
Expand Down
15 changes: 15 additions & 0 deletions src/Routers/PatientRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ const AppointmentRoutes = {
facilityId: string;
staffId: string;
}) => <ScheduleAppointment facilityId={facilityId} staffId={staffId} />,
"/facility/:facilityId/appointments/:staffId/reschedule/:appointmentId": ({
facilityId,
staffId,
appointmentId,
}: {
facilityId: string;
staffId: string;
appointmentId: string;
}) => (
<ScheduleAppointment
facilityId={facilityId}
staffId={staffId}
appointmentId={appointmentId}
/>
),
"/facility/:facilityId/appointments/:staffId/patient-select": ({
facilityId,
staffId,
Expand Down
Loading

0 comments on commit 4bda006

Please sign in to comment.