diff --git a/playwright/e2e/crypto/dehydration.spec.ts b/playwright/e2e/crypto/dehydration.spec.ts index 39629c8262..52c8844ea4 100644 --- a/playwright/e2e/crypto/dehydration.spec.ts +++ b/playwright/e2e/crypto/dehydration.spec.ts @@ -39,7 +39,7 @@ const ROOM_NAME = "Test room"; const NAME = "Alice"; function getMemberTileByName(page: Page, name: string): Locator { - return page.locator(`.mx_EntityTile, [title="${name}"]`); + return page.locator(`.mx_MemberTileView, [title="${name}"]`); } test.describe("Dehydration", () => { @@ -93,7 +93,7 @@ test.describe("Dehydration", () => { await viewRoomSummaryByName(page, app, ROOM_NAME); await page.locator(".mx_RightPanel").getByRole("menuitem", { name: "People" }).click(); - await expect(page.locator(".mx_MemberList")).toBeVisible(); + await expect(page.locator(".mx_MemberListView")).toBeVisible(); await getMemberTileByName(page, NAME).click(); await page.locator(".mx_UserInfo_devices .mx_UserInfo_expand").click(); diff --git a/playwright/e2e/lazy-loading/lazy-loading.spec.ts b/playwright/e2e/lazy-loading/lazy-loading.spec.ts index d6a2edb3e5..8d5f32adf5 100644 --- a/playwright/e2e/lazy-loading/lazy-loading.spec.ts +++ b/playwright/e2e/lazy-loading/lazy-loading.spec.ts @@ -78,7 +78,7 @@ test.describe("Lazy Loading", () => { } function getMemberInMemberlist(page: Page, name: string): Locator { - return page.locator(".mx_MemberList .mx_EntityTile_name").filter({ hasText: name }); + return page.locator(".mx_MemberListView .mx_MemberTileView_name").filter({ hasText: name }); } async function checkMemberList(page: Page, charlies: Bot[]) { diff --git a/playwright/e2e/right-panel/memberlist.spec.ts b/playwright/e2e/right-panel/memberlist.spec.ts new file mode 100644 index 0000000000..9a22e2e25e --- /dev/null +++ b/playwright/e2e/right-panel/memberlist.spec.ts @@ -0,0 +1,43 @@ +/* +Copyright 2024 New Vector Ltd. + +SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only +Please see LICENSE files in the repository root for full details. +*/ + +import { test, expect } from "../../element-web-test"; +import { Bot } from "../../pages/bot"; + +const ROOM_NAME = "Test room"; +const NAME = "Alice"; + +test.describe("Memberlist", () => { + test.use({ + displayName: NAME, + startHomeserverOpts: "no-presence", + disablePresence: true, + }); + + test.beforeEach(async ({ app, user, page, homeserver }, testInfo) => { + testInfo.setTimeout(testInfo.timeout + 30_000); + const id = await app.client.createRoom({ name: ROOM_NAME }); + const newBots: Bot[] = []; + const names = ["Bob", "Bob", "Susan"]; + for (let i = 0; i < 3; i++) { + const displayName = names[i]; + const autoAcceptInvites = displayName !== "Susan"; + const bot = new Bot(page, homeserver, { displayName, startClient: true, autoAcceptInvites }); + await bot.prepareClient(); + await app.client.inviteUser(id, bot.credentials?.userId); + newBots.push(bot); + } + }); + + test("Renders correctly", { tag: "@screenshot" }, async ({ page, app }) => { + await app.viewRoomByName(ROOM_NAME); + const memberlist = await app.toggleMemberlistPanel(); + await expect(memberlist.locator(".mx_MemberTileView")).toHaveCount(4); + await expect(memberlist.getByText("(Invited)")).toHaveCount(1); + await expect(page.locator(".mx_MemberListView")).toMatchScreenshot("with-four-members.png"); + }); +}); diff --git a/playwright/e2e/right-panel/right-panel.spec.ts b/playwright/e2e/right-panel/right-panel.spec.ts index 1e9b8ebe1d..607b479ffc 100644 --- a/playwright/e2e/right-panel/right-panel.spec.ts +++ b/playwright/e2e/right-panel/right-panel.spec.ts @@ -24,7 +24,7 @@ const ROOM_ADDRESS_LONG = "loremIpsumDolorSitAmetConsecteturAdipisicingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliqua"; function getMemberTileByName(page: Page, name: string): Locator { - return page.locator(`.mx_EntityTile, [title="${name}"]`); + return page.locator(`.mx_MemberTileView, [title="${name}"]`); } test.describe("RightPanel", () => { @@ -107,14 +107,14 @@ test.describe("RightPanel", () => { await viewRoomSummaryByName(page, app, ROOM_NAME); await page.locator(".mx_RightPanel").getByRole("menuitem", { name: "People" }).click(); - await expect(page.locator(".mx_MemberList")).toBeVisible(); + await expect(page.locator(".mx_MemberListView")).toBeVisible(); await getMemberTileByName(page, NAME).click(); await expect(page.locator(".mx_UserInfo")).toBeVisible(); await expect(page.locator(".mx_UserInfo_profile").getByText(NAME)).toBeVisible(); await page.getByTestId("base-card-back-button").click(); - await expect(page.locator(".mx_MemberList")).toBeVisible(); + await expect(page.locator(".mx_MemberListView")).toBeVisible(); await page.getByLabel("Room info").nth(1).click(); await checkRoomSummaryCard(page, ROOM_NAME); @@ -130,14 +130,14 @@ test.describe("RightPanel", () => { .locator(".mx_RoomInfoLine_private") .getByRole("button", { name: /\d member/ }) .click(); - await expect(page.locator(".mx_MemberList")).toBeVisible(); + await expect(page.locator(".mx_MemberListView")).toBeVisible(); await getMemberTileByName(page, NAME).click(); await expect(page.locator(".mx_UserInfo")).toBeVisible(); await expect(page.locator(".mx_UserInfo_profile").getByText(NAME)).toBeVisible(); await page.getByTestId("base-card-back-button").click(); - await expect(page.locator(".mx_MemberList")).toBeVisible(); + await expect(page.locator(".mx_MemberListView")).toBeVisible(); }); }); }); diff --git a/playwright/pages/ElementAppPage.ts b/playwright/pages/ElementAppPage.ts index 494d9fc9aa..4d7dd001d0 100644 --- a/playwright/pages/ElementAppPage.ts +++ b/playwright/pages/ElementAppPage.ts @@ -177,6 +177,18 @@ export class ElementAppPage { return this.page.locator(".mx_RightPanel"); } + /** + * Opens/closes the memberlist panel + * @returns locator to the memberlist panel + */ + public async toggleMemberlistPanel(): Promise { + const locator = this.page.locator(".mx_FacePile"); + await locator.click(); + const memberlist = this.page.locator(".mx_MemberListView"); + await memberlist.waitFor(); + return memberlist; + } + /** * Get a locator for the tooltip associated with an element * @param e The element with the tooltip diff --git a/playwright/snapshots/right-panel/memberlist.spec.ts/with-four-members-linux.png b/playwright/snapshots/right-panel/memberlist.spec.ts/with-four-members-linux.png new file mode 100644 index 0000000000..f0e14ee55c Binary files /dev/null and b/playwright/snapshots/right-panel/memberlist.spec.ts/with-four-members-linux.png differ