Skip to content

Commit

Permalink
Merge branch 'develop' into triage-form-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored May 6, 2024
2 parents 8473222 + 4568e5f commit eee6cb2
Show file tree
Hide file tree
Showing 87 changed files with 2,634 additions and 1,561 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins:
eslint:
enabled: true
enabled: false
channel: "eslint-7"
23 changes: 23 additions & 0 deletions .github/workflows/combine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Combine Dependencies

on: workflow_dispatch

# The minimum permissions required to run this Action
permissions:
contents: write
pull-requests: write
checks: read

jobs:
combine-prs:
runs-on: ubuntu-latest

steps:
- name: Combine dependencies
id: combine-dependencies
uses: github/[email protected]
with:
pr_title: Combined dependencies # The title of the pull request to create
select_label: dependencies # The label which marks PRs that should be combined.
labels: combined-dependencies # Add a label to the combined PR
ci_required: "false" # Whether or not CI should be passing to combine the PR
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: "stale"
stale-pr-label: "stale"
stale-issue-message: "Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, @aparnacoronasafe, This issue has been automatically marked as stale because it has not had any recent activity."
stale-issue-message: "Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity."
stale-pr-message: "Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions."
close-pr-message: "Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, This pr has been automatically closed because it has not had any recent activity. Thank you for your contributions. Feel free to repopen the pr."
close-pr-message: "Hi, @coronasafe/care-frontend-maintainers, This PR has been automatically closed due to inactivity. Thank you for your contributions. Feel free to re-open the PR."
exempt-issue-labels: "blocked,waiting for related PR,waiting for back end,help wanted,work-in-progress,In Progress,wishlist,EPIC"
exempt-pr-labels: "tested,needs testing,need Review,waiting for related PR,waiting for back end,help wanted,blocked,work-in-progress,In Progress"
days-before-issue-stale: 14
Expand Down
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,33 @@ Authenticate to staging API with any of the following credentials

#### 🧪 Run cypress tests

Ensure that the development server is running and then run the cypress tests in either of the ways described below.
To run cypress tests locally, you'll need to setup the backend to run locally and load dummy data required for cypress to the database. See [docs](https://github.com/coronasafe/care#self-hosting).

Once backend is running locally, you'll have to ensure your local front-end is connected to local backend, by setting the `CARE_API` env.

```env
#.env
CARE_API=http://127.0.0.1:9000
```

Once done, start the development server by running

```sh
npm run dev
```

Once development server is running, then run the cypress tests in either of the ways described below.

```sh
npm run cypress:run # To run all tests in headless mode.
```

```sh
npm run cypress:run:gui # To run all tests in headed mode.
```

```sh
$ npm run cypress:run # To run all tests in headless mode.
$ npm run cypress:run:gui # To run all tests in headed mode.
$ npm run cypress:open # To debug and run tests individually.
npm run cypress:open # To debug and run tests individually.
```

- Failed test screenshots are saved in `cypress/screenshots`
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/assets_spec/assets_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@ describe("Asset", () => {
assetPage.interceptAssetCreation();
assetPage.clickCreateAsset();
assetPage.verifyAssetCreation();

assetSearchPage.typeSearchKeyword("New Test Asset Vital");
assetSearchPage.pressEnter();

assetPage.openCreatedAsset();
assetPage.configureVitalAsset("Host name", "192.168.1.64");
assetPage.configureVitalAsset("Host name", "192.168.1.20");
assetPage.clickConfigureVital();
});

Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/external_results_spec/external_result.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ describe("Edit Profile Testing", () => {
cy.intercept("POST", "/api/v1/external_result/bulk_upsert").as("import");
cy.get("div").contains("Import/Export").click();
cy.get("div").contains("Import Results").click();
cy.get("[id=result-upload]")
.selectFile("cypress/fixtures/externalresultsample.csv")
cy.get("[data-testid=import-file]")
.selectFile("cypress/fixtures/externalresultsample.csv", { force: true })
.wait(100);
cy.get("button").contains("Save").click();
cy.submitButton("Import");
cy.wait("@import").then((interception) => {
expect(interception.response.statusCode).to.equal(202);
});
Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ describe("Facility Creation", () => {
facilityPage.clickConfigureFacilityOption();
facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live");
facilityPage.clickupdateMiddleWare();
facilityPage.verifySuccessNotification("Facility updated successfully");
facilityPage.verifySuccessNotification(
"Facility middleware updated successfully"
);
});

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Facility Manage Functions", () => {
const facilityMiddleware = "dev-middleware.coronasafe.live";
const facilityUpdatedMiddleware = "updated.coronasafe.live";
const facilityMiddlewareSuccessfullNotification =
"Facility updated successfully";
"Facility middleware updated successfully";
const facilityHfridUpdateButton = "Link Health Facility";
const facilityHfridToastNotificationText =
/Health Facility config updated successfully|Health ID registration failed/;
Expand Down
16 changes: 11 additions & 5 deletions cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room"
);
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
patientConsultationPage.typePatientIllnessHistory(patientIllnessHistory);
patientConsultationPage.typePatientExaminationHistory(
patientExaminationHistory
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room"
);
// Asymptomatic
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
// CRITICAL category
patientConsultationPage.selectPatientCategory("Critical");
patientConsultationPage.selectPatientSuggestion("Declare Death");
Expand Down Expand Up @@ -234,7 +234,7 @@ describe("Patient Consultation in multiple combination", () => {
);
patientConsultationPage.selectPatientWard("Dummy Location 1");
// Asymptomatic
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
cy.searchAndSelectOption("#symptoms", "ASYMPTOMATIC");
// Abnormal category
patientConsultationPage.selectPatientCategory("Abnormal");
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
Expand Down Expand Up @@ -294,7 +294,10 @@ describe("Patient Consultation in multiple combination", () => {
// verify the free text in referring facility name
patientConsultationPage.typeReferringFacility("Life Care Hospital");
// Vomiting and Nausea symptoms
patientConsultationPage.selectSymptoms(["VOMITING", "SORE THROAT"]);
patientConsultationPage.typeAndMultiSelectSymptoms("s", [
"SPUTUM",
"SORE THROAT",
]);
// Stable category
patientConsultationPage.selectPatientCategory("Stable");
// Date of symptoms
Expand Down Expand Up @@ -339,7 +342,10 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room"
);
// Select the Symptoms - Sore throat and fever symptoms
patientConsultationPage.selectSymptoms(["FEVER", "SORE THROAT"]);
patientConsultationPage.typeAndMultiSelectSymptoms("b", [
"BREATHLESSNESS",
"BLEEDING",
]);
// Comfort Care category
patientConsultationPage.selectPatientCategory("Comfort Care");
// Date of symptoms
Expand Down
127 changes: 127 additions & 0 deletions cypress/e2e/patient_spec/patient_discharge.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";
import PatientDischarge from "../../pageobject/Patient/PatientDischarge";
import PatientPrescription from "../../pageobject/Patient/PatientPrescription";

describe("Patient Discharge based on multiple reason", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientDischarge = new PatientDischarge();
const patientPrescription = new PatientPrescription();
const patientDischargeReason1 = "Recovered";
const patientDischargeReason2 = "Referred";
const patientDischargeReason3 = "Expired";
const patientDischargeReason4 = "LAMA";
const patientDischargeAdvice = "Discharge Advice";
const patientMedicine = "ZOLE";
const referringFacility = "Dummy Shifting Center, Ernakulam";
const referringFreetextFacility = "Aster Mims";
const patientDeathCause = "Cause Of Death";
const doctorName = "Custom Doctor";

before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

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

it("Discharge a LAMA patient in the consultation", () => {
patientPage.visitPatient("Dummy Patient 12");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason4);
cy.submitButton("Confirm Discharge");
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["LAMA"]);
// verify the discharge information card
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason4,
]);
});

it("Discharge a expired patient in the consultation", () => {
patientPage.visitPatient("Dummy Patient 13");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason3);
patientDischarge.typeDischargeNote(patientDeathCause);
patientDischarge.typeDoctorName(doctorName);
cy.submitButton("Confirm Discharge");
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["EXPIRED"]);
// verify the discharge information card
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason3,
patientDeathCause,
doctorName,
]);
});

it("Discharge patient with referred reason to a facility", () => {
patientPage.visitPatient("Dummy Patient 16");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason2);
patientDischarge.typeDischargeNote(patientDischargeAdvice);
// select a registrated facility from dropdown and clear
patientDischarge.typeReferringFacility(referringFacility);
patientDischarge.clickClearButton();
// select a non-registered facility and perform the discharge
patientDischarge.typeReferringFacility(referringFreetextFacility);
cy.wait(2000);
cy.submitButton("Confirm Discharge");
cy.wait(2000);
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["Referred"]);
// Verify the dashboard and discharge information
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason2,
patientDischargeAdvice,
referringFreetextFacility,
]);
});

it("Discharge a recovered patient with all relevant fields", () => {
patientPage.visitPatient("Dummy Patient 15");
patientDischarge.clickDischarge();
patientDischarge.selectDischargeReason(patientDischargeReason1);
patientDischarge.typeDischargeNote(patientDischargeAdvice);
// Prescribe a medicine for the patient
patientPrescription.clickAddPrescription();
patientPrescription.interceptMedibase();
patientPrescription.selectMedicinebox();
patientPrescription.selectMedicine(patientMedicine);
patientPrescription.enterDosage("4");
patientPrescription.selectDosageFrequency("Twice daily");
cy.submitButton("Submit");
cy.verifyNotification("Medicine prescribed");
cy.wait(2000);
cy.closeNotification();
// submit the discharge pop-up
cy.submitButton("Confirm Discharge");
cy.wait(2000);
cy.verifyNotification("Patient Discharged Successfully");
cy.closeNotification();
// Verify the consultation dashboard reflection
cy.verifyContentPresence("#consultation-buttons", ["Recovered"]);
// Verify the dashboard and discharge information
cy.verifyContentPresence("#discharge-information", [
patientDischargeReason1,
patientDischargeAdvice,
patientMedicine,
]);
});

afterEach(() => {
cy.saveLocalStorage();
});
});
8 changes: 0 additions & 8 deletions cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ describe("Patient", () => {
cy.verifyNotification("Medicine prescribed");
});

it("Discharge a patient", () => {
patientPage.visitPatient("Dummy Patient 6");
patientConsultationPage.clickDischargePatient();
patientConsultationPage.selectDischargeReason("Recovered");
patientConsultationPage.addDischargeNotes("Discharge notes");
patientConsultationPage.confirmDischarge();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Manage User", () => {
cy.awaitUrl("/users");
});

it("linking skills for a users and verify its reflection in profile", () => {
it("linking skills for users and verify its reflection in profile", () => {
// select the district user and select one skill link and verify its profile reflection
userPage.typeInSearchInput(usernameforworkinghour);
userPage.checkUsernameText(usernameforworkinghour);
Expand All @@ -49,7 +49,7 @@ describe("Manage User", () => {
manageUserPage.navigateToProfile();
userCreationPage.verifyElementContainsText(
"username-profile-details",
usernameforworkinghour
usernameforworkinghour,
);
manageUserPage.assertSkillInAlreadyLinkedSkills(linkedskill);
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/externalresultsample.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
District,srf id,name,age,age in,gender,mobile number,address,ward,local body,local body type,source,Sample Collection Date,result date,test type,lab name,sample type,patient status,Is Repeat,patient category,result
District,SRF ID,Name,Age,Age in,Gender,Mobile Number,Address,Ward,Local Body,Local Body Type,Source,Sample Collection Date,Result Date,Test Type,Lab Name,Sample Type,Patient Status,Is Repeat,Patient Category,Result
Ernakulam,00/EKM/0000,Test Upload,24,years,m,8888888888,Upload test address,7,Poothrikka,grama panchayath,Secondary contact aparna,2020-10-14,2020-10-14,Antigen,Karothukuzhi Laboratory,Ag-SD_Biosensor_Standard_Q_COVID-19_Ag_detection_kit,Asymptomatic,NO,Cat 17: All individuals who wish to get themselves tested,Negative
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class AssetPage {
}

importAssetFile() {
cy.get("[data-testid=import-asset-file]")
cy.get("[data-testid=import-file]")
.selectFile("cypress/fixtures/sampleAsset.xlsx", { force: true })
.wait(100);
}
Expand Down
Loading

0 comments on commit eee6cb2

Please sign in to comment.