-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): add tests for room list header
- Loading branch information
1 parent
f6944d8
commit 6d796b0
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
playwright/e2e/left-panel/room-list-view/room-list-header.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2025 New Vector Ltd. | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
* Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import { test, expect } from "../../../element-web-test"; | ||
import type { Page } from "@playwright/test"; | ||
|
||
test.describe("Header section of the room list", () => { | ||
test.use({ | ||
labsFlags: ["feature_new_room_list"], | ||
}); | ||
|
||
/** | ||
* Get the header section of the room list | ||
* @param page | ||
*/ | ||
function getHeaderSection(page: Page) { | ||
return page.getByTestId("room-list-header"); | ||
} | ||
|
||
test.beforeEach(async ({ page, app, user }) => { | ||
// The notification toast is displayed above the search section | ||
await app.closeNotificationToast(); | ||
}); | ||
|
||
test("should render the header section", { tag: "@screenshot" }, async ({ page, app, user }) => { | ||
const roomListHeader = getHeaderSection(page); | ||
await expect(roomListHeader).toMatchScreenshot("room-list-header.png"); | ||
|
||
const composeMenu = roomListHeader.getByRole("button", { name: "Add" }); | ||
await composeMenu.click(); | ||
|
||
await expect(page.getByRole("menu")).toMatchScreenshot("room-list-header-compose-menu.png"); | ||
|
||
// New message should open the direct messages dialog | ||
await page.getByRole("menuitem", { name: "New message" }).click(); | ||
await expect(page.getByRole("heading", { name: "Direct Messages" })).toBeVisible(); | ||
await app.closeDialog(); | ||
|
||
// New room should open the room creation dialog | ||
await composeMenu.click(); | ||
await page.getByRole("menuitem", { name: "New room" }).click(); | ||
await expect(page.getByRole("heading", { name: "Create a private room" })).toBeVisible(); | ||
await app.closeDialog(); | ||
}); | ||
|
||
test("should render the header section for a space", async ({ page, app, user }) => { | ||
await app.client.createSpace({ name: "MySpace" }); | ||
await page.getByRole("button", { name: "MySpace" }).click(); | ||
|
||
const roomListHeader = getHeaderSection(page); | ||
await expect(roomListHeader.getByRole("heading", { name: "MySpace" })).toBeVisible(); | ||
await expect(roomListHeader.getByRole("button", { name: "Add" })).not.toBeVisible(); | ||
}); | ||
}); |
Binary file added
BIN
+4.7 KB
...room-list-view/room-list-header.spec.ts/room-list-header-compose-menu-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.62 KB
...s/left-panel/room-list-view/room-list-header.spec.ts/room-list-header-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.