From d0793a4865222be5fbb721cb7aaaa0fd660ae8e7 Mon Sep 17 00:00:00 2001 From: Segun Adebayo Date: Tue, 12 Apr 2022 15:18:00 +0400 Subject: [PATCH] test: improve accessibilty assertion by using find-by-part --- cypress/integration/accordion.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/integration/accordion.test.ts b/cypress/integration/accordion.test.ts index 97766ee162..059a5b1dde 100644 --- a/cypress/integration/accordion.test.ts +++ b/cypress/integration/accordion.test.ts @@ -16,7 +16,7 @@ describe("accordion", () => { describe("given a single accordion", () => { it("should have no accessibility violation", () => { - cy.checkA11y("[data-part=root]") + cy.findByPart("root").then(cy.checkA11y) }) describe("when navigating by keyboard", () => { @@ -54,7 +54,7 @@ describe("accordion", () => { }) it("should have no accessibility violations", () => { - cy.checkA11y(".accordion") + cy.findByPart("root").then(cy.checkA11y) }) it("then clicking the same trigger again: should not close the content", () => { @@ -80,7 +80,7 @@ describe("accordion", () => { }) it("should have no accessibility violations", () => { - cy.checkA11y(".accordion") + cy.findByPart("root").then(cy.checkA11y) }) describe("when navigating by keyboard", () => { @@ -119,7 +119,7 @@ describe("accordion", () => { }) it("should have no accessibility violations", () => { - cy.checkA11y(".accordion") + cy.findByPart("root").then(cy.checkA11y) }) it("then clicking the same trigger again: should hide the content", () => {