Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d179956

Browse files
authored
Update one-to-one-chat.spec.ts - use Cypress Testing Library (#10572)
Signed-off-by: Suguru Hirahara <[email protected]>
1 parent c9599a3 commit d179956

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

cypress/e2e/one-to-one-chat/one-to-one-chat.spec.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,23 @@ describe("1:1 chat room", () => {
4545

4646
it("should open new 1:1 chat room after leaving the old one", () => {
4747
// leave 1:1 chat room
48-
cy.contains(".mx_RoomHeader_nametext", username).click();
49-
cy.contains('[role="menuitem"]', "Leave").click();
50-
cy.get('[data-testid="dialog-primary-button"]').click();
48+
cy.get(".mx_RoomHeader_nametext").within(() => {
49+
cy.findByText(username).click();
50+
});
51+
cy.findByRole("menuitem", { name: "Leave" }).click();
52+
cy.findByRole("button", { name: "Leave" }).click();
5153

5254
// wait till the room was left
53-
cy.get('[role="group"][aria-label="Historical"]').within(() => {
54-
cy.contains(".mx_RoomTile", username);
55+
cy.findByRole("group", { name: "Historical" }).within(() => {
56+
cy.get(".mx_RoomTile").within(() => {
57+
cy.findByText(username);
58+
});
5559
});
5660

5761
// open new 1:1 chat room
5862
cy.visit(`/#/user/${user2.userId}?action=chat`);
59-
cy.contains(".mx_RoomHeader_nametext", username);
63+
cy.get(".mx_RoomHeader_nametext").within(() => {
64+
cy.findByText(username);
65+
});
6066
});
6167
});

0 commit comments

Comments
 (0)