Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change all useDispatch to useQuery and request hooks in Consultations (src/Components/Facility/Consultations/**) #6416

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
73f49f9
Optimize lodash. Fixes #6006
Omkar76 Oct 7, 2023
aaab0f5
change all dispatch to useQuery and request hooks
AshrafMd-1 Oct 7, 2023
cd0ea75
Merge branch 'develop' into Fix#6372
AshrafMd-1 Oct 7, 2023
c78022b
change all dispatch to useQuery and request hooks
AshrafMd-1 Oct 7, 2023
206082c
rebase api.tsx
AshrafMd-1 Oct 7, 2023
9164fbd
Merge branch 'Fix#6372' of https://github.com/AshrafMd-1/care_fe into…
AshrafMd-1 Oct 7, 2023
3f75c86
Merge branch 'develop' into optimize-lodash-es
nihal467 Oct 8, 2023
9bf4233
Merge branch 'develop' into optimize-lodash-es
nihal467 Oct 9, 2023
2590d10
Merge branch 'develop' into Fix#6372
nihal467 Oct 9, 2023
be98542
Replace startCase, camelCase with css capitalize
Omkar76 Oct 12, 2023
14380af
Merge branch 'develop' into Fix#6372
AshrafMd-1 Oct 14, 2023
362003c
fix: add action and recommend discharge data on patient consultation …
aeswibon Oct 17, 2023
dd16bfa
Middleware override feature in asset location (#6368)
Ashesh3 Oct 17, 2023
c776524
Replaced useDispatch with useQuery and request in ExternalResult (src…
konavivekramakrishna Oct 17, 2023
7e29f25
Added cypress test to verify warranty expiry label on an asset (#6428)
GokulramGHV Oct 17, 2023
8ad1353
Replaced export button Icon with relevant Export Icon (#6451)
shyamprakash123 Oct 17, 2023
9b362c1
Replaced dispatch with useQuery and request in Asset module (#6374)
kshitijv256 Oct 18, 2023
a92ad24
Merge pull request #6415 from Omkar76/optimize-lodash-es
mathew-alex Oct 18, 2023
67f5189
Fix CSS unintentended RTL style (#6465)
rithviknishad Oct 18, 2023
d26aba5
Replaced useDispatch with useQuery and request. (#6344)
shyamprakash123 Oct 18, 2023
db52839
Fixes JWT token refresh interval default fallback to 5 mins (instead …
rithviknishad Oct 18, 2023
6ee8422
Daily Rounds: Updated consciousness levels choices to MEWS (#6435)
aeswibon Oct 18, 2023
8011653
Fixed typo in pathParams of ConfigureHealthFacility and replaced useD…
khavinshankar Oct 19, 2023
9eac85c
New Cypress Test | Search using username | User Tab (#6478)
nihal467 Oct 20, 2023
08193ba
Fix loadash-es import (#6477)
Ashesh3 Oct 20, 2023
33f103d
Fix session expiry detection (#6472)
Ashesh3 Oct 20, 2023
e452bb5
Added test of patient_crud.cy.ts (#6135)
ShivamJhaa Oct 20, 2023
e9e2388
change all dispatch to useQuery and request hooks
AshrafMd-1 Oct 7, 2023
e22e639
Merge remote-tracking branch 'origin/Fix#6372' into Fix#6372
AshrafMd-1 Oct 24, 2023
0a1f73c
convert to pagination
AshrafMd-1 Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("Asset Tab", () => {
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Loc");
assetPage.selectImportLocation("Camera Locations");
assetPage.clickImportAsset();
});

Expand Down
33 changes: 33 additions & 0 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";

function addDaysToDate(numberOfDays: number) {
const inputDate = new Date();
inputDate.setDate(inputDate.getDate() + numberOfDays);
return inputDate.toISOString().split("T")[0];
}

describe("Asset", () => {
const assetPage = new AssetPage();
const loginPage = new LoginPage();
Expand All @@ -26,6 +32,33 @@ describe("Asset", () => {
cy.awaitUrl("/assets");
});

it("Verify Asset Warranty Expiry Label", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(assetname);
assetSearchPage.clickAssetByName(assetname);
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(100)); // greater than 3 months
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(80)); // less than 3 months
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("3 months");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(20)); // less than 1 month
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("1 month");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(100)); // check for greater than 3 months again to verify the label is removed
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("");
});

it("Create & Edit a service history and verify reflection", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
Expand Down
17 changes: 16 additions & 1 deletion cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,27 @@ describe("Patient Creation with consultation", () => {
patientConsultationPage.interceptMediaBase();
patientConsultationPage.selectMedicinebox();
patientConsultationPage.waitForMediabaseStatusCode();
patientConsultationPage.prescribeMedicine();
patientConsultationPage.prescribefirstMedicine();
patientConsultationPage.enterDosage("3");
patientConsultationPage.selectDosageFrequency("Twice daily");
patientConsultationPage.submitPrescriptionAndReturn();
});

it("Edit created consultation to existing patient", () => {
updatePatientPage.visitUpdatedPatient();
patientConsultationPage.visitEditConsultationPage();
patientConsultationPage.fillIllnessHistory("editted");
patientConsultationPage.selectConsultationStatus(
"Referred from other hospital"
);
patientConsultationPage.updateSymptoms("FEVER");
patientConsultationPage.setSymptomsDate("01082023");
patientConsultationPage.updateConsultation();
patientConsultationPage.verifySuccessNotification(
"Consultation updated successfully"
);
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
78 changes: 78 additions & 0 deletions cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientConsultationPage } from "../../pageobject/Patient/PatientConsultation";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";

describe("Patient", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const patientConsultationPage = new PatientConsultationPage();

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

beforeEach(() => {
cy.restoreLocalStorage();
cy.awaitUrl("/patients");
});

// it("Create Patient shift requests.", () => {
// patientPage.visitPatient();
// patientConsultationPage.visitShiftRequestPage();
// patientConsultationPage.enterPatientShiftDetails(
// "Test User",
// phone_number,
// "Dummy Shifting",
// "Reason"
// );
// patientConsultationPage.createShiftRequest();
// patientConsultationPage.verifySuccessNotification(
// "Shift request created successfully"
// );
// });
// commented out the shifting request, as logic need to be re-visited

it("Post doctor notes for an already created patient", () => {
patientPage.visitPatient();
patientConsultationPage.visitDoctorNotesPage();
patientConsultationPage.addDoctorsNotes("Test Doctor Notes");
patientConsultationPage.postDoctorNotes();
patientConsultationPage.verifySuccessNotification(
"Note added successfully"
);
});

it("Edit prescription for an already created patient", () => {
patientPage.visitPatient();
patientConsultationPage.visitEditPrescriptionPage();
patientConsultationPage.clickAddPrescription();
patientConsultationPage.interceptMediaBase();
patientConsultationPage.selectMedicinebox();
patientConsultationPage.waitForMediabaseStatusCode();
patientConsultationPage.prescribesecondMedicine();
patientConsultationPage.enterDosage("4");
patientConsultationPage.selectDosageFrequency("Twice daily");
patientConsultationPage.submitPrescription();
});

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

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

afterEach(() => {
cy.saveLocalStorage();
});
});
39 changes: 39 additions & 0 deletions cypress/e2e/users_spec/user_homepage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// <reference types="cypress" />

import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import { UserPage } from "../../pageobject/Users/UserSearch";

describe("Asset Tab", () => {
const userPage = new UserPage();
const usernameToTest = "devdoctor";
const currentuser = "devdistrictadmin";
const loginPage = new LoginPage();
before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

beforeEach(() => {
cy.restoreLocalStorage();
cy.awaitUrl("/users");
});

it("Search by username", () => {
userPage.checkSearchInputVisibility();
userPage.typeInSearchInput(usernameToTest);
userPage.checkUrlForUsername(usernameToTest);
userPage.checkUsernameText(usernameToTest);
userPage.checkUsernameBadgeVisibility(true);
userPage.clearSearchInput();
userPage.checkUsernameBadgeVisibility(false);
userPage.typeInSearchInput(usernameToTest);
userPage.checkUsernameText(usernameToTest);
userPage.clickRemoveIcon();
userPage.checkUsernameBadgeVisibility(false);
userPage.checkUsernameText(currentuser);
});
afterEach(() => {
cy.saveLocalStorage();
});
});
29 changes: 26 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class AssetPage {

configureVitalAsset(hostName: string, localIp: string) {
cy.get("[data-testid=asset-configure-button]").click();
cy.get("#middlewareHostname").type(hostName);
cy.get("#middleware_hostname").type(hostName);
cy.get("#localipAddress").type(localIp);
}

Expand Down Expand Up @@ -285,16 +285,39 @@ export class AssetPage {
cy.get("#notes").scrollIntoView();
}

enterAssetNotes(text) {
enterAssetNotes(text: string) {
cy.get("#notes").click().clear();
cy.get("#notes").click().type(text);
}

enterAssetservicedate(text) {
enterAssetservicedate(text: string) {
cy.get("input[name='last_serviced_on']").click();
cy.get("#date-input").click().type(text);
}

scrollintoWarrantyDetails() {
cy.get("#warranty-details").scrollIntoView();
}

enterWarrantyExpiryDate(text: string) {
cy.get("#WarrantyAMCExpiry").click();
cy.get("#WarrantyAMCExpiry").click().type(text);
}

verifyWarrantyExpiryLabel(duration: string) {
if (duration === "") {
cy.get("#warranty-amc-expired-red").should("not.exist");
cy.get("#warranty-amc-expiring-soon-orange").should("not.exist");
cy.get("#warranty-amc-expiring-soon-yellow").should("not.exist");
} else if (duration === "expired") {
cy.get("#warranty-amc-expired-red").should("be.visible");
} else if (duration === "1 month") {
cy.get("#warranty-amc-expiring-soon-orange").should("be.visible");
} else if (duration === "3 months") {
cy.get("#warranty-amc-expiring-soon-yellow").should("be.visible");
}
}

clickassetupdatebutton() {
cy.get("#submit").click();
}
Expand Down
Loading
Loading