From 21022e3283b171fdd375bbf7fd98d39a1740279c Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 17 Oct 2024 12:55:57 +0100
Subject: [PATCH] Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
.../dialogs/__snapshots__/LogoutDialog-test.tsx.snap | 1 +
.../components/views/messages/MPollEndBody-test.tsx | 2 ++
.../components/views/rooms/MemberList-test.tsx | 9 ++++-----
.../views/settings/tabs/user/SessionManagerTab-test.tsx | 4 ++--
.../settings/tabs/user/VoiceUserSettingsTab-test.tsx | 7 +++----
5 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/test/unit-tests/components/views/dialogs/__snapshots__/LogoutDialog-test.tsx.snap b/test/unit-tests/components/views/dialogs/__snapshots__/LogoutDialog-test.tsx.snap
index 52863d4feea..04f7c42475e 100644
--- a/test/unit-tests/components/views/dialogs/__snapshots__/LogoutDialog-test.tsx.snap
+++ b/test/unit-tests/components/views/dialogs/__snapshots__/LogoutDialog-test.tsx.snap
@@ -73,6 +73,7 @@ exports[`LogoutDialog Prompts user to connect backup if there is a backup on the
", () => {
const userId = "@alice:domain.org";
@@ -127,6 +128,7 @@ describe("", () => {
expect(container).toMatchSnapshot();
await waitFor(() => expect(getByRole("progressbar")).toBeInTheDocument());
+ await waitForElementToBeRemoved(() => getByRole("progressbar"));
expect(mockClient.fetchRoomEvent).toHaveBeenCalledWith(roomId, pollStartEvent.getId());
diff --git a/test/unit-tests/components/views/rooms/MemberList-test.tsx b/test/unit-tests/components/views/rooms/MemberList-test.tsx
index 8f7637149a7..d21d2d41f1b 100644
--- a/test/unit-tests/components/views/rooms/MemberList-test.tsx
+++ b/test/unit-tests/components/views/rooms/MemberList-test.tsx
@@ -398,13 +398,12 @@ describe("MemberList", () => {
jest.spyOn(room, "canInvite").mockReturnValue(false);
renderComponent();
- await flushPromises();
+ await act(flushPromises);
// button rendered but disabled
- expect(screen.getByRole("button", { name: "Invite to this room" })).toHaveAttribute(
- "aria-disabled",
- "true",
- );
+ const button = document.querySelector(".mx_MemberList_invite");
+ expect(button).toHaveTextContent("Invite to this room");
+ expect(button).toHaveAttribute("aria-disabled", "true");
});
it("renders enabled invite button when current user is a member and has rights to invite", async () => {
diff --git a/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx b/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx
index b36306595e6..90a5d6a1f1c 100644
--- a/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx
+++ b/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx
@@ -926,10 +926,10 @@ describe("", () => {
devices: [alicesDevice, alicesMobileDevice, alicesOlderMobileDevice],
});
- const { getByTestId, findByTestId } = render(getComponent());
+ const { getByTestId, findByTestId } = render(getComponent(), { legacyRoot: true });
await waitForElementToBeRemoved(() => screen.queryAllByRole("progressbar"));
- await toggleDeviceDetails(getByTestId, alicesMobileDevice.device_id);
+ toggleDeviceDetails(getByTestId, alicesMobileDevice.device_id);
const signOutButton = await within(
await findByTestId(`device-detail-${alicesMobileDevice.device_id}`),
diff --git a/test/unit-tests/components/views/settings/tabs/user/VoiceUserSettingsTab-test.tsx b/test/unit-tests/components/views/settings/tabs/user/VoiceUserSettingsTab-test.tsx
index 8790ed72ac5..50fcf419313 100644
--- a/test/unit-tests/components/views/settings/tabs/user/VoiceUserSettingsTab-test.tsx
+++ b/test/unit-tests/components/views/settings/tabs/user/VoiceUserSettingsTab-test.tsx
@@ -58,17 +58,16 @@ describe("", () => {
describe("devices", () => {
it("renders dropdowns for input devices", async () => {
render(getComponent());
- await flushPromises();
- expect(screen.getByLabelText("Microphone")).toHaveDisplayValue(audioIn1.label);
- expect(screen.getByLabelText("Camera")).toHaveDisplayValue(videoIn1.label);
+ await expect(screen.findByLabelText("Microphone")).resolves.toHaveDisplayValue(audioIn1.label);
+ await expect(screen.findByLabelText("Camera")).resolves.toHaveDisplayValue(videoIn1.label);
});
it("updates device", async () => {
render(getComponent());
await flushPromises();
- fireEvent.change(screen.getByLabelText("Camera"), { target: { value: videoIn2.deviceId } });
+ fireEvent.change(await screen.findByLabelText("Camera"), { target: { value: videoIn2.deviceId } });
expect(MediaDeviceHandlerMock.instance.setDevice).toHaveBeenCalledWith(
videoIn2.deviceId,