From 52a8733d47e6f216df9b3f9828d55b5849b0f13c Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Wed, 4 Oct 2023 13:20:24 +0100 Subject: [PATCH 1/2] Don't look for 'Updating space' message in joinrulesettings test as it may disappear too quickly for us to see. Fixes https://github.com/vector-im/element-web/issues/25625 --- test/components/views/settings/JoinRuleSettings-test.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/components/views/settings/JoinRuleSettings-test.tsx b/test/components/views/settings/JoinRuleSettings-test.tsx index 0095bfa03d3..4805a75f211 100644 --- a/test/components/views/settings/JoinRuleSettings-test.tsx +++ b/test/components/views/settings/JoinRuleSettings-test.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React from "react"; -import { act, fireEvent, render, screen, within } from "@testing-library/react"; +import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react"; import { EventType, GuestAccess, @@ -225,13 +225,14 @@ describe("", () => { expect(await screen.findByText("Sending invites... (1 out of 2)")).toBeInTheDocument(); deferredInvites.pop()!.resolve({}); - // update spaces - expect(await screen.findByText("Updating space...")).toBeInTheDocument(); + // Usually we see "Updating space..." in the UI here, but we + // removed the assertion about it, because it sometimes fails, + // presumably because it disappeared too quickly to be visible. await flushPromises(); // done, modal closed - expect(screen.queryByRole("dialog")).not.toBeInTheDocument(); + await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument()); }); it(`upgrades room with no parent spaces or members when changing join rule to ${joinRule}`, async () => { From 2d5ac1d20c8c2066ff117eebd8507a2633918051 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Wed, 4 Oct 2023 13:21:19 +0100 Subject: [PATCH 2/2] Provide mock function to avoid warning in JoinRuleSettings test --- test/components/views/settings/JoinRuleSettings-test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/test/components/views/settings/JoinRuleSettings-test.tsx b/test/components/views/settings/JoinRuleSettings-test.tsx index 4805a75f211..636c2ffd953 100644 --- a/test/components/views/settings/JoinRuleSettings-test.tsx +++ b/test/components/views/settings/JoinRuleSettings-test.tsx @@ -47,6 +47,7 @@ describe("", () => { const client = getMockClientWithEventEmitter({ ...mockClientMethodsUser(userId), getRoom: jest.fn(), + getDomain: jest.fn(), getLocalAliases: jest.fn().mockReturnValue([]), sendStateEvent: jest.fn(), upgradeRoom: jest.fn(),