Skip to content

Commit

Permalink
fix(cypress): fix issue with cypress and vercel previews
Browse files Browse the repository at this point in the history
  • Loading branch information
krisantrobus committed Sep 25, 2024
1 parent de04437 commit e028822
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cypress/integration/sidebar-navigation/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ describe("Sidebar navigation", () => {
const contentSelector = `${BASE}-content-${disclosureName}`;

it(`should open the the "${disclosureName}" sidebar disclosure`, () => {
cy.get(`[data-cy="${buttonSelector}"]`).click().should("have.attr", "aria-expanded", "true");
// creates an alias for the content
cy.get(`[data-cy="${contentSelector}"]`).as("currentContent");
cy.get("@currentContent").should("have.css", "display", "none");
cy.get("@currentContent").should("have.attr", "hidden", "hidden");

cy.get("@currentContent").scrollIntoView().should("be.visible");
cy.get(`[data-cy="${buttonSelector}"]`).click().should("have.attr", "aria-expanded", "true");
cy.get("@currentContent").scrollIntoView().should("have.css", "display", "block");
});
});

Expand Down

0 comments on commit e028822

Please sign in to comment.