Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 49bc620

Browse files
committed
Update tests
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 81c4ef3 commit 49bc620

File tree

7 files changed

+9
-58
lines changed

7 files changed

+9
-58
lines changed

playwright/e2e/right-panel/file-panel.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test.describe("FilePanel", () => {
5050
test.describe("render", () => {
5151
test("should render empty state", async ({ page }) => {
5252
// Wait until the information about the empty state is rendered
53-
await expect(page.locator(".mx_FilePanel_empty")).toBeVisible();
53+
await expect(page.locator(".mx_EmptyState")).toBeVisible();
5454

5555
// Take a snapshot of RightPanel - fix https://github.com/vector-im/element-web/issues/25332
5656
await expect(page.locator(".mx_RightPanel")).toMatchScreenshot("empty.png");

playwright/e2e/right-panel/notification-panel.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test.describe("NotificationPanel", () => {
3535
await page.getByRole("button", { name: "Notifications" }).click();
3636

3737
// Wait until the information about the empty state is rendered
38-
await expect(page.locator(".mx_NotificationPanel_empty")).toBeVisible();
38+
await expect(page.locator(".mx_EmptyState")).toBeVisible();
3939

4040
// Take a snapshot of RightPanel
4141
await expect(page.locator(".mx_RightPanel")).toMatchScreenshot("empty.png");

playwright/e2e/right-panel/right-panel.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ test.describe("RightPanel", () => {
104104

105105
await page.getByRole("menuitem", { name: "Files" }).click();
106106
await expect(page.locator(".mx_FilePanel")).toBeVisible();
107-
await expect(page.locator(".mx_FilePanel_empty")).toBeVisible();
107+
await expect(page.locator(".mx_EmptyState")).toBeVisible();
108108

109109
await page.getByTestId("base-card-back-button").click();
110110
await checkRoomSummaryCard(page, ROOM_NAME);
Loading
Loading

test/components/structures/ThreadPanel-test.tsx

+6-41
Original file line numberDiff line numberDiff line change
@@ -43,44 +43,21 @@ describe("ThreadPanel", () => {
4343
describe("Header", () => {
4444
it("expect that All filter for ThreadPanelHeader properly renders Show: All threads", () => {
4545
const { asFragment } = render(
46-
<ThreadPanelHeader
47-
empty={false}
48-
filterOption={ThreadFilterType.All}
49-
setFilterOption={() => undefined}
50-
/>,
46+
<ThreadPanelHeader filterOption={ThreadFilterType.All} setFilterOption={() => undefined} />,
5147
);
5248
expect(asFragment()).toMatchSnapshot();
5349
});
5450

5551
it("expect that My filter for ThreadPanelHeader properly renders Show: My threads", () => {
5652
const { asFragment } = render(
57-
<ThreadPanelHeader
58-
empty={false}
59-
filterOption={ThreadFilterType.My}
60-
setFilterOption={() => undefined}
61-
/>,
62-
);
63-
expect(asFragment()).toMatchSnapshot();
64-
});
65-
66-
it("matches snapshot when no threads", () => {
67-
const { asFragment } = render(
68-
<ThreadPanelHeader
69-
empty={true}
70-
filterOption={ThreadFilterType.All}
71-
setFilterOption={() => undefined}
72-
/>,
53+
<ThreadPanelHeader filterOption={ThreadFilterType.My} setFilterOption={() => undefined} />,
7354
);
7455
expect(asFragment()).toMatchSnapshot();
7556
});
7657

7758
it("expect that ThreadPanelHeader properly opens a context menu when clicked on the button", () => {
7859
const { container } = render(
79-
<ThreadPanelHeader
80-
empty={false}
81-
filterOption={ThreadFilterType.All}
82-
setFilterOption={() => undefined}
83-
/>,
60+
<ThreadPanelHeader filterOption={ThreadFilterType.All} setFilterOption={() => undefined} />,
8461
);
8562
const found = container.querySelector(".mx_ThreadPanel_dropdown");
8663
expect(found).toBeTruthy();
@@ -91,11 +68,7 @@ describe("ThreadPanel", () => {
9168

9269
it("expect that ThreadPanelHeader has the correct option selected in the context menu", () => {
9370
const { container } = render(
94-
<ThreadPanelHeader
95-
empty={false}
96-
filterOption={ThreadFilterType.All}
97-
setFilterOption={() => undefined}
98-
/>,
71+
<ThreadPanelHeader filterOption={ThreadFilterType.All} setFilterOption={() => undefined} />,
9972
);
10073
fireEvent.click(container.querySelector(".mx_ThreadPanel_dropdown")!);
10174
const found = screen.queryAllByRole("menuitemradio");
@@ -118,11 +91,7 @@ describe("ThreadPanel", () => {
11891
const { container } = render(
11992
<RoomContext.Provider value={roomContextObject}>
12093
<MatrixClientContext.Provider value={mockClient}>
121-
<ThreadPanelHeader
122-
empty={false}
123-
filterOption={ThreadFilterType.All}
124-
setFilterOption={() => undefined}
125-
/>
94+
<ThreadPanelHeader filterOption={ThreadFilterType.All} setFilterOption={() => undefined} />
12695
</MatrixClientContext.Provider>
12796
</RoomContext.Provider>,
12897
);
@@ -136,11 +105,7 @@ describe("ThreadPanel", () => {
136105
const mockClient = createTestClient();
137106
const { container } = render(
138107
<MatrixClientContext.Provider value={mockClient}>
139-
<ThreadPanelHeader
140-
empty={false}
141-
filterOption={ThreadFilterType.All}
142-
setFilterOption={() => undefined}
143-
/>
108+
<ThreadPanelHeader filterOption={ThreadFilterType.All} setFilterOption={() => undefined} />
144109
</MatrixClientContext.Provider>,
145110
);
146111
fireEvent.click(getByRole(container, "button", { name: "Mark all as read" }));

test/components/structures/__snapshots__/ThreadPanel-test.tsx.snap

-14
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,3 @@ exports[`ThreadPanel Header expect that ThreadPanelHeader has the correct option
9595
</span>
9696
</div>
9797
`;
98-
99-
exports[`ThreadPanel Header matches snapshot when no threads 1`] = `
100-
<DocumentFragment>
101-
<div
102-
class="mx_BaseCard_header_title"
103-
>
104-
<h4
105-
class="mx_Heading_h4 mx_BaseCard_header_title_heading"
106-
>
107-
Threads
108-
</h4>
109-
</div>
110-
</DocumentFragment>
111-
`;

0 commit comments

Comments
 (0)