Skip to content

Commit

Permalink
Merge branch 'develop' into issues/7350/fix-wrong-terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-learner authored Nov 14, 2024
2 parents 79a3616 + da5d576 commit 26ed105
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 77 deletions.
5 changes: 3 additions & 2 deletions cypress/e2e/assets_spec/AssetHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";
import { v4 as uuidv4 } from "uuid";

import { AssetPage } from "../../pageobject/Asset/AssetCreation";
Expand Down Expand Up @@ -65,13 +66,13 @@ describe("Asset Tab", () => {
"ONVIF Camera",
"Camera Loc",
);
assetFilters.clickadvancefilter();
advanceFilters.clickAdvancedFiltersButton();
assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters
assetFilters.assertFacilityText("Dummy Facility 40");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
assetFilters.assertLocationText("Camera Loc");
assetFilters.clickadvancefilter();
advanceFilters.clickAdvancedFiltersButton();
assetFilters.clearFilters();
});

Expand Down
9 changes: 5 additions & 4 deletions cypress/e2e/facility_spec/FacilityCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe("Facility Creation", () => {
"This field is required",
];
const triageErrorMessage = ["This field is required"];
const facilityType = "Primary Health Centres";

before(() => {
loginPage.loginAsDistrictAdmin();
Expand Down Expand Up @@ -117,7 +118,7 @@ describe("Facility Creation", () => {
facilityPage.submitForm();
userCreationPage.verifyErrorMessages(facilityErrorMessage);
facilityPage.fillFacilityName(facilityName);
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.clickfacilityfeatureoption();
facilityFeature.forEach((featureText) => {
cy.get("[role='option']").contains(featureText).click();
Expand Down Expand Up @@ -206,7 +207,7 @@ describe("Facility Creation", () => {
it("Create a new facility with single bed and doctor capacity", () => {
facilityPage.visitCreateFacilityPage();
facilityPage.fillFacilityName(facilityName);
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.fillPincode("682001");
facilityPage.selectStateOnPincode("Kerala");
facilityPage.selectDistrictOnPincode("Ernakulam");
Expand Down Expand Up @@ -246,7 +247,7 @@ describe("Facility Creation", () => {
it("Create a new facility with no bed and doctor capacity", () => {
facilityPage.visitCreateFacilityPage();
facilityPage.fillFacilityName(facilityName);
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.fillPincode("682001");
facilityPage.selectStateOnPincode("Kerala");
facilityPage.selectDistrictOnPincode("Ernakulam");
Expand Down Expand Up @@ -285,7 +286,7 @@ describe("Facility Creation", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl1);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
facilityPage.clickUpdateFacilityType("Primary Health Centres");
facilityPage.selectFacilityType(facilityType);
facilityPage.fillAddress(facilityUpdateAddress);
facilityPage.fillOxygenCapacity(oxygenCapacity);
facilityPage.fillExpectedOxygenRequirement(oxygenExpected);
Expand Down
26 changes: 14 additions & 12 deletions cypress/e2e/facility_spec/FacilityHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FacilityNotify from "../../pageobject/Facility/FacilityNotify";
import LoginPage from "../../pageobject/Login/LoginPage";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import { UserPage } from "../../pageobject/Users/UserSearch";
import { advanceFilters } from "../../pageobject/utils/advanceFilterHelpers";

describe("Facility Homepage Function", () => {
const loginPage = new LoginPage();
Expand Down Expand Up @@ -61,18 +62,19 @@ describe("Facility Homepage Function", () => {
});

it("Verify the functionality of advance filter", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localBody);
facilityPage.clickUpdateFacilityType(facilityType);
userPage.applyFilter();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.selectState(stateName);
advanceFilters.selectDistrict(district);
advanceFilters.selectLocalBody(localBody);
advanceFilters.selectFacilityType(facilityType);
advanceFilters.applySelectedFilter();
facilityPage.verifyStateBadgeContent(stateName);
facilityPage.verifyDistrictBadgeContent(district);
facilityPage.verifyLocalBodyBadgeContent(localBody);
facilityPage.verifyFacilityTypeBadgeContent(facilityType);
manageUserPage.assertFacilityInCard(facilityName);
userPage.clearFilters();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.clickClearAdvanceFilters();
userPage.verifyDataTestIdNotVisible("State");
userPage.verifyDataTestIdNotVisible("District");
userPage.verifyDataTestIdNotVisible("Facility type");
Expand Down Expand Up @@ -116,11 +118,11 @@ describe("Facility Homepage Function", () => {
});

it("Verify Facility Detail page redirection to CNS and Live Minitoring ", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(stateName);
facilityPage.selectDistrict(district);
facilityPage.selectLocalBody(localBody);
userPage.applyFilter();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.selectState(stateName);
advanceFilters.selectDistrict(district);
advanceFilters.selectLocalBody(localBody);
advanceFilters.applySelectedFilter();
// go to cns page in the facility details page
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
Expand Down
12 changes: 7 additions & 5 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";

import LoginPage from "../../pageobject/Login/LoginPage";
import PatientHome from "../../pageobject/Patient/PatientHome";

Expand Down Expand Up @@ -35,7 +37,7 @@ describe("Patient Homepage present functionalities", () => {
});

it("Date based advance filters applied in the patient tab", () => {
patientHome.clickPatientAdvanceFilters();
advanceFilters.clickAdvancedFiltersButton();
patientHome.typePatientCreatedBeforeDate(patientFromDate);
patientHome.typePatientCreatedAfterDate(patientToDate);
patientHome.typePatientModifiedBeforeDate(patientFromDate);
Expand All @@ -55,7 +57,7 @@ describe("Patient Homepage present functionalities", () => {
});

it("Facility Geography based advance filters applied in the patient tab", () => {
patientHome.clickPatientAdvanceFilters();
advanceFilters.clickAdvancedFiltersButton();
patientHome.typeFacilityName(facilityName);
patientHome.selectFacilityType(facilityType);
patientHome.typeFacilityLsgBody(facilityLsgBody);
Expand All @@ -73,7 +75,7 @@ describe("Patient Homepage present functionalities", () => {

it("Patient diagnosis based advance filters applied in the patient tab", () => {
// Patient Filtering based on icd-11 data
patientHome.clickPatientAdvanceFilters();
advanceFilters.clickAdvancedFiltersButton();
patientHome.selectAnyIcdDiagnosis(patientIcdDiagnosis, patientIcdDiagnosis);
patientHome.selectConfirmedIcdDiagnosis(
patientIcdDiagnosis,
Expand Down Expand Up @@ -103,7 +105,7 @@ describe("Patient Homepage present functionalities", () => {
cy.clearAllFilters();
patientHome.verifyTotalPatientCount("1");
// Apply Any and confirmed diagonsis to verify patient count 17
patientHome.clickPatientAdvanceFilters();
advanceFilters.clickAdvancedFiltersButton();
patientHome.selectAnyIcdDiagnosis(patientIcdDiagnosis, patientIcdDiagnosis);
patientHome.selectConfirmedIcdDiagnosis(
patientIcdDiagnosis,
Expand All @@ -115,7 +117,7 @@ describe("Patient Homepage present functionalities", () => {

it("Patient Details based advance filters applied in the patient tab", () => {
// Patient Filtering based on patient details
patientHome.clickPatientAdvanceFilters();
advanceFilters.clickAdvancedFiltersButton();
patientHome.selectPatientGenderfilter(patientGender);
patientHome.selectPatientCategoryfilter(patientCategory);
patientHome.typePatientMinimumAgeFilter(patientMinimumAge);
Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/shifting_spec/ShiftingAdvanceFilters.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";

import ShiftingPage from "../../pageobject/Shift/ShiftFilters";

describe("Shifting section filter", () => {
Expand All @@ -12,7 +14,7 @@ describe("Shifting section filter", () => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/shifting");
shiftingPage.advancedFilterButton().click();
advanceFilters.clickAdvancedFiltersButton();
});

it("filter by facility", () => {
Expand Down
9 changes: 6 additions & 3 deletions cypress/e2e/users_spec/UsersHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";

import LoginPage from "../../pageobject/Login/LoginPage";
import { UserPage } from "../../pageobject/Users/UserSearch";

Expand Down Expand Up @@ -28,7 +30,7 @@ describe("User Homepage", () => {
});

it("User advance filter functionality", () => {
userPage.clickAdvancedFilters();
advanceFilters.clickAdvancedFiltersButton();
userPage.typeInFirstName(firstName);
userPage.typeInLastName(lastName);
userPage.selectRole(role);
Expand All @@ -37,7 +39,7 @@ describe("User Homepage", () => {
userPage.typeInPhoneNumber(phoneNumber);
userPage.typeInAltPhoneNumber(altPhoneNumber);
userPage.selectHomeFacility(homeFacility);
userPage.applyFilter();
advanceFilters.applySelectedFilter();
userPage.checkUsernameText(nurseUserName);
// Verify the badges related to the data
userPage.verifyDataTestIdText("First Name", `First Name: ${firstName}`);
Expand All @@ -55,7 +57,8 @@ describe("User Homepage", () => {
"Home Facility",
`Home Facility: ${homeFacility}`,
);
userPage.clearFilters();
advanceFilters.clickAdvancedFiltersButton();
advanceFilters.clickClearAdvanceFilters();
userPage.verifyDataTestIdNotVisible("First Name");
userPage.verifyDataTestIdNotVisible("Last Name");
userPage.verifyDataTestIdNotVisible("Phone Number");
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/users_spec/UsersManage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";

import LoginPage from "../../pageobject/Login/LoginPage";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import { UserCreationPage } from "../../pageobject/Users/UserCreation";
Expand Down Expand Up @@ -55,10 +57,10 @@ describe("Manage User", () => {

it("linking skills for a doctor users and verify its reflection in doctor connect", () => {
// select a doctor user and link and unlink same skill twice and verify the badge is only shown once in doctor connect
userPage.clickAdvancedFilters();
advanceFilters.clickAdvancedFiltersButton();
userPage.typeInFirstName(firstNameUserSkill);
userPage.typeInLastName(lastNameUserSkill);
userPage.applyFilter();
advanceFilters.applySelectedFilter();
userPage.checkUsernameText(usernameToLinkSkill);
manageUserPage.clicklinkedskillbutton();
manageUserPage.selectSkillFromDropdown(linkedskill);
Expand Down
3 changes: 0 additions & 3 deletions cypress/pageobject/Asset/AssetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ export class AssetFilters {
expect(allEmpty).to.be.true;
});
}
clickadvancefilter() {
cy.get("#advanced-filter").click();
}
clickslideoverbackbutton() {
cy.get("#close-slide-over").click();
}
Expand Down
33 changes: 9 additions & 24 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// FacilityPage.ts
import { advanceFilters } from "pageobject/utils/advanceFilterHelpers";

class FacilityPage {
visitCreateFacilityPage() {
Expand All @@ -14,21 +14,21 @@ class FacilityPage {
cy.get("#search").click().type(facilityName);
}

selectFacilityType(facility: string) {
advanceFilters.selectFacilityType(facility);
}

selectLocalBody(localBody: string) {
advanceFilters.selectLocalBody(localBody);
}

visitUpdateFacilityPage(url: string) {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.visit(url);
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("#manage-facility-dropdown button").should("be.visible");
}

clickUpdateFacilityType(facilityType: string) {
cy.get("#facility_type")
.click()
.then(() => {
cy.get("[role='option']").contains(facilityType).click();
});
}

fillFacilityName(name: string) {
cy.get("#name").click().clear().click().type(name);
}
Expand All @@ -37,21 +37,6 @@ class FacilityPage {
cy.get("#pincode").click().type(pincode);
}

selectState(state: string) {
cy.get("div#state button").click();
cy.get("[role='option']").contains(state).click();
}

selectDistrict(district: string) {
cy.get("div#district button").click();
cy.get("[role='option']").contains(district).click();
}

selectLocalBody(localBody: string) {
cy.get("div#local_body button").click();
cy.get("[role='option']").contains(localBody).click();
}

selectWard(ward: string) {
cy.get("div#ward button").click();
cy.get("[role='option']").contains(ward).click();
Expand Down
4 changes: 0 additions & 4 deletions cypress/pageobject/Patient/PatientHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ class PatientHome {
);
}

clickPatientAdvanceFilters() {
cy.get("#advanced-filter").click();
}

selectPatientGenderfilter(gender: string) {
cy.clickAndSelectOption("#gender-advancefilter", gender);
}
Expand Down
4 changes: 0 additions & 4 deletions cypress/pageobject/Shift/ShiftFilters.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
class ShiftingPage {
advancedFilterButton() {
return cy.get("#advanced-filter");
}

originFacilityInput() {
return cy.get("input[name='origin_facility']");
}
Expand Down
13 changes: 0 additions & 13 deletions cypress/pageobject/Users/UserSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export class UserPage {
cy.get(this.removeIcon).click();
}

clickAdvancedFilters() {
cy.get("#advanced-filter").contains("Advanced Filters").click();
}

typeInFirstName(firstName: string) {
cy.get("#first_name").click().type(firstName);
}
Expand Down Expand Up @@ -72,19 +68,10 @@ export class UserPage {
cy.typeAndSelectOption("input[name='home_facility']", facility);
}

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");
}
Expand Down
29 changes: 29 additions & 0 deletions cypress/pageobject/utils/advanceFilterHelpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const advanceFilters = {
clickAdvancedFiltersButton() {
cy.verifyAndClickElement("#advanced-filter", "Advanced Filters");
},

selectState(state: string) {
cy.clickAndSelectOption("#state", state);
},

selectDistrict(district: string) {
cy.clickAndSelectOption("#district", district);
},

selectLocalBody(localBody: string) {
cy.clickAndSelectOption("#local_body", localBody);
},

applySelectedFilter() {
cy.verifyAndClickElement("#apply-filter", "Apply");
},

selectFacilityType(facilityType: string) {
cy.clickAndSelectOption("#facility_type", facilityType);
},

clickClearAdvanceFilters() {
cy.verifyAndClickElement("#clear-filter", "Clear");
},
};

0 comments on commit 26ed105

Please sign in to comment.