From 1cb068a91efbd659254388da41cd64bf5b5cf943 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Fri, 4 Jul 2025 15:37:59 +0200 Subject: [PATCH] Fix e2e flakes in new room list (#30254) * test: retry failing assertion in room list * test: fix click on room not visible after scroll --- .../room-list-panel/room-list-filter-sort.spec.ts | 12 ++++++------ .../e2e/left-panel/room-list-panel/room-list.spec.ts | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/playwright/e2e/left-panel/room-list-panel/room-list-filter-sort.spec.ts b/playwright/e2e/left-panel/room-list-panel/room-list-filter-sort.spec.ts index 26d27cc01c..0e92e734c5 100644 --- a/playwright/e2e/left-panel/room-list-panel/room-list-filter-sort.spec.ts +++ b/playwright/e2e/left-panel/room-list-panel/room-list-filter-sort.spec.ts @@ -229,13 +229,13 @@ test.describe("Room list filters and sort", () => { // only one room should be visible await expect(roomList.getByRole("gridcell", { name: "unread dm" })).toBeVisible(); await expect(roomList.getByRole("gridcell", { name: "unread room" })).toBeVisible(); - expect(await roomList.locator("role=gridcell").count()).toBe(4); + await expect.poll(() => roomList.locator("role=gridcell").count()).toBe(4); await expect(primaryFilters).toMatchScreenshot("unread-primary-filters.png"); await primaryFilters.getByRole("option", { name: "People" }).click(); await expect(roomList.getByRole("gridcell", { name: "unread dm" })).toBeVisible(); await expect(roomList.getByRole("gridcell", { name: "invited room" })).toBeVisible(); - expect(await roomList.locator("role=gridcell").count()).toBe(2); + await expect.poll(() => roomList.locator("role=gridcell").count()).toBe(2); await primaryFilters.getByRole("option", { name: "Rooms" }).click(); await expect(roomList.getByRole("gridcell", { name: "unread room" })).toBeVisible(); @@ -243,21 +243,21 @@ test.describe("Room list filters and sort", () => { await expect(roomList.getByRole("gridcell", { name: "empty room" })).toBeVisible(); await expect(roomList.getByRole("gridcell", { name: "room with mention" })).toBeVisible(); await expect(roomList.getByRole("gridcell", { name: "Low prio room" })).toBeVisible(); - expect(await roomList.locator("role=gridcell").count()).toBe(5); + await expect.poll(() => roomList.locator("role=gridcell").count()).toBe(5); await getFilterExpandButton(page).click(); await primaryFilters.getByRole("option", { name: "Favourite" }).click(); await expect(roomList.getByRole("gridcell", { name: "favourite room" })).toBeVisible(); - expect(await roomList.locator("role=gridcell").count()).toBe(1); + await expect.poll(() => roomList.locator("role=gridcell").count()).toBe(1); await primaryFilters.getByRole("option", { name: "Mentions" }).click(); await expect(roomList.getByRole("gridcell", { name: "room with mention" })).toBeVisible(); - expect(await roomList.locator("role=gridcell").count()).toBe(1); + await expect.poll(() => roomList.locator("role=gridcell").count()).toBe(1); await primaryFilters.getByRole("option", { name: "Invites" }).click(); await expect(roomList.getByRole("gridcell", { name: "invited room" })).toBeVisible(); - expect(await roomList.locator("role=gridcell").count()).toBe(1); + await expect.poll(() => roomList.locator("role=gridcell").count()).toBe(1); await getFilterCollapseButton(page).click(); await expect(primaryFilters.locator("role=option").first()).toHaveText("Invites"); diff --git a/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts b/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts index ad422ee436..1f965ffb8f 100644 --- a/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts +++ b/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts @@ -146,6 +146,7 @@ test.describe("Room list", () => { // Scroll to the end of the room list await page.mouse.wheel(0, 1000); + await expect(roomListView.getByRole("gridcell", { name: "Open room room0" })).toBeVisible(); await roomListView.getByRole("gridcell", { name: "Open room room0" }).click(); const filters = page.getByRole("listbox", { name: "Room list filters" });