Skip to content

Commit

Permalink
Merge pull request ohcnetwork#7529 from coronasafe/develop
Browse files Browse the repository at this point in the history
Staging Release for v24.15.0
  • Loading branch information
gigincg authored Apr 3, 2024
2 parents f96d5ca + f54907f commit 12ea165
Show file tree
Hide file tree
Showing 95 changed files with 3,819 additions and 2,916 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
],
"tailwindcss/no-custom-classname": "off",
"tailwindcss/migration-from-tailwind-2": "error",
"tailwindcss/classnames-order": "error",
"tailwindcss/classnames-order": "off",
"tailwindcss/enforces-shorthand": "off",
"tailwindcss/no-contradicting-classname": "error"
},
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,21 @@ jobs:
max_attempts: 5
command: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000
on_retry_command: sleep 5

- name: Determine PR Origin
id: pr_origin
run: echo "::set-output name=is_forked::$( echo ${{ github.event.pull_request.head.repo.fork }})"

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies 📦
run: npm install

- name: Build & Compile rescript files ⚙️
run: "npm run build"
run: npm run build

- name: Install Specific Chrome Version
run: |
Expand Down Expand Up @@ -117,4 +122,3 @@ jobs:
with:
name: cypress-videos
path: cypress/videos

1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

9 changes: 7 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"semi": true,
"jsxSingleQuote": false,
"arrowParens": "always",
"tailwindFunctions": ["classNames"]
}
"tailwindFunctions": [
"classNames"
],
"plugins": [
"prettier-plugin-tailwindcss"
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#build-stage
FROM --platform=$BUILDPLATFORM node:18-buster-slim as build-stage
FROM --platform=$BUILDPLATFORM node:20-buster-slim as build-stage

WORKDIR /app

Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/facility_spec/inventory.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe("Inventory Management Section", () => {
const facilityPage = new FacilityPage();
const loginPage = new LoginPage();
const facilityHome = new FacilityHome();
const inventoryName = "PPE";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand Down Expand Up @@ -51,9 +52,10 @@ describe("Inventory Management Section", () => {
it("Add New Inventory | Verify Backend and manual Minimum", () => {
// Add Inventory
facilityPage.clickManageInventory();
facilityPage.fillInventoryDetails("PPE", "Add Stock", "5");
facilityPage.fillInventoryDetails(inventoryName, "Add Stock", "5");
facilityPage.clickAddInventory();
facilityPage.verifySuccessNotification("Inventory created successfully");
cy.closeNotification();
// Verify Backend minimum badge
facilityPage.verifyBadgeWithText(".badge-danger", "Low Stock");
// modify with manual minimum badge
Expand All @@ -68,14 +70,15 @@ describe("Inventory Management Section", () => {
} else {
// Otherwise, click the 'set-minimum-quantity' element
facilityPage.clickSetMinimumQuantity();
facilityPage.fillInventoryMinimumDetails("PPE", "1");
facilityPage.fillInventoryMinimumDetails(inventoryName, "1");
facilityPage.clickSetButton();
facilityPage.verifySuccessNotification(
"Minimum quantiy updated successfully"
);
}
});
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Patient Consultation in multiple combination", () => {
const procedureName = "Procedure No 1";
const patientWeight = "70";
const patientHeight = "170";
const medicineOne = "DOLO";
const medicineOne = "DOLOLUP";
const patientIpNumber = Math.random().toString(36).substring(7);

before(() => {
Expand Down Expand Up @@ -99,13 +99,13 @@ describe("Patient Consultation in multiple combination", () => {
cy.verifyNotification("Consultation created successfully");
// Below code for the prescription module only present while creating a new consultation
patientPrescription.clickAddPrescription();
patientPrescription.interceptMediaBase();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.waitForMediabaseStatusCode();
patientPrescription.selectMedicine(medicineOne);
patientPrescription.enterDosage("3");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.wait(2000);
cy.verifyNotification("Medicine prescribed");
patientPrescription.clickReturnToDashboard();
// Verify the data's across the dashboard
Expand Down
106 changes: 106 additions & 0 deletions cypress/e2e/patient_spec/patient_detailpage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import { PatientFileUpload } from "../../pageobject/Patient/PatientFileupload";

describe("Patient Details", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientFileUpload = new PatientFileUpload();
const cypressAudioName = "cypress audio";
const cypressFileName = "cypress name";
const newFileName = "cypress modified name";
const patientNameOne = "Dummy Patient 3";
const patientNameTwo = "Dummy Patient 4";
const patientNameThree = "Dummy Patient 5";
before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

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

it("Record an Audio and download the file", () => {
// Record an audio
patientPage.visitPatient(patientNameOne);
patientFileUpload.visitPatientDetailsPage();
patientFileUpload.recordAudio();
patientFileUpload.typeAudioName(cypressAudioName);
patientFileUpload.clickUploadAudioFile();
// Verify the audio file is uploaded
cy.verifyNotification("File Uploaded Successfully");
patientFileUpload.verifyUploadFilePresence(cypressAudioName);
// Verify the download of the audio file
cy.get("button").contains("DOWNLOAD").click();
cy.verifyNotification("Downloading file...");
});

it("Upload a File and archive it", () => {
// Upload the file
patientPage.visitPatient(patientNameTwo);
patientFileUpload.visitPatientDetailsPage();
patientFileUpload.uploadFile();
patientFileUpload.typeFileName(cypressFileName);
patientFileUpload.clickUploadFile();
// Verify the file is uploaded
cy.verifyNotification("File Uploaded Successfully");
cy.closeNotification();
patientFileUpload.verifyUploadFilePresence(cypressFileName);
// Archive the file
patientFileUpload.archiveFile();
patientFileUpload.clickSaveArchiveFile();
cy.verifyNotification("File archived successfully");
patientFileUpload.verifyArchiveFile(cypressFileName);
});

it("User-level Based Permission for File Modification", () => {
// Login as Nurse 1
loginPage.login("dummynurse1", "Coronasafe@123");
cy.reload();
// Visit the patient details page
patientPage.visitPatient(patientNameThree);
patientFileUpload.visitPatientDetailsPage();
// Upload the file
patientFileUpload.uploadFile();
patientFileUpload.typeFileName(cypressFileName);
patientFileUpload.clickUploadFile();
// Verify the file is uploaded
cy.verifyNotification("File Uploaded Successfully");
cy.closeNotification();
patientFileUpload.verifyUploadFilePresence(cypressFileName);
// Edit the file name
patientFileUpload.verifyFileRenameOption(true);
patientFileUpload.renameFile(newFileName);
patientFileUpload.clickSaveFileName();
// Verify the file name is changed
cy.verifyNotification("File name changed successfully");
cy.closeNotification();
patientFileUpload.verifyUploadFilePresence(newFileName);
// Login as Nurse 2
loginPage.login("dummynurse2", "Coronasafe@123");
cy.reload();
// Verify the file edit option is not available
patientFileUpload.verifyUploadFilePresence(newFileName);
patientFileUpload.verifyFileRenameOption(false);
// Login as District Admin
loginPage.loginAsDisctrictAdmin();
cy.reload();
// Verify the file edit option is available
patientFileUpload.verifyUploadFilePresence(newFileName);
patientFileUpload.verifyFileRenameOption(true);
patientFileUpload.renameFile(cypressFileName);
patientFileUpload.clickSaveFileName();
// Verify the file name is changed
cy.verifyNotification("File name changed successfully");
cy.closeNotification();
patientFileUpload.verifyUploadFilePresence(cypressFileName);
});

afterEach(() => {
cy.saveLocalStorage();
});
});
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => {
patientLogupdate.typeRhythm(patientRhythm);
cy.get("#consciousness_level-2").click();
cy.submitButton("Save");
cy.wait(2000);
cy.verifyNotification("Consultation Updates details created successfully");
// Verify the card content
cy.get("#basic-information").scrollIntoView();
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ describe("Patient", () => {
patientPage.visitPatient("Dummy Patient 4");
patientPrescription.visitEditPrescriptionPage();
patientPrescription.clickAddPrescription();
patientPrescription.interceptMediaBase();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.waitForMediabaseStatusCode();
patientPrescription.selectMedicine("DOLO");
patientPrescription.enterDosage("4");
patientPrescription.selectDosageFrequency("Twice daily");
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/patient_spec/patient_registration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe("Patient Creation with consultation", () => {
// Patient Details page
patientPage.typePatientPhoneNumber(phone_number);
patientPage.typePatientEmergencyNumber(emergency_phone_number);
patientPage.typePatientDateOfBirth(patientDateOfBirth);
patientPage.typePatientAge(age.toString());
patientPage.typePatientName(patientOneName);
patientPage.selectPatientGender(patientOneGender);
patientPage.typePatientAddress(patientOneAddress);
Expand Down Expand Up @@ -146,6 +146,7 @@ describe("Patient Creation with consultation", () => {
// change the gender to female and input data to related changed field
cy.wait(3000);
patientPage.selectPatientGender(patientOneUpdatedGender);
patientPage.typePatientDateOfBirth(patientDateOfBirth);
patientPage.clickPatientAntenatalStatusYes();
patientPage.selectPatientBloodGroup(patientOneUpdatedBloodGroup);
// Edit the patient consultation , select none medical history and multiple health ID
Expand Down
2 changes: 2 additions & 0 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class FacilityPage {
}

fillInventoryDetails(name: string, status: string, quantity: string) {
cy.wait(2000);
cy.get("div#id").click();
cy.get("div#id ul li").contains(name).click();
cy.get("div#isIncoming").click();
Expand All @@ -371,6 +372,7 @@ class FacilityPage {
}

fillInventoryMinimumDetails(name: string, quantity: string) {
cy.wait(2000);
cy.get("div#id").click();
cy.get("div#id ul li").contains(name).click();
cy.get("[name='quantity']").type(quantity);
Expand Down
7 changes: 7 additions & 0 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,18 @@ export class PatientPage {
}

typePatientDateOfBirth(dateOfBirth: string) {
cy.clickAndSelectOption("#patientAge", "D.O.B");
cy.get("#date_of_birth").scrollIntoView();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type(dateOfBirth);
}

typePatientAge(age: string) {
cy.clickAndSelectOption("#patientAge", "Age");
cy.submitButton("Confirm");
cy.get("#age").clear().type(age);
}

typePatientName(patientName: string) {
cy.get("[data-testid=name] input").click().type(patientName);
}
Expand Down
90 changes: 90 additions & 0 deletions cypress/pageobject/Patient/PatientFileupload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { cy } from "local-cypress";

export class PatientFileUpload {
visitPatientDetailsPage() {
cy.get("#patient-details").click();
cy.get("#upload-patient-files").click();
}

typeAudioName(name: string) {
cy.get("#consultation_audio_file").clear();
cy.get("#consultation_audio_file").click().type(name);
}

typeFileName(name: string) {
cy.get("#consultation_file").clear();
cy.get("#consultation_file").click().type(name);
}

recordAudio() {
cy.get("#record-audio").click();
cy.wait(5000);
cy.get("#stop-recording").click();
}

clickUploadAudioFile() {
cy.intercept("POST", "**/api/v1/files/").as("uploadAudioFile");
cy.verifyAndClickElement("#upload_audio_file", "Save");
cy.wait("@uploadAudioFile").its("response.statusCode").should("eq", 201);
}

verifyUploadFilePresence(fileName: string) {
cy.wait(2000);
cy.get("#file-div").scrollIntoView();
cy.verifyContentPresence("#file-div", [fileName]);
}

uploadFile() {
cy.get("#file_upload_patient").selectFile(
"cypress/fixtures/sampleAsset.xlsx",
{ force: true }
);
}

clickUploadFile() {
cy.intercept("POST", "**/api/v1/files/").as("uploadFile");
cy.get("#upload_file_button").click();
cy.wait("@uploadFile").its("response.statusCode").should("eq", 201);
}

archiveFile() {
cy.get("button").contains("ARCHIVE").click().scrollIntoView();
cy.get("#editFileName").clear().type("Cypress File Archive");
}

clickSaveArchiveFile() {
cy.intercept("PATCH", "**/api/v1/files/**").as("saveArchiveFile");
cy.submitButton("Proceed");
cy.wait("@saveArchiveFile").its("response.statusCode").should("eq", 200);
}

verifyArchiveFile(fileName: string) {
cy.get("#archived-files").click();
cy.get("button").contains("MORE DETAILS").click().scrollIntoView();
cy.get("#archive-file-name").should("contain.text", fileName);
cy.get("#archive-file-reason").then(($reason) => {
expect($reason.text().split(":")[1]).to.contain("Cypress File Archive");
});
}

verifyFileRenameOption(status: boolean) {
cy.get("#file-div").then(($fileDiv) => {
if (status) {
expect($fileDiv.text()).to.contain("RENAME");
} else {
expect($fileDiv.text()).to.not.contain("RENAME");
}
});
}

renameFile(newFileName: string) {
cy.get("button").contains("RENAME").click().scrollIntoView();
cy.get("#editFileName").clear().type(newFileName);
}

clickSaveFileName() {
cy.intercept("PATCH", "**/api/v1/files/**").as("saveFileName");
cy.submitButton("Proceed");
cy.wait("@saveFileName").its("response.statusCode").should("eq", 200);
}
}
Loading

0 comments on commit 12ea165

Please sign in to comment.