Update one-to-one-chat.spec.ts - use Cypress Testing Library (#10572)

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
Suguru Hirahara 2023-04-12 13:11:28 +00:00 committed by GitHub
parent c9599a3ef2
commit d179956af8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,17 +45,23 @@ describe("1:1 chat room", () => {
it("should open new 1:1 chat room after leaving the old one", () => {
// leave 1:1 chat room
cy.contains(".mx_RoomHeader_nametext", username).click();
cy.contains('[role="menuitem"]', "Leave").click();
cy.get('[data-testid="dialog-primary-button"]').click();
cy.get(".mx_RoomHeader_nametext").within(() => {
cy.findByText(username).click();
});
cy.findByRole("menuitem", { name: "Leave" }).click();
cy.findByRole("button", { name: "Leave" }).click();
// wait till the room was left
cy.get('[role="group"][aria-label="Historical"]').within(() => {
cy.contains(".mx_RoomTile", username);
cy.findByRole("group", { name: "Historical" }).within(() => {
cy.get(".mx_RoomTile").within(() => {
cy.findByText(username);
});
});
// open new 1:1 chat room
cy.visit(`/#/user/${user2.userId}?action=chat`);
cy.contains(".mx_RoomHeader_nametext", username);
cy.get(".mx_RoomHeader_nametext").within(() => {
cy.findByText(username);
});
});
});