Skip to content

Commit 58aaa51

Browse files
committed
test(e2e): update screenshots and tests
1 parent 0d0afd2 commit 58aaa51

29 files changed

+38
-16
lines changed

playwright/e2e/left-panel/room-list-panel/room-list-filter-sort.spec.ts

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ test.describe("Room list filters and sort", () => {
2525
return page.getByRole("listbox", { name: "Room list filters" });
2626
}
2727

28-
function getSecondaryFilters(page: Page): Locator {
29-
return page.getByRole("button", { name: "Filter" });
30-
}
31-
3228
function getRoomOptionsMenu(page: Page): Locator {
3329
return page.getByRole("button", { name: "Room Options" });
3430
}
@@ -181,6 +177,33 @@ test.describe("Room list filters and sort", () => {
181177
await app.client.evaluate(async (client, id) => {
182178
await client.setRoomTag(id, "m.lowpriority", { order: 0.5 });
183179
}, lowPrioId);
180+
181+
await bot.createRoom({
182+
name: "invited room",
183+
invite: [user.userId],
184+
is_direct: true,
185+
});
186+
187+
const mentionRoomId = await app.client.createRoom({ name: "room with mention" });
188+
await app.client.inviteUser(mentionRoomId, bot.credentials.userId);
189+
await bot.joinRoom(mentionRoomId);
190+
191+
const clientBot = await bot.prepareClient();
192+
await clientBot.evaluate(
193+
async (client, { mentionRoomId, userId }) => {
194+
await client.sendMessage(mentionRoomId, {
195+
// @ts-ignore ignore usage of MsgType.text
196+
"msgtype": "m.text",
197+
"body": "User",
198+
"format": "org.matrix.custom.html",
199+
"formatted_body": `<a href="https://matrix.to/#/${userId}">User</a>`,
200+
"m.mentions": {
201+
user_ids: [userId],
202+
},
203+
});
204+
},
205+
{ mentionRoomId, userId: user.userId },
206+
);
184207
});
185208

186209
test("should filter the list (with primary filters)", { tag: "@screenshot" }, async ({ page, app, user }) => {
@@ -197,7 +220,7 @@ test.describe("Room list filters and sort", () => {
197220
// only one room should be visible
198221
await expect(roomList.getByRole("gridcell", { name: "unread dm" })).toBeVisible();
199222
await expect(roomList.getByRole("gridcell", { name: "unread room" })).toBeVisible();
200-
expect(await roomList.locator("role=gridcell").count()).toBe(2);
223+
expect(await roomList.locator("role=gridcell").count()).toBe(4);
201224
await expect(primaryFilters).toMatchScreenshot("unread-primary-filters.png");
202225

203226
await primaryFilters.getByRole("option", { name: "Favourite" }).click();
@@ -206,24 +229,23 @@ test.describe("Room list filters and sort", () => {
206229

207230
await primaryFilters.getByRole("option", { name: "People" }).click();
208231
await expect(roomList.getByRole("gridcell", { name: "unread dm" })).toBeVisible();
209-
expect(await roomList.locator("role=gridcell").count()).toBe(1);
232+
await expect(roomList.getByRole("gridcell", { name: "invited room" })).toBeVisible();
233+
expect(await roomList.locator("role=gridcell").count()).toBe(2);
210234

211235
await primaryFilters.getByRole("option", { name: "Rooms" }).click();
212236
await expect(roomList.getByRole("gridcell", { name: "unread room" })).toBeVisible();
213237
await expect(roomList.getByRole("gridcell", { name: "favourite room" })).toBeVisible();
214238
await expect(roomList.getByRole("gridcell", { name: "empty room" })).toBeVisible();
215-
expect(await roomList.locator("role=gridcell").count()).toBe(4);
216-
});
217-
218-
test("should filter the list (with secondary filters)", { tag: "@screenshot" }, async ({ page, app, user }) => {
219-
const roomList = getRoomList(page);
220-
const secondaryFilters = getSecondaryFilters(page);
221-
await secondaryFilters.click();
239+
await expect(roomList.getByRole("gridcell", { name: "room with mention" })).toBeVisible();
240+
await expect(roomList.getByRole("gridcell", { name: "Low prio room" })).toBeVisible();
241+
expect(await roomList.locator("role=gridcell").count()).toBe(5);
222242

223-
await expect(page.getByRole("menu", { name: "Filter" })).toMatchScreenshot("filter-menu.png");
243+
await primaryFilters.getByRole("option", { name: "Mentions" }).click();
244+
await expect(roomList.getByRole("gridcell", { name: "room with mention" })).toBeVisible();
245+
expect(await roomList.locator("role=gridcell").count()).toBe(1);
224246

225-
await page.getByRole("menuitem", { name: "Low priority" }).click();
226-
await expect(roomList.getByRole("gridcell", { name: "Low prio room" })).toBeVisible();
247+
await primaryFilters.getByRole("option", { name: "Invites" }).click();
248+
await expect(roomList.getByRole("gridcell", { name: "invited room" })).toBeVisible();
227249
expect(await roomList.locator("role=gridcell").count()).toBe(1);
228250
});
229251

0 commit comments

Comments
 (0)