Skip to content

Commit

Permalink
Merge branch 'develop' into issues/8160/Death-report-is-missing-patie…
Browse files Browse the repository at this point in the history
…nt-age
  • Loading branch information
khavinshankar authored Oct 15, 2024
2 parents 67ed923 + 7518c6b commit df5af4e
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 37 deletions.
8 changes: 6 additions & 2 deletions cypress/e2e/facility_spec/FacilityLocation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ describe("Location Management Section", () => {
facilityLocation.clickAddNewLocationButton();
facilityLocation.enterLocationName("Test Location with Beds");
facilityLocation.selectLocationType("OTHER");
assetPage.clickassetupdatebutton();
cy.submitButton("Add Location");
cy.verifyNotification("Location created successfully");
cy.closeNotification();
facilityLocation.clickManageBedButton();
facilityLocation.clickAddBedButton();
facilityLocation.enterBedName("Bed 1");
facilityLocation.selectBedType("Regular");
assetPage.clickassetupdatebutton();
cy.submitButton("Add Bed(s)");
cy.verifyNotification("1 Bed created successfully");
cy.closeNotification();
facilityLocation.loadLocationManagementPage("Dummy Shifting Center");
facilityLocation.deleteLocation("Test Location with Beds");
assetPage.clickassetupdatebutton();
Expand Down
56 changes: 56 additions & 0 deletions cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { DoctorConnect } from "pageobject/Patient/PatientDoctorConnect";
import LoginPage from "../../pageobject/Login/LoginPage";
import { PatientPage } from "../../pageobject/Patient/PatientCreation";

describe("Patient Doctor Connect in consultation page", () => {
const loginPage = new LoginPage();
const patientPage = new PatientPage();
const doctorconnect = new DoctorConnect();
const patientName = "Dummy Patient 11";
const doctorUser = "Dev Doctor";
const doctorUserNumber = "+919876543219";
const nurseUser = "Dev Staff";
const teleIcuUser = "Dev Doctor Two";

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

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

it("Patient Doctor connect phone redirection and sort by filter", () => {
// click on the slideover and verify icon redirection
patientPage.visitPatient(patientName);
doctorconnect.clickDoctorConnectButton();
// verify all the users are visible under the all section
cy.verifyContentPresence("#doctor-connect-home-doctor", [doctorUser]);
cy.verifyContentPresence("#doctor-connect-home-nurse", [nurseUser]);
cy.verifyContentPresence("#doctor-connect-remote-doctor", [teleIcuUser]);
// verify copy content button functionality
doctorconnect.CopyFunctionTrigger();
doctorconnect.clickCopyPhoneNumber(
"#doctor-connect-home-doctor",
doctorUser,
);
doctorconnect.verifyCopiedContent(doctorUserNumber);
// verify the whatsapp and phone number icon presence
doctorconnect.verifyIconVisible("#whatsapp-icon");
doctorconnect.verifyIconVisible("#phone-icon");
// sort the each datas based on user type
doctorconnect.clickUsersSortBy("Doctor");
cy.verifyContentPresence("#doctor-connect-home-doctor", [doctorUser]);
doctorconnect.clickUsersSortBy("Nurse");
cy.verifyContentPresence("#doctor-connect-home-nurse", [nurseUser]);
doctorconnect.clickUsersSortBy("TeleICU Doctor");
cy.verifyContentPresence("#doctor-connect-remote-doctor", [teleIcuUser]);
});

afterEach(() => {
cy.saveLocalStorage();
});
});
32 changes: 32 additions & 0 deletions cypress/pageobject/Patient/PatientDoctorConnect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export class DoctorConnect {
clickDoctorConnectButton() {
cy.get("#doctor-connect-button").scrollIntoView();
cy.get("#doctor-connect-button").click();
}

CopyFunctionTrigger() {
cy.window().then((win) => {
cy.stub(win.navigator.clipboard, "writeText").as("clipboardStub");
});
}

verifyCopiedContent(text: string) {
cy.get("@clipboardStub").should("be.calledWith", text);
}

verifyIconVisible(selector: string) {
cy.get(selector).should("be.visible");
}

clickCopyPhoneNumber(element: string, text: string) {
cy.get(element)
.contains(text) // Find the element containing "dev doctor"
.parent() // Move up to the parent element (if necessary)
.find("#copy-phoneicon") // Find the #copy-phoneicon within that context
.click();
}

clickUsersSortBy(text: string) {
cy.get("#doctor-connect-filter-tabs").contains(text).click();
}
}
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"i18next": "^23.11.4",
"i18next-browser-languagedetector": "^7.2.1",
"lodash-es": "^4.17.21",
"lucide-react": "^0.446.0",
"postcss-loader": "^7.3.3",
"qrcode.react": "^3.1.0",
"raviger": "^4.1.2",
Expand Down Expand Up @@ -121,15 +120,13 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"gentype": "^4.5.0",
"glob": "^11.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"local-cypress": "^1.2.6",
"postcss": "^8.4.38",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"prop-types": "^15.8.1",
"redux-devtools-extension": "^2.13.9",
"snyk": "^1.1291.0",
"tailwindcss": "^3.4.3",
Expand Down
9 changes: 1 addition & 8 deletions src/Components/ErrorPages/SessionExpired.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import * as Notification from "../../Utils/Notifications";
import { useNavigate } from "raviger";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useAuthContext } from "../../Common/hooks/useAuthUser";

export default function SessionExpired() {
const { signOut, user } = useAuthContext();
const isAuthenticated = !!user;
const navigate = useNavigate();
const { signOut } = useAuthContext();
const { t } = useTranslation();

useEffect(() => {
Notification.closeAllNotifications();
}, []);

if (isAuthenticated) {
navigate("/");
}

return (
<div className="flex h-screen items-center justify-center text-center">
<div className="w-[500px] text-center">
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export const ConsultationDetails = (props: any) => {
{!consultationData.discharge_date && (
<>
<button
id="doctor-connect-button"
onClick={() => {
triggerGoal("Doctor Connect Clicked", {
consultationId,
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Facility/DoctorVideoSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function UserListItem({ user }: { user: UserAnnotatedWithGroup }) {
);
}}
>
<span className="tooltip">
<span className="tooltip" id="copy-phoneicon">
<span className="tooltip-text tooltip-top">
Copy Phone number
</span>
Expand Down Expand Up @@ -347,7 +347,7 @@ function DoctorConnectButtons(props: {
<a onClick={props.connectOnWhatsApp}>
<div className="tooltip">
<span className="tooltip-text tooltip-left">Connect on WhatsApp</span>
<CareIcon icon="l-whatsapp" className="h-5 w-5" />
<CareIcon icon="l-whatsapp" id="whatsapp-icon" className="h-5 w-5" />
</div>
</a>
<a
Expand All @@ -363,7 +363,7 @@ function DoctorConnectButtons(props: {
>
<div className="tooltip">
<span className="tooltip-text tooltip-left">Connect on Phone</span>
<CareIcon icon="l-phone-alt" className="h-5 w-5" />
<CareIcon icon="l-phone-alt" id="phone-icon" className="h-5 w-5" />
</div>
</a>
</div>
Expand Down

0 comments on commit df5af4e

Please sign in to comment.