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>pull/28217/head
parent
56e4ae41f8
commit
4c0efc5e68
|
@ -39,7 +39,7 @@ Cypress.Commands.add("getComposer", (isRightPanel?: boolean): Chainable<JQuery>
|
|||
|
||||
Cypress.Commands.add("openMessageComposerOptions", (isRightPanel?: boolean): Chainable<JQuery> => {
|
||||
cy.getComposer(isRightPanel).within(() => {
|
||||
cy.get('[aria-label="More options"]').click();
|
||||
cy.findByRole("button", { name: "More options" }).click();
|
||||
});
|
||||
return cy.get(".mx_MessageComposer_Menu");
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ declare global {
|
|||
}
|
||||
|
||||
Cypress.Commands.add("viewRoomByName", (name: string): Chainable<JQuery<HTMLElement>> => {
|
||||
return cy.get(`.mx_RoomTile[aria-label="${name}"]`).click();
|
||||
return cy.findByRole("treeitem", { name: name }).should("have.class", "mx_RoomTile").click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("getSpacePanelButton", (name: string): Chainable<JQuery<HTMLElement>> => {
|
||||
return cy.get(`.mx_SpaceButton[aria-label="${name}"]`);
|
||||
return cy.findByRole("button", { name: name }).should("have.class", "mx_SpaceButton");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("viewSpaceByName", (name: string): Chainable<JQuery<HTMLElement>> => {
|
||||
|
|
Loading…
Reference in New Issue