diff --git a/cypress/e2e/right-panel/right-panel.spec.ts b/cypress/e2e/right-panel/right-panel.spec.ts index 6ada7f41d4..ded88e231a 100644 --- a/cypress/e2e/right-panel/right-panel.spec.ts +++ b/cypress/e2e/right-panel/right-panel.spec.ts @@ -27,10 +27,6 @@ const getMemberTileByName = (name: string): Chainable> => { return cy.get(`.mx_EntityTile, [title="${name}"]`); }; -const goBack = (): Chainable> => { - return cy.get(".mx_BaseCard_back").click(); -}; - const viewRoomSummaryByName = (name: string): Chainable> => { cy.viewRoomByName(name); cy.get(".mx_RightPanel_roomSummaryButton").click(); @@ -65,57 +61,62 @@ describe("RightPanel", () => { it("should handle clicking add widgets", () => { viewRoomSummaryByName(ROOM_NAME); - cy.get(".mx_RoomSummaryCard_appsGroup .mx_AccessibleButton").click(); + cy.findByRole("button", { name: "Add widgets, bridges & bots" }).click(); cy.get(".mx_IntegrationManager").should("have.length", 1); }); it("should handle viewing export chat", () => { viewRoomSummaryByName(ROOM_NAME); - cy.get(".mx_RoomSummaryCard_icon_export").click(); + cy.findByRole("button", { name: "Export chat" }).click(); cy.get(".mx_ExportDialog").should("have.length", 1); }); it("should handle viewing share room", () => { viewRoomSummaryByName(ROOM_NAME); - cy.get(".mx_RoomSummaryCard_icon_share").click(); + cy.findByRole("button", { name: "Share room" }).click(); cy.get(".mx_ShareDialog").should("have.length", 1); }); it("should handle viewing room settings", () => { viewRoomSummaryByName(ROOM_NAME); - cy.get(".mx_RoomSummaryCard_icon_settings").click(); + cy.findByRole("button", { name: "Room settings" }).click(); cy.get(".mx_RoomSettingsDialog").should("have.length", 1); - cy.get(".mx_Dialog_title").should("contain", ROOM_NAME); + cy.get(".mx_Dialog_title").within(() => { + cy.findByText("Room Settings - " + ROOM_NAME).should("exist"); + }); }); it("should handle viewing files", () => { viewRoomSummaryByName(ROOM_NAME); - cy.get(".mx_RoomSummaryCard_icon_files").click(); + cy.findByRole("button", { name: "Files" }).click(); cy.get(".mx_FilePanel").should("have.length", 1); cy.get(".mx_FilePanel_empty").should("have.length", 1); - goBack(); + cy.findByRole("button", { name: "Room information" }).click(); checkRoomSummaryCard(ROOM_NAME); }); it("should handle viewing room member", () => { viewRoomSummaryByName(ROOM_NAME); - cy.get(".mx_RoomSummaryCard_icon_people").click(); + // \d represents the number of the room members inside mx_BaseCard_Button_sublabel + cy.findByRole("button", { name: /People \d/ }).click(); cy.get(".mx_MemberList").should("have.length", 1); getMemberTileByName(NAME).click(); cy.get(".mx_UserInfo").should("have.length", 1); - cy.get(".mx_UserInfo_profile").should("contain", NAME); + cy.get(".mx_UserInfo_profile").within(() => { + cy.findByText(NAME); + }); - goBack(); + cy.findByRole("button", { name: "Room members" }).click(); cy.get(".mx_MemberList").should("have.length", 1); - goBack(); + cy.findByRole("button", { name: "Room information" }).click(); checkRoomSummaryCard(ROOM_NAME); }); }); @@ -123,16 +124,26 @@ describe("RightPanel", () => { describe("in spaces", () => { it("should handle viewing space member", () => { cy.viewSpaceHomeByName(SPACE_NAME); - cy.get(".mx_RoomInfoLine_members").click(); + + cy.get(".mx_RoomInfoLine_private").within(() => { + // \d represents the number of the space members + cy.findByRole("button", { name: /\d member/ }).click(); + }); cy.get(".mx_MemberList").should("have.length", 1); - cy.get(".mx_RightPanel_scopeHeader").should("contain", SPACE_NAME); + cy.get(".mx_RightPanel_scopeHeader").within(() => { + cy.findByText(SPACE_NAME); + }); getMemberTileByName(NAME).click(); cy.get(".mx_UserInfo").should("have.length", 1); - cy.get(".mx_UserInfo_profile").should("contain", NAME); - cy.get(".mx_RightPanel_scopeHeader").should("contain", SPACE_NAME); + cy.get(".mx_UserInfo_profile").within(() => { + cy.findByText(NAME); + }); + cy.get(".mx_RightPanel_scopeHeader").within(() => { + cy.findByText(SPACE_NAME); + }); - goBack(); + cy.findByRole("button", { name: "Back" }).click(); cy.get(".mx_MemberList").should("have.length", 1); }); });