Skip to content

Commit e58660c

Browse files
committed
test(e2e): add tests for notification options menu
1 parent 2e0768c commit e58660c

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,43 @@ test.describe("Room list", () => {
8585
await expect(roomItem).not.toBeVisible();
8686
});
8787

88+
test("should open the notification options menu", { tag: "@screenshot" }, async ({ page, app, user }) => {
89+
const roomListView = getRoomList(page);
90+
91+
const roomItem = roomListView.getByRole("gridcell", { name: "Open room room29" });
92+
await roomItem.hover();
93+
94+
await expect(roomItem).toMatchScreenshot("room-list-item-hover.png");
95+
let roomItemMenu = roomItem.getByRole("button", { name: "Notification options" });
96+
await roomItemMenu.click();
97+
98+
// Default settings should be selected
99+
await expect(page.getByRole("menuitem", { name: "Match default settings" })).toHaveAttribute(
100+
"aria-selected",
101+
"true",
102+
);
103+
await expect(page).toMatchScreenshot("room-list-item-open-notification-options.png");
104+
105+
// It should make the room muted
106+
await page.getByRole("menuitem", { name: "Mute room" }).click();
107+
108+
// Remove hover on the room list item
109+
await roomListView.hover();
110+
111+
// The room decoration should have the muted icon
112+
await expect(roomItem.getByTestId("notification-decoration")).toBeVisible();
113+
114+
await roomItem.hover();
115+
// On hover, the room should show the muted icon
116+
await expect(roomItem).toMatchScreenshot("room-list-item-hover-silent.png");
117+
118+
roomItemMenu = roomItem.getByRole("button", { name: "Notification options" });
119+
await roomItemMenu.click();
120+
// The Mute room option should be selected
121+
await expect(page.getByRole("menuitem", { name: "Mute room" })).toHaveAttribute("aria-selected", "true");
122+
await expect(page).toMatchScreenshot("room-list-item-open-notification-options-selection.png");
123+
});
124+
88125
test("should scroll to the current room", async ({ page, app, user }) => {
89126
const roomListView = getRoomList(page);
90127
await roomListView.hover();
Loading

0 commit comments

Comments
 (0)