From a81940b62a39c815fdf58db4bf1008938075040e Mon Sep 17 00:00:00 2001 From: Suguru Hirahara Date: Mon, 1 May 2023 20:13:24 +0000 Subject: [PATCH] Update existing Cypress tests - use Cypress Testing Library (#10755) Signed-off-by: Suguru Hirahara --- cypress/e2e/crypto/crypto.spec.ts | 2 +- cypress/e2e/crypto/decryption-failure.spec.ts | 4 ++-- cypress/e2e/right-panel/right-panel.spec.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/crypto/crypto.spec.ts b/cypress/e2e/crypto/crypto.spec.ts index a415db48bc..27c9531d44 100644 --- a/cypress/e2e/crypto/crypto.spec.ts +++ b/cypress/e2e/crypto/crypto.spec.ts @@ -27,7 +27,7 @@ interface CryptoTestContext extends Mocha.Context { } const openRoomInfo = () => { - cy.get(".mx_RightPanel_roomSummaryButton").click(); + cy.findByRole("button", { name: "Room info" }).click(); return cy.get(".mx_RightPanel"); }; diff --git a/cypress/e2e/crypto/decryption-failure.spec.ts b/cypress/e2e/crypto/decryption-failure.spec.ts index fa30c2f2a2..a9ace36c22 100644 --- a/cypress/e2e/crypto/decryption-failure.spec.ts +++ b/cypress/e2e/crypto/decryption-failure.spec.ts @@ -60,7 +60,7 @@ const handleVerificationRequest = (request: VerificationRequest): Chainable { cy.viewport(800, 600); // SVGA cy.get(".mx_LeftPanel_minimized").should("exist"); // Wait until the left panel is minimized - cy.get(".mx_RightPanel_roomSummaryButton").click(); // Open the right panel to make the timeline narrow + cy.findByRole("button", { name: "Room info" }).click(); // Open the right panel to make the timeline narrow cy.get(".mx_BaseCard").should("exist"); // Ensure the failure bar does not cover the timeline @@ -74,7 +74,7 @@ const checkTimelineNarrow = (button = true) => { cy.get("[data-testid='decryption-failure-bar-button']:last-of-type").should("be.visible"); } - cy.get(".mx_RightPanel_roomSummaryButton").click(); // Close the right panel + cy.findByRole("button", { name: "Room info" }).click(); // Close the right panel cy.get(".mx_BaseCard").should("not.exist"); cy.viewport(1000, 660); // Reset to the default size }; diff --git a/cypress/e2e/right-panel/right-panel.spec.ts b/cypress/e2e/right-panel/right-panel.spec.ts index ded88e231a..733eb3c78f 100644 --- a/cypress/e2e/right-panel/right-panel.spec.ts +++ b/cypress/e2e/right-panel/right-panel.spec.ts @@ -29,7 +29,7 @@ const getMemberTileByName = (name: string): Chainable> => { const viewRoomSummaryByName = (name: string): Chainable> => { cy.viewRoomByName(name); - cy.get(".mx_RightPanel_roomSummaryButton").click(); + cy.findByRole("button", { name: "Room info" }).click(); return checkRoomSummaryCard(name); };