Add cy.viewRoomById command (#11317)

... and use it to fix a racy composer test.

Fixes https://github.com/vector-im/element-web/issues/25527
This commit is contained in:
Richard van der Hoff
2023-07-25 22:55:13 +01:00
committed by GitHub
parent c57a4cb090
commit a47ee92094
2 changed files with 28 additions and 18 deletions

View File

@@ -29,6 +29,15 @@ declare global {
*/
viewRoomByName(name: string): Chainable<JQuery<HTMLElement>>;
/**
* Opens the given room by room ID.
*
* This works by browsing to `/#/room/${id}`, so it will also work for room aliases.
*
* @param id
*/
viewRoomById(id: string): void;
/**
* Returns the space panel space button based on a name. The space
* must be visible in the space panel
@@ -57,6 +66,10 @@ Cypress.Commands.add("viewRoomByName", (name: string): Chainable<JQuery<HTMLElem
return cy.findByRole("treeitem", { name: name }).should("have.class", "mx_RoomTile").click();
});
Cypress.Commands.add("viewRoomById", (id: string): void => {
cy.visit(`/#/room/${id}`);
});
Cypress.Commands.add("getSpacePanelButton", (name: string): Chainable<JQuery<HTMLElement>> => {
return cy.findByRole("button", { name: name }).should("have.class", "mx_SpaceButton");
});