Skip to content

Commit 0cf8869

Browse files
committed
fix(cypress): update pr_4435 test selector after BEM to Tailwind migration
The sidebar refactor removed the BEM class. Add to the NavLink in SidebarItem.jsx and update the Cypress test to use the new attribute selector.
1 parent 5a11143 commit 0cf8869

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

cypress/e2e/pr_4435.cy.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ describe("Open page in new tab", { scrollBehavior: false }, () => {
1010
},
1111
});
1212
// wait for page content to load before asserting scroll
13-
cy.get('.sidebar-item__title[href="/concepts/plugins/"]').should("exist");
13+
cy.get(
14+
'[data-testid="sidebar-item-title"][href="/concepts/plugins/"]',
15+
).should("exist");
1416
// there's one call in Page.jsx when componentDidMount
1517
cy.window().should((win) => {
1618
expect(win.scrollTo).to.be.calledOnce;
1719
});
1820

19-
const selector = '.sidebar-item__title[href="/concepts/plugins/"]';
21+
const selector =
22+
'[data-testid="sidebar-item-title"][href="/concepts/plugins/"]';
2023

2124
// we click the menu
2225
cy.get(selector).click();

src/components/SidebarItem/SidebarItem.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default function SidebarItem({ title, anchors = [], url, currentPage }) {
114114
<NavLink
115115
end
116116
key={url}
117+
data-testid="sidebar-item-title"
117118
className={({ isActive }) =>
118119
`flex-1 max-w-[85%] overflow-hidden whitespace-nowrap text-ellipsis ${isActive ? "font-semibold text-[#333] dark:text-white" : "text-[#2b3a42] dark:text-[#b8b8b8]"}`
119120
}

0 commit comments

Comments
 (0)