Skip to content

Commit

Permalink
Verify exact text for icons fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alokih committed Nov 27, 2024
1 parent 19a6609 commit bbe15ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cypress/pageobject/Facility/FacilityHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,20 @@ class FacilityHome {
this.sidebarItems()
.should("have.length.at.least", 1)
.each(($item) => {
const expectedText = $item.attr("data-text");

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);
.should(textVisibility)
.then(($text) => {
if (textVisibility === "be.visible") {
const actualText = $text.text().trim();
expect(actualText).to.eq(expectedText);
}
});
});
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Common/Sidebar/SidebarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const SidebarItemBase = forwardRef<HTMLAnchorElement, SidebarItemBaseProps>(
ref={ref}
id={props?.id}
data-testid="sidebar-item"
data-text={props.text}
className={`tooltip relative ml-1 mr-2 h-12 flex-1 cursor-pointer rounded-md py-1 font-medium text-gray-600 transition md:flex-none ${
props.selected
? "bg-white text-green-800 shadow"
Expand Down

0 comments on commit bbe15ed

Please sign in to comment.