From 812564940d39c6fa89a246633aa787b8cdf5b06f Mon Sep 17 00:00:00 2001 From: Suguru Hirahara Date: Mon, 17 Apr 2023 08:24:09 +0000 Subject: [PATCH] Update `location.spec.ts` - use Cypress Testing Library (#10612) * Update location.spec.ts - use Cypress Testing Library Signed-off-by: Suguru Hirahara * Make the test id of location share option discoverable with findByTestId() findByTestId seeks for data-testid, instead of data-test-id. Signed-off-by: Suguru Hirahara --------- Signed-off-by: Suguru Hirahara --- cypress/e2e/location/location.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/location/location.spec.ts b/cypress/e2e/location/location.spec.ts index 65ddd767ba1..6588cde1a49 100644 --- a/cypress/e2e/location/location.spec.ts +++ b/cypress/e2e/location/location.spec.ts @@ -23,11 +23,11 @@ describe("Location sharing", () => { let homeserver: HomeserverInstance; const selectLocationShareTypeOption = (shareType: string): Chainable => { - return cy.get(`[data-testid="share-location-option-${shareType}"]`); + return cy.findByTestId(`share-location-option-${shareType}`); }; const submitShareLocation = (): void => { - cy.get('[data-testid="location-picker-submit-button"]').click(); + cy.findByRole("button", { name: "Share location" }).click(); }; beforeEach(() => { @@ -53,7 +53,7 @@ describe("Location sharing", () => { }); cy.openMessageComposerOptions().within(() => { - cy.get('[aria-label="Location"]').click(); + cy.findByRole("menuitem", { name: "Location" }).click(); }); selectLocationShareTypeOption("Pin").click(); @@ -67,7 +67,7 @@ describe("Location sharing", () => { // clicking location tile opens maximised map cy.get(".mx_LocationViewDialog_wrapper").should("exist"); - cy.get('[aria-label="Close dialog"]').click(); + cy.closeDialog(); cy.get(".mx_Marker").should("exist"); });