From 3eaef58ba1bbe0608efeeff502a64d0fbf0c5e7e Mon Sep 17 00:00:00 2001 From: "marc.sirisak" Date: Thu, 10 Oct 2024 16:50:16 +0200 Subject: [PATCH] test(fix): fix some random tests and add snapshot --- .../components/structures/UserMenu-test.tsx | 6 +- .../__snapshots__/UserMenu-test.tsx.snap | 22 ++--- .../BugReportDialog-test.tsx.snap | 32 +++---- .../views/rooms/RoomHeaders-test.tsx | 5 + .../__snapshots__/RoomHeaders-test.tsx.snap | 91 ++++++++++++++++++ .../views/spaces/SpacePanel-test.tsx | 24 ++++- .../__snapshots__/SpacePanel-test.tsx.snap | 92 +++++++++++++++++++ 7 files changed, 237 insertions(+), 35 deletions(-) create mode 100644 test/unit-tests/tchap/components/views/rooms/__snapshots__/RoomHeaders-test.tsx.snap create mode 100644 test/unit-tests/tchap/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap diff --git a/test/unit-tests/tchap/components/structures/UserMenu-test.tsx b/test/unit-tests/tchap/components/structures/UserMenu-test.tsx index 932da78e5..ec6044b5e 100644 --- a/test/unit-tests/tchap/components/structures/UserMenu-test.tsx +++ b/test/unit-tests/tchap/components/structures/UserMenu-test.tsx @@ -26,7 +26,7 @@ describe("", () => { // it"s a good indicator to see if this could introduce some regression on our code it("should render as expected", async () => { // open the user menu - screen.getByRole("button", { name: "a11y" }).click(); + screen.getByRole("button", { name: "User menu" }).click(); const menu = screen.getByRole("menu"); expect(menu).toMatchSnapshot(); @@ -46,9 +46,9 @@ describe("", () => { it("should open the faq when clicking on the faq button", () => { global.open = jest.fn(); // open the user menu - screen.getByRole("button", { name: "a11y" }).click(); + screen.getByRole("button", { name: "User menu" }).click(); // click on the faq - screen.getByRole("menuitem", { name: "common" }).click(); + screen.getByRole("menuitem", { name: "Help" }).click(); expect(global.open).toHaveBeenCalledTimes(1); expect(global.open).toHaveBeenCalledWith("https://www.tchap.gouv.fr/faq", "_blank"); }); diff --git a/test/unit-tests/tchap/components/structures/__snapshots__/UserMenu-test.tsx.snap b/test/unit-tests/tchap/components/structures/__snapshots__/UserMenu-test.tsx.snap index 3ffbfca49..e16b8817e 100644 --- a/test/unit-tests/tchap/components/structures/__snapshots__/UserMenu-test.tsx.snap +++ b/test/unit-tests/tchap/components/structures/__snapshots__/UserMenu-test.tsx.snap @@ -25,7 +25,7 @@ exports[` UI should render as expected 1`] = `
UI should render as expected 1`] = ` class="mx_IconizedContextMenu_optionList mx_IconizedContextMenu_optionList_notFirst" >
diff --git a/test/unit-tests/tchap/components/views/dialogs/__snapshots__/BugReportDialog-test.tsx.snap b/test/unit-tests/tchap/components/views/dialogs/__snapshots__/BugReportDialog-test.tsx.snap index bda6b9a3c..32f0ba03a 100644 --- a/test/unit-tests/tchap/components/views/dialogs/__snapshots__/BugReportDialog-test.tsx.snap +++ b/test/unit-tests/tchap/components/views/dialogs/__snapshots__/BugReportDialog-test.tsx.snap @@ -33,19 +33,19 @@ exports[` should render as expected 1`] = ` >

- bug_reporting + Reminder: Your browser is unsupported, so your experience may be unpredictable.

- bug_reporting + Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.