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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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");
});