From 145726781dadc472aefba85ee9c0cbaf0ef376ff Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 1 Sep 2023 06:44:41 +0000 Subject: [PATCH 1/2] Improve Prescriptions table when No Medicines prescribed (#6200) --- .../PrescriptionAdministrationsTable.tsx | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Components/Medicine/PrescriptionAdministrationsTable.tsx b/src/Components/Medicine/PrescriptionAdministrationsTable.tsx index d1fc610d055..c60d531baa3 100644 --- a/src/Components/Medicine/PrescriptionAdministrationsTable.tsx +++ b/src/Components/Medicine/PrescriptionAdministrationsTable.tsx @@ -126,6 +126,9 @@ export default function PrescriptionAdministrationsTable({ border onClick={() => setShowBulkAdminister(true)} className="w-full" + disabled={ + state === undefined || state.prescriptions.length === 0 + } > @@ -221,18 +224,19 @@ export default function PrescriptionAdministrationsTable({ refetch={refetch} /> ))} - {state?.prescriptions.length === 0 && ( -
- -

- {prn - ? "No PRN Prescriptions Prescribed" - : "No Prescriptions Prescribed"} -

-
- )} + + {state?.prescriptions.length === 0 && ( +
+ +

+ {prn + ? "No PRN Prescriptions Prescribed" + : "No Prescriptions Prescribed"} +

+
+ )} ); @@ -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() ) ); From e21652b96948981d589319fa85080d45e5f26244 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:51:19 +0530 Subject: [PATCH 2/2] Fix Patient Crud Cypress (#6202) * Fix Patient Crud * Fix asset creation cypress test * Update cypress to 13.1 --------- Co-authored-by: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> --- cypress/e2e/assets_spec/assets_manage.cy.ts | 4 +-- cypress/e2e/patient_spec/patient_crud.cy.ts | 15 ++++----- cypress/e2e/users_spec/user_crud.cy.ts | 6 ++-- cypress/pageobject/Asset/AssetCreation.ts | 7 +++-- package-lock.json | 34 +++++++++++++++------ package.json | 2 +- 6 files changed, 43 insertions(+), 25 deletions(-) diff --git a/cypress/e2e/assets_spec/assets_manage.cy.ts b/cypress/e2e/assets_spec/assets_manage.cy.ts index 27843d7fa85..d04a7733c0d 100644 --- a/cypress/e2e/assets_spec/assets_manage.cy.ts +++ b/cypress/e2e/assets_spec/assets_manage.cy.ts @@ -56,7 +56,7 @@ describe("Asset", () => { "email@support.com", "Vendor's Name", serialNumber, - "2021-12-25", + "25122021", "Test note for asset creation!" ); @@ -80,7 +80,7 @@ describe("Asset", () => { "email@support.com", "Vendor's Name", serialNumber, - "2021-12-25", + "25122021", "Test note for asset creation!" ); diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts index d555e14ec19..ff8ffaefcfc 100644 --- a/cypress/e2e/patient_spec/patient_crud.cy.ts +++ b/cypress/e2e/patient_spec/patient_crud.cy.ts @@ -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 = ""; @@ -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"); @@ -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", @@ -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") diff --git a/cypress/e2e/users_spec/user_crud.cy.ts b/cypress/e2e/users_spec/user_crud.cy.ts index 18ee627851c..41a12a891a8 100644 --- a/cypress/e2e/users_spec/user_crud.cy.ts +++ b/cypress/e2e/users_spec/user_crud.cy.ts @@ -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(); @@ -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"); }); }); @@ -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"); diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts index 44841a34a65..d24c93d0197 100644 --- a/cypress/pageobject/Asset/AssetCreation.ts +++ b/cypress/pageobject/Asset/AssetCreation.ts @@ -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); } diff --git a/package-lock.json b/package-lock.json index bc74da4e4d4..dda8ac9dd79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -92,7 +92,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", @@ -2261,9 +2261,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.0.tgz", + "integrity": "sha512-GKFCqwZwMYmL3IBoNeR2MM1SnxRIGERsQOTWeQKoYBt2JLqcqiy7JXqO894FLrpjZYqGxW92MNwRH2BN56obdQ==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -7789,13 +7789,13 @@ "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, "node_modules/cypress": { - "version": "12.17.4", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.17.4.tgz", - "integrity": "sha512-gAN8Pmns9MA5eCDFSDJXWKUpaL3IDd89N9TtIupjYnzLSmlpVr+ZR+vb4U/qaMp+lB6tBvAmt7504c3Z4RU5KQ==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.1.0.tgz", + "integrity": "sha512-LUKxCYlB973QBFls1Up4FAE9QIYobT+2I8NvvAwMfQS2YwsWbr6yx7y9hmsk97iqbHkKwZW3MRjoK1RToBFVdQ==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "2.88.12", + "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", "@types/node": "^16.18.39", "@types/sinonjs__fake-timers": "8.1.1", @@ -7843,7 +7843,7 @@ "cypress": "bin/cypress" }, "engines": { - "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, "node_modules/cypress-localstorage-commands": { @@ -14564,6 +14564,8 @@ }, "node_modules/npm/node_modules/cross-spawn/node_modules/which": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "inBundle": true, "license": "ISC", @@ -15364,6 +15366,8 @@ }, "node_modules/npm/node_modules/minipass": { "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", "dev": true, "inBundle": true, "license": "ISC", @@ -16582,6 +16586,8 @@ }, "node_modules/npm/node_modules/tar": { "version": "6.1.15", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", + "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", "dev": true, "inBundle": true, "license": "ISC", @@ -16686,6 +16692,8 @@ }, "node_modules/npm/node_modules/util-deprecate": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true, "inBundle": true, "license": "MIT" @@ -16753,6 +16761,8 @@ }, "node_modules/npm/node_modules/wrap-ansi": { "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, "inBundle": true, "license": "MIT", @@ -16771,6 +16781,8 @@ "node_modules/npm/node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "inBundle": true, "license": "MIT", @@ -16860,6 +16872,8 @@ }, "node_modules/npm/node_modules/wrappy": { "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true, "inBundle": true, "license": "ISC" @@ -16879,6 +16893,8 @@ }, "node_modules/npm/node_modules/yallist": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true, "inBundle": true, "license": "ISC" diff --git a/package.json b/package.json index a06ba30f38d..2e894f22288 100644 --- a/package.json +++ b/package.json @@ -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",