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 d3aa060a2721f561400991092a6447feb1a33177..998286e903baaea89da291e20e4163f4133105a9 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 @@ -22,13 +22,21 @@ test.describe("Room list filters and sort", () => { }); function getPrimaryFilters(page: Page): Locator { - return page.getByRole("listbox", { name: "Room list filters" }); + return page.getByTestId("primary-filters"); } function getRoomOptionsMenu(page: Page): Locator { return page.getByRole("button", { name: "Room Options" }); } + function getFilterExpandButton(page: Page): Locator { + return getPrimaryFilters(page).getByRole("button", { name: "Expand filter list" }); + } + + function getFilterCollapseButton(page: Page): Locator { + return getPrimaryFilters(page).getByRole("button", { name: "Collapse filter list" }); + } + /** * Get the room list * @param page @@ -223,10 +231,6 @@ test.describe("Room list filters and sort", () => { expect(await roomList.locator("role=gridcell").count()).toBe(4); await expect(primaryFilters).toMatchScreenshot("unread-primary-filters.png"); - 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 primaryFilters.getByRole("option", { name: "People" }).click(); await expect(roomList.getByRole("gridcell", { name: "unread dm" })).toBeVisible(); await expect(roomList.getByRole("gridcell", { name: "invited room" })).toBeVisible(); @@ -240,6 +244,12 @@ test.describe("Room list filters and sort", () => { await expect(roomList.getByRole("gridcell", { name: "Low prio room" })).toBeVisible(); expect(await 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 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); @@ -247,6 +257,9 @@ test.describe("Room list filters and sort", () => { 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 getFilterCollapseButton(page).click(); + await expect(primaryFilters.locator("role=option").first()).toHaveText("Invites"); }); test( diff --git a/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unread-primary-filters-linux.png b/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unread-primary-filters-linux.png index f0cda0b5771d506d289ae84b3fd5bcac6fe64757..e06221279fbf6cf841c4908ac3333b4d5e6910bc 100644 Binary files a/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unread-primary-filters-linux.png and b/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unread-primary-filters-linux.png differ diff --git a/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unselected-primary-filters-linux.png b/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unselected-primary-filters-linux.png index 7d63f923b0f85ac001cc25c1ed250d244bdadf5e..847836bd269d6434a8fda4a8b83c0d08460c5132 100644 Binary files a/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unselected-primary-filters-linux.png and b/playwright/snapshots/left-panel/room-list-panel/room-list-filter-sort.spec.ts/unselected-primary-filters-linux.png differ