-
Notifications
You must be signed in to change notification settings - Fork 561
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
Refactor Facility Export & Add New Sidebar collapse & expand Test #9066
Changes from 1 commit
9ad063c
be0448e
eb07939
287e353
afa760c
5f57f05
3d06dba
8b2fb07
495a476
4503dae
9d65b4f
6383d75
19a6609
bbe15ed
5a66406
9da4ef4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,11 +1,10 @@ | ||||||||
// FacilityCreation | ||||||||
|
||||||||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||||||||
import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; | ||||||||
import FacilityPage from "../../pageobject/Facility/FacilityCreation"; | ||||||||
import FacilityHome from "../../pageobject/Facility/FacilityHome"; | ||||||||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||||||||
import ManageUserPage from "../../pageobject/Users/ManageUserPage"; | ||||||||
import FacilityPage from "../../pageobject/Facility/FacilityCreation"; | ||||||||
import { UserPage } from "../../pageobject/Users/UserSearch"; | ||||||||
import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; | ||||||||
|
||||||||
describe("Facility Homepage Function", () => { | ||||||||
const loginPage = new LoginPage(); | ||||||||
|
@@ -17,6 +16,7 @@ describe("Facility Homepage Function", () => { | |||||||
const facilitiesAlias = "downloadFacilitiesCSV"; | ||||||||
const doctorsAlias = "downloadDoctorsCSV"; | ||||||||
const triagesAlias = "downloadTriagesCSV"; | ||||||||
const capacitiesAlias = "downloadCapacitiesCSV"; | ||||||||
const facilityName = "Dummy Facility 40"; | ||||||||
const facilityLocaion = "Dummy Location"; | ||||||||
const stateName = "Kerala"; | ||||||||
|
@@ -107,11 +107,12 @@ describe("Facility Homepage Function", () => { | |||||||
facilityHome.clickExportButton(); | ||||||||
facilityHome.clickMenuItem("Triages"); | ||||||||
facilityHome.verifyDownload(triagesAlias); | ||||||||
}); | ||||||||
|
||||||||
it("Verify Capacity Export Functionality", () => { | ||||||||
// Verify Capacity Export | ||||||||
facilityHome.csvDownloadIntercept(capacitiesAlias, "&capacity"); | ||||||||
facilityHome.clickExportButton(); | ||||||||
facilityHome.clickMenuItem("Capacities"); | ||||||||
facilityHome.verifyDownload(capacitiesAlias); | ||||||||
}); | ||||||||
|
||||||||
it("Verify Facility Detail page redirection to CNS and Live Minitoring ", () => { | ||||||||
|
@@ -135,7 +136,23 @@ describe("Facility Homepage Function", () => { | |||||||
facilityHome.verifyLiveMonitorUrl(); | ||||||||
}); | ||||||||
|
||||||||
afterEach(() => { | ||||||||
cy.saveLocalStorage(); | ||||||||
it("Verify sidebar collapse and expand functionality", () => { | ||||||||
facilityHome.toggleSidebar(); | ||||||||
facilityHome.verifyIconsVisible(); | ||||||||
facilityHome.verifyTextVisible(); | ||||||||
|
||||||||
// Click toggle button to collapse sidebar, verify icons visible and text hidden | ||||||||
facilityHome.toggleSidebar(); | ||||||||
facilityHome.verifyIconsVisible(); | ||||||||
facilityHome.verifyTextHidden(); | ||||||||
|
||||||||
// Click toggle button again to expand sidebar, verify icons and text are visible again | ||||||||
facilityHome.toggleSidebar(); | ||||||||
facilityHome.verifyIconsVisible(); | ||||||||
facilityHome.verifyTextVisible(); | ||||||||
}); | ||||||||
}); | ||||||||
|
||||||||
afterEach(() => { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||
cy.saveLocalStorage(); | ||||||||
}); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove duplicate afterEach hook. There's a duplicate Remove the duplicate hook: -afterEach(() => {
- cy.saveLocalStorage();
-}); 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome[error] 209-209: expected the file ends here (parse) [error] 206-209: Disallow duplicate setup and teardown hooks. Disallow afterEach duplicacy inside the describe function. (lint/suspicious/noDuplicateTestHooks) |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,6 +4,10 @@ class FacilityHome { | |||||||||||||
searchButton = "#search"; | ||||||||||||||
menuItem = "[role='menuitem']"; | ||||||||||||||
|
||||||||||||||
sidebarToggle = () => cy.get('[data-testid="sidebar-toggle"]'); | ||||||||||||||
sidebarIcon = () => cy.get('[data-testid="sidebar-icon"]'); | ||||||||||||||
sidebarText = () => cy.get('[data-testid="sidebar-text"]'); | ||||||||||||||
|
||||||||||||||
// Operations | ||||||||||||||
clickExportButton() { | ||||||||||||||
cy.get(this.exportButton).scrollIntoView(); | ||||||||||||||
|
@@ -103,6 +107,26 @@ class FacilityHome { | |||||||||||||
const encodedText = encodeURIComponent(searchText).replace(/%20/g, "+"); | ||||||||||||||
this.getURL().should("include", `search=${encodedText}`); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
toggleSidebar() { | ||||||||||||||
this.sidebarToggle().click(); | ||||||||||||||
} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add visibility check before clicking To prevent flaky tests, consider adding a visibility check before clicking: toggleSidebar() {
- this.sidebarToggle().click();
+ this.sidebarToggle().should('be.visible').click();
} 📝 Committable suggestion
Suggested change
|
||||||||||||||
|
||||||||||||||
verifyIconsVisible() { | ||||||||||||||
this.sidebarIcon().each(($el) => { | ||||||||||||||
cy.wrap($el).should("be.visible"); | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
verifyTextVisible() { | ||||||||||||||
this.sidebarText().each(($el) => { | ||||||||||||||
cy.wrap($el).should("be.visible"); | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
verifyTextHidden() { | ||||||||||||||
this.sidebarText().should("not.be.visible"); | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
export default FacilityHome; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nihal467 sir I have made changes for this & sorry for those syntax & duplicate errors I tried to fix merge conflicts directly & made those mistakes