From c07414481b14cc83731c19072c83cb6a19ee4328 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:21:25 +0530 Subject: [PATCH 01/45] New Cypress Test | Advance Filters Functionality | User Tab (#6510) * cypress new test for advance filter * Delete package-lock.json * Revert "Delete package-lock.json" This reverts commit 8e555dd85c174d0d259f31d74b10b62a7d4c1f09. * revert package-lock --- cypress/e2e/users_spec/user_crud.cy.ts | 4 +- cypress/e2e/users_spec/user_homepage.cy.ts | 38 ++++++++++++++- cypress/pageobject/Users/UserSearch.ts | 57 ++++++++++++++++++++++ package-lock.json | 2 +- 4 files changed, 97 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/users_spec/user_crud.cy.ts b/cypress/e2e/users_spec/user_crud.cy.ts index 41a12a891a8..dbe19485359 100644 --- a/cypress/e2e/users_spec/user_crud.cy.ts +++ b/cypress/e2e/users_spec/user_crud.cy.ts @@ -11,8 +11,8 @@ const makeid = (length: number) => { }; const username = makeid(25); -const phone_number = 9999999999; -const alt_phone_number = 9999999999; +const phone_number = "9999999999"; +const alt_phone_number = "9999999999"; describe("User management", () => { before(() => { diff --git a/cypress/e2e/users_spec/user_homepage.cy.ts b/cypress/e2e/users_spec/user_homepage.cy.ts index 40a55bad1e8..c8100f7d83d 100644 --- a/cypress/e2e/users_spec/user_homepage.cy.ts +++ b/cypress/e2e/users_spec/user_homepage.cy.ts @@ -4,11 +4,14 @@ 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", () => { +describe("User Homepage", () => { const userPage = new UserPage(); const usernameToTest = "devdoctor"; const currentuser = "devdistrictadmin"; const loginPage = new LoginPage(); + const phone_number = "9876543219"; + const alt_phone_number = "9876543219"; + before(() => { loginPage.loginAsDisctrictAdmin(); cy.saveLocalStorage(); @@ -19,6 +22,38 @@ describe("Asset Tab", () => { cy.awaitUrl("/users"); }); + it("User advance filter functionality", () => { + userPage.clickAdvancedFilters(); + userPage.typeInFirstName("Dev"); + userPage.typeInLastName("Doctor"); + userPage.selectRole("Doctor"); + userPage.selectDistrict("Ernakulam"); + userPage.typeInPhoneNumber(phone_number); + userPage.typeInAltPhoneNumber(alt_phone_number); + userPage.applyFilter(); + userPage.verifyUrlafteradvancefilter(); + userPage.checkUsernameText(usernameToTest); + userPage.verifyDataTestIdText("First Name", "First Name: Dev"); + userPage.verifyDataTestIdText("Last Name", "Last Name: Doctor"); + userPage.verifyDataTestIdText( + "Phone Number", + "Phone Number: +919876543219" + ); + userPage.verifyDataTestIdText( + "WhatsApp no.", + "WhatsApp no.: +919876543219" + ); + userPage.verifyDataTestIdText("Role", "Role: Doctor"); + userPage.verifyDataTestIdText("District", "District: Ernakulam"); + userPage.clearFilters(); + userPage.verifyDataTestIdNotVisible("First Name"); + userPage.verifyDataTestIdNotVisible("Last Name"); + userPage.verifyDataTestIdNotVisible("Phone Number"); + userPage.verifyDataTestIdNotVisible("WhatsApp no."); + userPage.verifyDataTestIdNotVisible("Role"); + userPage.verifyDataTestIdNotVisible("District"); + }); + it("Search by username", () => { userPage.checkSearchInputVisibility(); userPage.typeInSearchInput(usernameToTest); @@ -33,6 +68,7 @@ describe("Asset Tab", () => { userPage.checkUsernameBadgeVisibility(false); userPage.checkUsernameText(currentuser); }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Users/UserSearch.ts b/cypress/pageobject/Users/UserSearch.ts index 311a4b87c3a..681144b742e 100644 --- a/cypress/pageobject/Users/UserSearch.ts +++ b/cypress/pageobject/Users/UserSearch.ts @@ -22,6 +22,16 @@ export class UserPage { cy.url().should("include", `username=${username}`); } + verifyUrlafteradvancefilter() { + cy.url() + .should("include", "first_name=Dev") + .and("include", "last_name=Doctor") + .and("include", "phone_number=%2B919876543219") + .and("include", "alt_phone_number=%2B919876543219") + .and("include", "user_type=Doctor") + .and("include", "district_id=7"); + } + checkUsernameText(username: string) { cy.get(this.usernameText).should("have.text", username); } @@ -34,4 +44,51 @@ export class UserPage { clickRemoveIcon() { cy.get(this.removeIcon).click(); } + + clickAdvancedFilters() { + cy.get("#advanced-filter").contains("Advanced Filters").click(); + } + + typeInFirstName(firstName: string) { + cy.get("#first_name").click().type(firstName); + } + + typeInLastName(lastName: string) { + cy.get("#last_name").click().type(lastName); + } + + selectRole(role: string) { + cy.get("#role button").click(); + cy.get("[role='option']").contains(role).click(); + } + + selectDistrict(district: string) { + cy.get("input[name='district']").click().type(district); + cy.get("[role='option']").contains(district).click(); + } + + typeInPhoneNumber(phone: string) { + cy.get("#phone_number").click().type(phone); + } + + typeInAltPhoneNumber(altPhone: string) { + cy.get("#alt_phone_number").click().type(altPhone); + } + + applyFilter() { + cy.get("#apply-filter").click(); + } + + verifyDataTestIdText(testId: string, text: string) { + cy.get(`[data-testid="${testId}"]`).contains(text).should("be.visible"); + } + + clearFilters() { + this.clickAdvancedFilters(); + cy.get("#clear-filter").contains("Clear").click(); + } + + verifyDataTestIdNotVisible(testId: string) { + cy.get(`[data-testid="${testId}"]`).should("not.be.visible"); + } } diff --git a/package-lock.json b/package-lock.json index 0da53d597ab..baa3205a234 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23708,4 +23708,4 @@ } } } -} +} \ No newline at end of file From d1d863ea795d203089e85245075e1a5fd375b607 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:24:34 +0530 Subject: [PATCH 02/45] Existing Cypress POM Conversion | Page Navigation | User Tab (#6511) * cypress new test for advance filter * convert navigation to POM * Delete package-lock.json --- cypress/e2e/users_spec/user_crud.cy.ts | 8 -------- cypress/e2e/users_spec/user_homepage.cy.ts | 7 +++++++ cypress/pageobject/Users/UserSearch.ts | 12 ++++++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/users_spec/user_crud.cy.ts b/cypress/e2e/users_spec/user_crud.cy.ts index dbe19485359..91104af518f 100644 --- a/cypress/e2e/users_spec/user_crud.cy.ts +++ b/cypress/e2e/users_spec/user_crud.cy.ts @@ -114,14 +114,6 @@ describe("User management", () => { .contains("Facility - User Already has permission to this facility"); }); - it("Next/Previous Page", () => { - // only works for desktop mode - cy.get("button#next-pages").click(); - cy.url().should("include", "page=2"); - cy.get("button#prev-pages").click(); - cy.url().should("include", "page=1"); - }); - afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/e2e/users_spec/user_homepage.cy.ts b/cypress/e2e/users_spec/user_homepage.cy.ts index c8100f7d83d..060132105e6 100644 --- a/cypress/e2e/users_spec/user_homepage.cy.ts +++ b/cypress/e2e/users_spec/user_homepage.cy.ts @@ -69,6 +69,13 @@ describe("User Homepage", () => { userPage.checkUsernameText(currentuser); }); + it("Next/Previous Page Navigation", () => { + userPage.navigateToNextPage(); + userPage.verifyCurrentPageNumber(2); + userPage.navigateToPreviousPage(); + userPage.verifyCurrentPageNumber(1); + }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Users/UserSearch.ts b/cypress/pageobject/Users/UserSearch.ts index 681144b742e..6be0603be43 100644 --- a/cypress/pageobject/Users/UserSearch.ts +++ b/cypress/pageobject/Users/UserSearch.ts @@ -91,4 +91,16 @@ export class UserPage { verifyDataTestIdNotVisible(testId: string) { cy.get(`[data-testid="${testId}"]`).should("not.be.visible"); } + + navigateToNextPage() { + cy.get("button#next-pages").click(); + } + + navigateToPreviousPage() { + cy.get("button#prev-pages").click(); + } + + verifyCurrentPageNumber(pageNumber: number) { + cy.url().should("include", `page=${pageNumber}`); + } } From edd6a7ec55252264b3c4f56eba43ac6f34f421ba Mon Sep 17 00:00:00 2001 From: Shyam Prakash <106866225+shyamprakash123@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:25:20 +0530 Subject: [PATCH 03/45] FixedSignoutFlow#6504 (#6509) --- src/Utils/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index 3aef5b03d67..847304553a8 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -107,8 +107,8 @@ export const handleSignOut = (forceReload: boolean) => { Object.values(LocalStorageKeys).forEach((key) => localStorage.removeItem(key) ); - navigate("/"); - if (forceReload) window.location.reload(); + if (forceReload) window.location.href = "/"; + else navigate("/"); }; /** From 66aa48b52764e450174e02eca93dea068cefb240 Mon Sep 17 00:00:00 2001 From: Shyam Prakash <106866225+shyamprakash123@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:25:41 +0530 Subject: [PATCH 04/45] Fixed responsive issue in facility page (#6507) --- src/Components/Facility/FacilityCard.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx index 43e515cec93..d8c8baeb802 100644 --- a/src/Components/Facility/FacilityCard.tsx +++ b/src/Components/Facility/FacilityCard.tsx @@ -48,11 +48,11 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { return (
-
+
{(facility.read_cover_image_url && ( {
{(facility.read_cover_image_url && ( { )} -
+
{facility.kasp_empanelled && ( @@ -88,7 +88,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { {kasp_string}
)} -
+
{
-
+
-
+
0.85 @@ -220,7 +220,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
-
+
{userType !== "Staff" ? ( Date: Mon, 30 Oct 2023 14:26:30 +0530 Subject: [PATCH 05/45] Fixed pressure sore popup not closing after clicking outside (#6482) * changed PressureSoreInputModal to absolute positioning for handleClickOutside to work * changed PainInputModal to absolute positioning for handleClickOutside to work --- .../Pain/CriticalCare__PainInputModal.res | 25 ++++++++++--------- .../CriticalCare__PressureSoreInputModal.res | 4 +-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res b/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res index 63be6d2f3a4..eb4fd2b2376 100644 --- a/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res +++ b/src/Components/CriticalCareRecording/Pain/CriticalCare__PainInputModal.res @@ -31,7 +31,6 @@ let make = ( None }, [state]) - let handleClickOutside = %raw(` function (event, ref, hideModal) { if (ref.current && !ref.current.contains(event.target)) { @@ -56,18 +55,18 @@ let make = ( } }) -let getStatus = (min, minText, max, maxText, val) => { - switch (val >= min, val <= max) { - | (true, true) => ("Normal", "#059669") - | (true, false) => (maxText, "#DC2626") - | _ => (minText, "#DC2626") + let getStatus = (min, minText, max, maxText, val) => { + switch (val >= min, val <= max) { + | (true, true) => ("Normal", "#059669") + | (true, false) => (maxText, "#DC2626") + | _ => (minText, "#DC2626") + } } -}