Skip to content

Commit 77047e3

Browse files
committed
test(e2e): add tests for notification options menu
1 parent 9dd3bd5 commit 77047e3

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,45 @@ 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+
await app.client.createRoom({ name: "silent" });
92+
93+
const roomItem = roomListView.getByRole("gridcell", { name: "silent" });
94+
await roomItem.hover();
95+
96+
await expect(roomItem).toMatchScreenshot("room-list-item-hover.png");
97+
let roomItemMenu = roomItem.getByRole("button", { name: "Notification options" });
98+
await roomItemMenu.click();
99+
100+
// Default settings should be selected
101+
await expect(page.getByRole("menuitem", { name: "Match default settings" })).toHaveAttribute(
102+
"aria-selected",
103+
"true",
104+
);
105+
await expect(page).toMatchScreenshot("room-list-item-open-notification-options.png");
106+
107+
// It should make the room muted
108+
await page.getByRole("menuitem", { name: "Mute room" }).click();
109+
110+
// Remove hover on the room list item
111+
await roomListView.hover();
112+
113+
// The room decoration should have the muted icon
114+
await expect(roomItem.getByTestId("notification-decoration")).toBeVisible();
115+
116+
await roomItem.hover();
117+
// On hover, the room should show the muted icon
118+
await expect(roomItem).toMatchScreenshot("room-list-item-hover-silent.png");
119+
120+
roomItemMenu = roomItem.getByRole("button", { name: "Notification options" });
121+
await roomItemMenu.click();
122+
// The Mute room option should be selected
123+
await expect(page.getByRole("menuitem", { name: "Mute room" })).toHaveAttribute("aria-selected", "true");
124+
await expect(page).toMatchScreenshot("room-list-item-open-notification-options-selection.png");
125+
});
126+
88127
test("should scroll to the current room", async ({ page, app, user }) => {
89128
const roomListView = getRoomList(page);
90129
await roomListView.hover();
Loading

0 commit comments

Comments
 (0)