Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Update location.spec.ts - use Cypress Testing Library (#10612)
Browse files Browse the repository at this point in the history
* Update location.spec.ts - use Cypress Testing Library

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* 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 <luixxiul@users.noreply.github.com>

---------

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
  • Loading branch information
luixxiul committed Apr 17, 2023
1 parent 1d9df7e commit 8125649
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cypress/e2e/location/location.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe("Location sharing", () => {
let homeserver: HomeserverInstance;

const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => {
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(() => {
Expand All @@ -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();
Expand All @@ -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");
});
Expand Down

0 comments on commit 8125649

Please sign in to comment.