1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-12-04 03:22:43 +03:00

Update Cypress test files under support/ directory - use Cypress Testing Library (#10619)

* Update support files - use Cypress Testing Library

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

* Fix openMessageComposerOptions()

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

---------

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
Suguru Hirahara
2023-04-17 07:37:49 +00:00
committed by GitHub
parent 56e4ae41f8
commit 4c0efc5e68
3 changed files with 10 additions and 10 deletions

View File

@@ -125,13 +125,13 @@ Cypress.Commands.add(
);
Cypress.Commands.add("openUserMenu", (): Chainable<JQuery<HTMLElement>> => {
cy.get('[aria-label="User menu"]').click();
cy.findByRole("button", { name: "User menu" }).click();
return cy.get(".mx_ContextualMenu");
});
Cypress.Commands.add("openUserSettings", (tab?: string): Chainable<JQuery<HTMLElement>> => {
cy.openUserMenu().within(() => {
cy.get('[aria-label="All settings"]').click();
cy.findByRole("menuitem", { name: "All settings" }).click();
});
return cy.get(".mx_UserSettingsDialog").within(() => {
if (tab) {
@@ -141,9 +141,9 @@ Cypress.Commands.add("openUserSettings", (tab?: string): Chainable<JQuery<HTMLEl
});
Cypress.Commands.add("openRoomSettings", (tab?: string): Chainable<JQuery<HTMLElement>> => {
cy.get(".mx_RoomHeader_name").click();
cy.findByRole("button", { name: "Room options" }).click();
cy.get(".mx_RoomTile_contextMenu").within(() => {
cy.get('[aria-label="Settings"]').click();
cy.findByRole("menuitem", { name: "Settings" }).click();
});
return cy.get(".mx_RoomSettingsDialog").within(() => {
if (tab) {
@@ -159,7 +159,7 @@ Cypress.Commands.add("switchTab", (tab: string): Chainable<JQuery<HTMLElement>>
});
Cypress.Commands.add("closeDialog", (): Chainable<JQuery<HTMLElement>> => {
return cy.get('[aria-label="Close dialog"]').click();
return cy.findByRole("button", { name: "Close dialog" }).click();
});
Cypress.Commands.add("joinBeta", (name: string): Chainable<JQuery<HTMLElement>> => {
@@ -167,7 +167,7 @@ Cypress.Commands.add("joinBeta", (name: string): Chainable<JQuery<HTMLElement>>
.contains(".mx_BetaCard_title", name)
.closest(".mx_BetaCard")
.within(() => {
return cy.get(".mx_BetaCard_buttons").contains("Join the beta").click();
return cy.get(".mx_BetaCard_buttons").findByRole("button", { name: "Join the beta" }).click();
});
});
@@ -176,7 +176,7 @@ Cypress.Commands.add("leaveBeta", (name: string): Chainable<JQuery<HTMLElement>>
.contains(".mx_BetaCard_title", name)
.closest(".mx_BetaCard")
.within(() => {
return cy.get(".mx_BetaCard_buttons").contains("Leave the beta").click();
return cy.get(".mx_BetaCard_buttons").findByRole("button", { name: "Leave the beta" }).click();
});
});