Skip to content

Commit be633e6

Browse files
committed
test(e2e): add room list tests
1 parent 41b7060 commit be633e6

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2025 New Vector Ltd.
3+
*
4+
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
* Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import { type Page } from "@playwright/test";
9+
10+
import { test, expect } from "../../../element-web-test";
11+
12+
test.describe("Room list", () => {
13+
test.use({
14+
labsFlags: ["feature_new_room_list"],
15+
});
16+
17+
/**
18+
* Get the room list
19+
* @param page
20+
*/
21+
function getRoomList(page: Page) {
22+
return page.getByTestId("room-list");
23+
}
24+
25+
test.beforeEach(async ({ page, app, user }) => {
26+
// The notification toast is displayed above the search section
27+
await app.closeNotificationToast();
28+
for (let i = 0; i < 30; i++) {
29+
await app.client.createRoom({ name: `room${i}` });
30+
}
31+
});
32+
33+
test("should render the room list", { tag: "@screenshot" }, async ({ page, app, user }) => {
34+
const roomListView = getRoomList(page);
35+
await expect(roomListView.getByRole("gridcell", { name: "Open room room29" })).toBeVisible();
36+
await expect(roomListView).toMatchScreenshot("room-list.png");
37+
38+
await roomListView.hover();
39+
// Scroll to the end of the room list
40+
await page.mouse.wheel(0, 1000);
41+
await expect(roomListView.getByRole("gridcell", { name: "Open room room0" })).toBeVisible();
42+
await expect(roomListView).toMatchScreenshot("room-list-scrolled.png");
43+
});
44+
45+
test("should open the room when it is clicked", async ({ page, app, user }) => {
46+
const roomListView = getRoomList(page);
47+
await roomListView.getByRole("gridcell", { name: "Open room room29" }).click();
48+
await expect(page.getByRole("heading", { name: "room29", level: 1 })).toBeVisible();
49+
});
50+
});
Loading

0 commit comments

Comments
 (0)