Skip to content

Implement new memberlist design with MVVM architecture #28874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
656d3e8
Add new e2e icon for the member tile
MidhunSureshR Jan 5, 2025
45c1bd1
Add new presence icon for member tile
MidhunSureshR Jan 5, 2025
7768795
Implement new member tile
MidhunSureshR Jan 5, 2025
4f50174
Implement memberlist view model
MidhunSureshR Jan 5, 2025
6eb51b3
Implement new memberlist header view
MidhunSureshR Jan 5, 2025
697d15a
Support the new memberlist in Diasambiguated profile
MidhunSureshR Jan 5, 2025
9eca64c
Implement new memberlist view
MidhunSureshR Jan 5, 2025
3561aec
Add and use a new overflow component
MidhunSureshR Jan 5, 2025
c27e2fb
Remove old code
MidhunSureshR Jan 5, 2025
cf0726d
Add/remove css files from _components.pcss
MidhunSureshR Jan 5, 2025
ceb8643
Increase minimum width as per design
MidhunSureshR Jan 5, 2025
e6e0360
Actually use the new memberlist view
MidhunSureshR Jan 5, 2025
41e20e5
Fix broken jest tests
MidhunSureshR Jan 5, 2025
a57d0b7
Add jest tests
MidhunSureshR Jan 5, 2025
2c4d3d5
Playwright: Make it possible to disable presence
MidhunSureshR Jan 5, 2025
0b28e20
Add playwright tests
MidhunSureshR Jan 5, 2025
ad96434
Fix lint error
MidhunSureshR Jan 5, 2025
ec78793
Undo translation changes that must be done via localazy
MidhunSureshR Jan 6, 2025
64ef538
Merge branch 'develop' into midhun/memberlist-redesign
MidhunSureshR Jan 6, 2025
9ac4da3
Update license header
MidhunSureshR Jan 6, 2025
0147e04
Use waitFor instead of setTimeout
MidhunSureshR Jan 6, 2025
80baac2
Remove comment
MidhunSureshR Jan 6, 2025
04413ed
Merge branch 'develop' into midhun/memberlist-redesign
MidhunSureshR Jan 8, 2025
9d35514
Switch over from template to container hs
MidhunSureshR Jan 8, 2025
37a6d09
Revert unintended change
MidhunSureshR Jan 8, 2025
2bf96cc
Move config to top level
MidhunSureshR Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add playwright tests
  • Loading branch information
MidhunSureshR committed Jan 5, 2025

Verified

This commit was signed with the committer’s verified signature.
MidhunSureshR R Midhun Suresh
commit 0b28e202305a90e25300c6ea3cc2877dd6d082d8
4 changes: 2 additions & 2 deletions playwright/e2e/crypto/dehydration.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
2 changes: 1 addition & 1 deletion playwright/e2e/lazy-loading/lazy-loading.spec.ts
Original file line number Diff line number Diff line change
@@ -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[]) {
43 changes: 43 additions & 0 deletions playwright/e2e/right-panel/memberlist.spec.ts
Original file line number Diff line number Diff line change
@@ -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");

Check failure on line 41 in playwright/e2e/right-panel/memberlist.spec.ts

GitHub Actions / Run Tests [Chrome] 4/6

[Chrome] › right-panel/memberlist.spec.ts:36:9 › Memberlist › Renders correctly @screenshot

1) [Chrome] › right-panel/memberlist.spec.ts:36:9 › Memberlist › Renders correctly @screenshot ─── Error: expect(locator).toHaveScreenshot(expected) 174 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/element-web/element-web/playwright/snapshots/right-panel/memberlist.spec.ts/with-four-members-linux.png Received: /home/runner/work/element-web/element-web/playwright/test-results/right-panel-memberlist-Memberlist-Renders-correctly-Chrome/with-four-members-actual.png Diff: /home/runner/work/element-web/element-web/playwright/test-results/right-panel-memberlist-Memberlist-Renders-correctly-Chrome/with-four-members-diff.png Call log: - expect.toHaveScreenshot(with-four-members.png) with timeout 5000ms - verifying given screenshot expectation - waiting for locator('.mx_MemberListView') - locator resolved to <div role="tabpanel" id="memberlist-panel" class="mx_BaseCard mx_MemberListView" aria-labelledby="memberlist-panel-tab">…</div> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - 174 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - waiting for locator('.mx_MemberListView') - locator resolved to <div role="tabpanel" id="memberlist-panel" class="mx_BaseCard mx_MemberListView" aria-labelledby="memberlist-panel-tab">…</div> - taking element screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - attempting scroll into view action - waiting for element to be stable - captured a stable screenshot - 174 pixels (ratio 0.01 of all image pixels) are different. 39 | await expect(memberlist.locator(".mx_MemberTileView")).toHaveCount(4); 40 | await expect(memberlist.getByText("(Invited)")).toHaveCount(1); > 41 | await expect(page.locator(".mx_MemberListView")).toMatchScreenshot("with-four-members.png"); | ^ 42 | }); 43 | }); 44 | at /home/runner/work/element-web/element-web/playwright/e2e/right-panel/memberlist.spec.ts:41:58
});
});
10 changes: 5 additions & 5 deletions playwright/e2e/right-panel/right-panel.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});
});
12 changes: 12 additions & 0 deletions playwright/pages/ElementAppPage.ts
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@
.getByRole("tree", { name: "Rooms" })
.locator(`[title="${name}"],[aria-label="${name}"]`)
.first()
.click();

Check failure on line 96 in playwright/pages/ElementAppPage.ts

GitHub Actions / Run Tests [Chrome] 4/6

[Chrome] › settings/appearance-user-settings-tab/message-layout-panel.spec.ts:23:13 › Appearance user settings tab › Message Layout Panel › should change the message layout from modern to bubble @screenshot

2) [Chrome] › settings/appearance-user-settings-tab/message-layout-panel.spec.ts:23:13 › Appearance user settings tab › Message Layout Panel › should change the message layout from modern to bubble @screenshot Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByRole('tree', { name: 'Rooms' }).locator('[title="Test Room"],[aria-label="Test Room"]').first() at ../pages/ElementAppPage.ts:96 94 | .locator(`[title="${name}"],[aria-label="${name}"]`) 95 | .first() > 96 | .click(); | ^ 97 | } 98 | 99 | public async viewRoomById(roomId: string): Promise<void> { at ElementAppPage.viewRoomByName (/home/runner/work/element-web/element-web/playwright/pages/ElementAppPage.ts:96:14) at Helpers.createAndDisplayRoom (/home/runner/work/element-web/element-web/playwright/e2e/settings/appearance-user-settings-tab/index.ts:155:24) at /home/runner/work/element-web/element-web/playwright/e2e/settings/appearance-user-settings-tab/message-layout-panel.spec.ts:18:13

Check failure on line 96 in playwright/pages/ElementAppPage.ts

GitHub Actions / Run Tests [Chrome] 4/6

[Chrome] › settings/appearance-user-settings-tab/message-layout-panel.spec.ts:49:13 › Appearance user settings tab › Message Layout Panel › should disable compact layout when the modern layout is not selected

3) [Chrome] › settings/appearance-user-settings-tab/message-layout-panel.spec.ts:49:13 › Appearance user settings tab › Message Layout Panel › should disable compact layout when the modern layout is not selected Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for getByRole('tree', { name: 'Rooms' }).locator('[title="Test Room"],[aria-label="Test Room"]').first() at ../pages/ElementAppPage.ts:96 94 | .locator(`[title="${name}"],[aria-label="${name}"]`) 95 | .first() > 96 | .click(); | ^ 97 | } 98 | 99 | public async viewRoomById(roomId: string): Promise<void> { at ElementAppPage.viewRoomByName (/home/runner/work/element-web/element-web/playwright/pages/ElementAppPage.ts:96:14) at Helpers.createAndDisplayRoom (/home/runner/work/element-web/element-web/playwright/e2e/settings/appearance-user-settings-tab/index.ts:155:24) at /home/runner/work/element-web/element-web/playwright/e2e/settings/appearance-user-settings-tab/message-layout-panel.spec.ts:18:13
}

public async viewRoomById(roomId: string): Promise<void> {
@@ -177,6 +177,18 @@
return this.page.locator(".mx_RightPanel");
}

/**
* Opens/closes the memberlist panel
* @returns locator to the memberlist panel
*/
public async toggleMemberlistPanel(): Promise<Locator> {
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading