Skip to content

Commit

Permalink
Merge branch 'develop' into medicine-type-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Sep 4, 2023
2 parents 78082d9 + e21652b commit 1261de1
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 36 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("Asset", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"2021-12-25",
"25122021",
"Test note for asset creation!"
);

Expand All @@ -80,7 +80,7 @@ describe("Asset", () => {
"[email protected]",
"Vendor's Name",
serialNumber,
"2021-12-25",
"25122021",
"Test note for asset creation!"
);

Expand Down
15 changes: 8 additions & 7 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ 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 = "9430123487";
const emergency_phone_number =
"9" + Math.floor(100000000 + Math.random() * 900000000);
const yearOfBirth = "2023";
let patient_url = "";

Expand Down Expand Up @@ -104,9 +105,11 @@ describe("Patient Creation with consultation", () => {
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("+919846856666");
cy.get("#phone_number-div").type("+91").type(phone_number);
cy.get("#emergency_phone_number-div").clear();
cy.get("#emergency_phone_number-div").type("+919120330220");
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");
Expand Down Expand Up @@ -142,10 +145,7 @@ describe("Patient Creation with consultation", () => {
"contain",
"Test E2E User Edited"
);
cy.get("[data-testid=patient-dashboard]").should(
"contain",
"+919120330220"
);
cy.get("[data-testid=patient-dashboard]").should("contain", phone_number);
const patientDetails_values: string[] = [
"Severe Cough",
"Paracetamol",
Expand All @@ -165,6 +165,7 @@ describe("Patient Creation with consultation", () => {
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")
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/users_spec/user_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("User management", () => {
cy.intercept(/\/api\/v1\/facility/).as("facility");
cy.get("[name='facilities']")
.click()
.type("cypress facility")
.type("Dummy Facility 1")
.wait("@facility");
cy.get("li[role='option']").first().click();
cy.get("input[type='checkbox']").click();
Expand Down Expand Up @@ -93,7 +93,7 @@ describe("User management", () => {
cy.get("button[id='facilities']").click();
cy.wait("@userFacility")
.getAttached("div[id=facility_0] > div > span")
.contains("cypress facility");
.contains("Dummy Facility 1");
});
});

Expand All @@ -102,7 +102,7 @@ describe("User management", () => {
cy.intercept(/\/api\/v1\/facility/).as("getFacilities");
cy.get("[name='facility']")
.click()
.type("cypress facility")
.type("Dummy Facility 1")
.wait("@getFacilities");
cy.get("li[role='option']").first().click();
cy.intercept(/\/api\/v1\/users\/\w+\/add_facility\//).as("addFacility");
Expand Down
7 changes: 4 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export class AssetPage {
cy.get("[data-testid=asset-support-email-input] input").type(supportEmail);
cy.get("[data-testid=asset-vendor-name-input] input").type(vendorName);
cy.get("[data-testid=asset-serial-number-input] input").type(serialNumber);
cy.get("[data-testid=asset-last-serviced-on-input] input").type(
lastServicedOn
);
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").type(notes);
}

Expand Down
34 changes: 25 additions & 9 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 @@ -132,7 +132,7 @@
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.14",
"cypress": "^12.17.4",
"cypress": "^13.1.0",
"cypress-localstorage-commands": "^2.2.3",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
Expand Down
26 changes: 15 additions & 11 deletions src/Components/Medicine/PrescriptionAdministrationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export default function PrescriptionAdministrationsTable({
border
onClick={() => setShowBulkAdminister(true)}
className="w-full"
disabled={
state === undefined || state.prescriptions.length === 0
}
>
<CareIcon className="care-l-syringe text-lg" />
<span className="hidden lg:block">
Expand Down Expand Up @@ -221,18 +224,19 @@ export default function PrescriptionAdministrationsTable({
refetch={refetch}
/>
))}
{state?.prescriptions.length === 0 && (
<div className="my-16 flex flex-col items-center justify-center gap-4 text-gray-500">
<CareIcon className="care-l-tablets text-5xl" />
<h3 className="text-lg font-medium">
{prn
? "No PRN Prescriptions Prescribed"
: "No Prescriptions Prescribed"}
</h3>
</div>
)}
</tbody>
</table>

{state?.prescriptions.length === 0 && (
<div className="my-16 flex w-full flex-col items-center justify-center gap-4 text-gray-500">
<CareIcon className="care-l-tablets text-5xl" />
<h3 className="text-lg font-medium">
{prn
? "No PRN Prescriptions Prescribed"
: "No Prescriptions Prescribed"}
</h3>
</div>
)}
</div>
</div>
);
Expand Down Expand Up @@ -547,7 +551,7 @@ function getAdministrationBounds(prescriptions: Prescription[]) {
curr.last_administered_on && curr.last_administered_on > latest
? curr.last_administered_on
: latest,
prescriptions[0].created_date ?? new Date()
prescriptions[0]?.created_date ?? new Date()
)
);

Expand Down

0 comments on commit 1261de1

Please sign in to comment.