Skip to content

Commit

Permalink
Merge branch 'coronasafe:develop' into Fix-ohcnetwork#7244-1
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafMd-1 authored Apr 8, 2024
2 parents 898d8be + 12d4187 commit 2e3e2d7
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 141 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
build:
needs: test
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging' || github.ref == 'refs/tags/v*'
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging' || startsWith(github.event.ref, 'refs/tags/v')
name: Build & Push to container registries
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
notify-release:
needs: build
if: github.ref == 'refs/tags/v*'
if: startsWith(github.event.ref, 'refs/tags/v')
name: Notify release
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ describe("Facility Manage Functions", () => {
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed capacity added successfully"
);
cy.closeNotification();
facilityManage.verifyFacilityBedCapacity(totalCapacity);
facilityManage.verifyFacilityBedCapacity(currentOccupied);
// edit a existing bed
Expand All @@ -151,6 +152,7 @@ describe("Facility Manage Functions", () => {
facilityManage.verifySuccessMessageVisibilityAndContent(
"Bed capacity updated successfully"
);
cy.closeNotification();
facilityManage.verifyFacilityBedCapacity(totalUpdatedCapacity);
facilityManage.verifyFacilityBedCapacity(currentUpdatedOccupied);
// delete a bed
Expand Down
106 changes: 0 additions & 106 deletions cypress/e2e/patient_spec/patient_detailpage.cy.ts

This file was deleted.

117 changes: 117 additions & 0 deletions cypress/e2e/patient_spec/patient_fileupload.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
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";
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientFileUpload = new PatientFileUpload();

function runTests(testDescription, visitPatientFileUploadSection) {
describe(testDescription, () => {
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);
visitPatientFileUploadSection.call(patientFileUpload);
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);
visitPatientFileUploadSection.call(patientFileUpload);
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);
visitPatientFileUploadSection.call(patientFileUpload);
// 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();
});
});
}

runTests(
"Patient File upload in patient details page",
patientFileUpload.clickFileUploadIcon
);
runTests(
"Patient File upload in patient consultation page",
patientFileUpload.clickFileTab
);
7 changes: 0 additions & 7 deletions cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ describe("Patient", () => {
cy.verifyNotification("Medicine prescribed");
});

it("Upload consultations file ", () => {
patientPage.visitPatient("Dummy Patient 5");
patientConsultationPage.visitFilesPage();
patientConsultationPage.uploadFile();
patientConsultationPage.clickUploadFile();
});

it("Discharge a patient", () => {
patientPage.visitPatient("Dummy Patient 6");
patientConsultationPage.clickDischargePatient();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/patient_registration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import {
generatePhoneNumber,
generateEmergencyPhoneNumber,
} from "../../pageobject/constants";
} from "../../pageobject/utils/constants";
import PatientTransfer from "../../pageobject/Patient/PatientTransfer";
import PatientExternal from "../../pageobject/Patient/PatientExternal";
import PatientInsurance from "../../pageobject/Patient/PatientInsurance";
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { UserCreationPage } from "../../pageobject/Users/UserCreation";
import {
generatePhoneNumber,
generateEmergencyPhoneNumber,
} from "../../pageobject/constants";
} from "../../pageobject/utils/constants";

describe("User Creation", () => {
const userPage = new UserPage();
Expand Down
18 changes: 0 additions & 18 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,6 @@ export class PatientConsultationPage {
cy.searchAndSelectOption("#referred_from_facility", referringFacility);
}

visitFilesPage() {
cy.get("#consultation_tab_nav").scrollIntoView();
cy.get("#consultation_tab_nav").contains("Files").click();
}

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);
}

clickEditConsultationButton() {
cy.get("#consultation-buttons").scrollIntoView();
cy.get("button").contains("Manage Patient").click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PatientPage {
}

typePatientDateOfBirth(dateOfBirth: string) {
cy.clickAndSelectOption("#patientAge", "D.O.B");
cy.clickAndSelectOption("#patientAge", "DOB");
cy.get("#date_of_birth").scrollIntoView();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type(dateOfBirth);
Expand Down
6 changes: 5 additions & 1 deletion cypress/pageobject/Patient/PatientFileupload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cy } from "local-cypress";

export class PatientFileUpload {
visitPatientDetailsPage() {
clickFileUploadIcon() {
cy.get("#patient-details").click();
cy.get("#upload-patient-files").click();
}
Expand All @@ -11,6 +11,10 @@ export class PatientFileUpload {
cy.get("#consultation_audio_file").click().type(name);
}

clickFileTab() {
cy.verifyAndClickElement("#consultation_tab_nav", "Files");
}

typeFileName(name: string) {
cy.get("#consultation_file").clear();
cy.get("#consultation_file").click().type(name);
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientPredefined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PatientMedicalHistory from "../../pageobject/Patient/PatientMedicalHistor
import {
generatePhoneNumber,
generateEmergencyPhoneNumber,
} from "../../pageobject/constants";
} from "../utils/constants";

class PatientPredefined {
createPatient() {
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/Components/DeathReport/DeathReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TextFormField from "../Form/FormFields/TextFormField";
import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import DateFormField from "../Form/FormFields/DateFormField";
import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField";
import { formatDateTime } from "../../Utils/utils";
import { formatDateTime, patientAgeInYears } from "../../Utils/utils";
import Page from "../Common/components/Page";
import Form from "../Form/Form";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -106,6 +106,7 @@ export default function PrintDeathReport(props: { id: string }) {
const patientComorbidities = getPatientComorbidities(res.data);
const data = {
...res.data,
age: patientAgeInYears(res.data!),
gender: patientGender,
address: patientAddress,
comorbidities: patientComorbidities,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Form/SelectMenuV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const SelectMenuV2 = <T, V>(props: SelectMenuProps<T, V>) => {
{value.icon}
</div>
)}
<p className="ml-2.5 break-all text-sm font-medium">
<p className="ml-2.5 whitespace-nowrap break-all text-sm font-medium">
{value.selectedLabel}
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
[
{
value: "date_of_birth",
text: "D.O.B.",
text: "DOB",
},
{ value: "age", text: "Age" },
] as const
Expand Down
Loading

0 comments on commit 2e3e2d7

Please sign in to comment.