Skip to content

Commit

Permalink
added coderabbit suggestions to reduce duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Alokih committed Nov 12, 2024
1 parent 5f57f05 commit 3d06dba
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions cypress/pageobject/Facility/FacilityHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,30 @@ class FacilityHome {
}

toggleSidebar() {
this.sidebarToggle().click();
this.sidebarToggle().should("be.visible").click();
}

private verifySidebarElements(
textVisibility: "be.visible" | "not.be.visible",
) {
this.sidebarItems()
.should("have.length.at.least", 1)
.each(($item) => {
cy.wrap($item, { timeout: 10000 })
.find('[data-testid="sidebar-icon"]')
.should("be.visible");
cy.wrap($item, { timeout: 10000 })
.find('[data-testid="sidebar-text"]')
.should(textVisibility);
});
}

verifyIconsAndTextVisible() {
this.sidebarItems().each(($item) => {
cy.wrap($item).find('[data-testid="sidebar-icon"]').should("be.visible");
cy.wrap($item).find('[data-testid="sidebar-text"]').should("be.visible");
});
this.verifySidebarElements("be.visible");
}

verifyIconsVisibleAndTextHidden() {
this.sidebarItems().each(($item) => {
cy.wrap($item).find('[data-testid="sidebar-icon"]').should("be.visible");
cy.wrap($item)
.find('[data-testid="sidebar-text"]')
.should("not.be.visible");
});
this.verifySidebarElements("not.be.visible");
}
}

Expand Down

0 comments on commit 3d06dba

Please sign in to comment.