Skip to content
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

New memberlist #28605

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7ba6353
WIP
MidhunSureshR Dec 1, 2024
4d4e7f3
Support 3pid invites
MidhunSureshR Dec 11, 2024
13df65b
More WIP
MidhunSureshR Dec 12, 2024
9d93c86
More work
MidhunSureshR Dec 14, 2024
be20d65
More tests
MidhunSureshR Dec 14, 2024
b4bab49
More tests
MidhunSureshR Dec 16, 2024
83265ff
Merge branch 'develop' into midhun/new-memberlist
MidhunSureshR Dec 16, 2024
e78f6ba
Fix broken jest tests
MidhunSureshR Dec 16, 2024
87e608e
Fix vertical scrolling issue
MidhunSureshR Dec 17, 2024
c220848
Make avatars look crisp!
MidhunSureshR Dec 17, 2024
b5c8051
Fix new invite not showing in memberlist
MidhunSureshR Dec 17, 2024
4478b0a
Refactor tests
MidhunSureshR Dec 22, 2024
5378b04
Fix CI
MidhunSureshR Dec 22, 2024
192e3bc
Fix jest
MidhunSureshR Dec 22, 2024
4444d39
Fix playwright tests
MidhunSureshR Dec 22, 2024
e5f12c4
Fix css prettier
MidhunSureshR Dec 22, 2024
cca636a
Merge branch 'develop' into midhun/new-memberlist
MidhunSureshR Dec 22, 2024
1b359ae
Add more tests
MidhunSureshR Dec 22, 2024
ca4c0d5
Fix label
MidhunSureshR Dec 22, 2024
8774bf2
Fix issues from testing
MidhunSureshR Dec 25, 2024
2f35119
Merge branch 'develop' into midhun/new-memberlist
MidhunSureshR Dec 25, 2024
677f069
Fix broken jest test
MidhunSureshR Dec 28, 2024
207551b
Code review changes
MidhunSureshR Dec 31, 2024
c423942
Move code into directory
MidhunSureshR Dec 31, 2024
661644f
Remove old files
MidhunSureshR Dec 31, 2024
038add5
Remove files
MidhunSureshR Dec 31, 2024
18380c0
Add playwright test
MidhunSureshR Jan 1, 2025
c40b823
Lint
MidhunSureshR Jan 1, 2025
f52d7a8
Merge branch 'develop' into midhun/new-memberlist
MidhunSureshR Jan 5, 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
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@matrix-org/spec": "^1.7.0",
"@sentry/browser": "^8.0.0",
"@types/png-chunks-extract": "^1.0.2",
"@vector-im/compound-design-tokens": "^2.0.1",
"@vector-im/compound-design-tokens": "^2.1.0",
"@vector-im/compound-web": "^7.5.0",
"@vector-im/matrix-wysiwyg": "2.38.0",
"@zxcvbn-ts/core": "^3.0.4",
Expand Down Expand Up @@ -149,7 +149,9 @@
"temporal-polyfill": "^0.2.5",
"ua-parser-js": "^1.0.2",
"uuid": "^11.0.0",
"what-input": "^5.2.10"
"what-input": "^5.2.10",
"@types/react-virtualized": "^9.21.30",
"react-virtualized": "^9.22.5"
},
"devDependencies": {
"@action-validator/cli": "^0.6.0",
Expand Down
4 changes: 2 additions & 2 deletions playwright/e2e/crypto/dehydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/lazy-loading/lazy-loading.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) {
Expand Down
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

View workflow job for this annotation

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
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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);
Expand All @@ -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();
});
});
});
9 changes: 8 additions & 1 deletion playwright/element-web-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface Fixtures {
bot: Bot;
labsFlags: string[];
webserver: Webserver;
disablePresence: boolean;
}

export const test = base.extend<Fixtures>({
Expand All @@ -133,8 +134,9 @@ export const test = base.extend<Fixtures>({
);
await use(context);
},
disablePresence: false,
config: CONFIG_JSON,
page: async ({ context, page, config, labsFlags }, use) => {
page: async ({ context, page, config, labsFlags, disablePresence, homeserver }, use) => {
await context.route(`http://localhost:8080/config.json*`, async (route) => {
const json = { ...CONFIG_JSON, ...config };
json["features"] = {
Expand All @@ -145,6 +147,11 @@ export const test = base.extend<Fixtures>({
return obj;
}, {}),
};
if (disablePresence) {
json["enable_presence_by_hs_url"] = {
[homeserver.config.baseUrl]: false,
};
}
await route.fulfill({ json });
});
await use(page);
Expand Down
12 changes: 12 additions & 0 deletions playwright/pages/ElementAppPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / Run Tests [Chrome] 6/6

[Chrome] › widgets/layout.spec.ts:77:9 › Widget Layout › manually resize the height of the top container layout

1) [Chrome] › widgets/layout.spec.ts:77:9 › Widget Layout › manually resize the height of the top container layout 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 /home/runner/work/element-web/element-web/playwright/e2e/widgets/layout.spec.ts:70:19

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

View workflow job for this annotation

GitHub Actions / Run Tests [Chrome] 5/6

[Chrome] › settings/general-room-settings-tab.spec.ts:23:9 › General room settings tab › should be rendered properly @screenshot

1) [Chrome] › settings/general-room-settings-tab.spec.ts:23:9 › General room settings tab › should be rendered properly @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 /home/runner/work/element-web/element-web/playwright/e2e/settings/general-room-settings-tab.spec.ts:20:19

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

View workflow job for this annotation

GitHub Actions / Run Tests [Chrome] 5/6

[Chrome] › settings/general-room-settings-tab.spec.ts:23:9 › General room settings tab › should be rendered properly @screenshot

1) [Chrome] › settings/general-room-settings-tab.spec.ts:23:9 › General room settings tab › should be rendered properly @screenshot Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── 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 /home/runner/work/element-web/element-web/playwright/e2e/settings/general-room-settings-tab.spec.ts:20:19
}

public async viewRoomById(roomId: string): Promise<void> {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A synapse configured with presence disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
server_name: "localhost"
pid_file: /data/homeserver.pid
public_baseurl: "{{PUBLIC_BASEURL}}"
listeners:
- port: 8008
tls: false
bind_addresses: ["::"]
type: http
x_forwarded: true

resources:
- names: [client]
compress: false

database:
name: "sqlite3"
args:
database: ":memory:"

log_config: "/data/log.config"

rc_messages_per_second: 10000
rc_message_burst_count: 10000
rc_registration:
per_second: 10000
burst_count: 10000
rc_joins:
local:
per_second: 9999
burst_count: 9999
remote:
per_second: 9999
burst_count: 9999
rc_joins_per_room:
per_second: 9999
burst_count: 9999
rc_3pid_validation:
per_second: 1000
burst_count: 1000

rc_invites:
per_room:
per_second: 1000
burst_count: 1000
per_user:
per_second: 1000
burst_count: 1000

rc_login:
address:
per_second: 10000
burst_count: 10000
account:
per_second: 10000
burst_count: 10000
failed_attempts:
per_second: 10000
burst_count: 10000

media_store_path: "/data/media_store"
uploads_path: "/data/uploads"
enable_registration: true
enable_registration_without_verification: true
disable_msisdn_registration: false
registration_shared_secret: "{{REGISTRATION_SECRET}}"
report_stats: false
macaroon_secret_key: "{{MACAROON_SECRET_KEY}}"
form_secret: "{{FORM_SECRET}}"
signing_key_path: "/data/localhost.signing.key"

trusted_key_servers:
- server_name: "matrix.org"
suppress_key_server_warning: true

ui_auth:
session_timeout: "300s"

oidc_providers:
- idp_id: test
idp_name: "OAuth test"
issuer: "http://localhost:{{OAUTH_SERVER_PORT}}/oauth"
authorization_endpoint: "http://localhost:{{OAUTH_SERVER_PORT}}/oauth/auth.html"
# the token endpoint receives requests from synapse, rather than the webapp, so needs to escape the docker container.
token_endpoint: "http://host.containers.internal:{{OAUTH_SERVER_PORT}}/oauth/token"
userinfo_endpoint: "http://host.containers.internal:{{OAUTH_SERVER_PORT}}/oauth/userinfo"
client_id: "synapse"
discover: false
scopes: ["profile"]
skip_verification: true
client_auth_method: none
user_mapping_provider:
config:
display_name_template: "{{ user.name }}"

# Inhibit background updates as this Synapse isn't long-lived
background_updates:
min_batch_size: 100000
sleep_duration_ms: 100000

experimental_features:
# Needed for e2e/crypto/crypto.spec.ts > Cryptography > decryption failure
# messages > non-joined historical messages.
# Can be removed after Synapse enables it by default
msc4115_membership_on_events: true

enable_authenticated_media: true

presence:
enabled: false
include_offline_users_on_sync: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Log configuration for Synapse.
#
# This is a YAML file containing a standard Python logging configuration
# dictionary. See [1] for details on the valid settings.
#
# Synapse also supports structured logging for machine readable logs which can
# be ingested by ELK stacks. See [2] for details.
#
# [1]: https://docs.python.org/3.7/library/logging.config.html#configuration-dictionary-schema
# [2]: https://matrix-org.github.io/synapse/latest/structured_logging.html

version: 1

formatters:
precise:
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'

handlers:
# A handler that writes logs to stderr. Unused by default, but can be used
# instead of "buffer" and "file" in the logger handlers.
console:
class: logging.StreamHandler
formatter: precise

loggers:
synapse.storage.SQL:
# beware: increasing this to DEBUG will make synapse log sensitive
# information such as access tokens.
level: DEBUG

twisted:
# We send the twisted logging directly to the file handler,
# to work around https://github.com/matrix-org/synapse/issues/3471
# when using "buffer" logger. Use "console" to log to stderr instead.
handlers: [console]
propagate: false

root:
level: DEBUG

# Write logs to the `buffer` handler, which will buffer them together in memory,
# then write them to a file.
#
# Replace "buffer" with "console" to log to stderr instead. (Note that you'll
# also need to update the configuration for the `twisted` logger above, in
# this case.)
#
handlers: [console]

disable_existing_loggers: false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@
@import "./views/rooms/_E2EIcon.pcss";
@import "./views/rooms/_EditMessageComposer.pcss";
@import "./views/rooms/_EmojiButton.pcss";
@import "./views/rooms/_EntityTile.pcss";
@import "./views/rooms/_EventBubbleTile.pcss";
@import "./views/rooms/_EventPreview.pcss";
@import "./views/rooms/_EventTile.pcss";
Expand All @@ -290,13 +289,17 @@
@import "./views/rooms/_LinkPreviewGroup.pcss";
@import "./views/rooms/_LinkPreviewWidget.pcss";
@import "./views/rooms/_LiveContentSummary.pcss";
@import "./views/rooms/_MemberList.pcss";
@import "./views/rooms/_MemberListHeaderView.pcss";
@import "./views/rooms/_MemberListView.pcss";
@import "./views/rooms/_MemberTileView.pcss";
@import "./views/rooms/_MessageComposer.pcss";
@import "./views/rooms/_MessageComposerFormatBar.pcss";
@import "./views/rooms/_NewRoomIntro.pcss";
@import "./views/rooms/_NotificationBadge.pcss";
@import "./views/rooms/_OverflowTile.pcss";
@import "./views/rooms/_PinnedEventTile.pcss";
@import "./views/rooms/_PinnedMessageBanner.pcss";
@import "./views/rooms/_PresenceIconView.pcss";
@import "./views/rooms/_PresenceLabel.pcss";
@import "./views/rooms/_ReadReceiptGroup.pcss";
@import "./views/rooms/_ReplyPreview.pcss";
Expand Down
Loading
Loading