fix: use data-cy selector for sidebar backdrop in e2e tests
The aria-hidden="true" selector matched 27 elements (icons, etc.) causing cy.click() to fail. Add data-cy="sidebar-backdrop" to the overlay div and target that specifically in tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,7 +102,7 @@ describe("/dashboard - mobile sidebar", () => {
|
||||
|
||||
cy.get("[data-sidebar]").should("have.attr", "data-sidebar", "open");
|
||||
cy.get("aside").should("be.visible");
|
||||
cy.get('[aria-hidden="true"]').should("exist");
|
||||
cy.get('[data-cy="sidebar-backdrop"]').should("exist");
|
||||
});
|
||||
|
||||
it("mobile: click backdrop closes sidebar", () => {
|
||||
@@ -114,7 +114,7 @@ describe("/dashboard - mobile sidebar", () => {
|
||||
cy.get("[data-sidebar]").should("have.attr", "data-sidebar", "open");
|
||||
|
||||
// Click the backdrop overlay
|
||||
cy.get('[aria-hidden="true"]').click({ force: true });
|
||||
cy.get('[data-cy="sidebar-backdrop"]').click({ force: true });
|
||||
|
||||
cy.get("[data-sidebar]").should("have.attr", "data-sidebar", "closed");
|
||||
cy.get("aside").should("not.be.visible");
|
||||
|
||||
@@ -136,6 +136,7 @@ export function DashboardShell({ children }: { children: ReactNode }) {
|
||||
className="fixed inset-0 z-40 bg-black/30 md:hidden"
|
||||
onClick={toggleSidebar}
|
||||
aria-hidden="true"
|
||||
data-cy="sidebar-backdrop"
|
||||
/>
|
||||
) : null}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user