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

Commit 9efa458

Browse files
authored
Unflake JoinRuleSettings test (#11715)
* Don't look for 'Updating space' message in joinrulesettings test as it may disappear too quickly for us to see. Fixes element-hq/element-web#25625 * Provide mock function to avoid warning in JoinRuleSettings test
1 parent ae51ed7 commit 9efa458

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/components/views/settings/JoinRuleSettings-test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import React from "react";
18-
import { act, fireEvent, render, screen, within } from "@testing-library/react";
18+
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
1919
import {
2020
EventType,
2121
GuestAccess,
@@ -47,6 +47,7 @@ describe("<JoinRuleSettings />", () => {
4747
const client = getMockClientWithEventEmitter({
4848
...mockClientMethodsUser(userId),
4949
getRoom: jest.fn(),
50+
getDomain: jest.fn(),
5051
getLocalAliases: jest.fn().mockReturnValue([]),
5152
sendStateEvent: jest.fn(),
5253
upgradeRoom: jest.fn(),
@@ -225,13 +226,14 @@ describe("<JoinRuleSettings />", () => {
225226
expect(await screen.findByText("Sending invites... (1 out of 2)")).toBeInTheDocument();
226227
deferredInvites.pop()!.resolve({});
227228

228-
// update spaces
229-
expect(await screen.findByText("Updating space...")).toBeInTheDocument();
229+
// Usually we see "Updating space..." in the UI here, but we
230+
// removed the assertion about it, because it sometimes fails,
231+
// presumably because it disappeared too quickly to be visible.
230232

231233
await flushPromises();
232234

233235
// done, modal closed
234-
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
236+
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
235237
});
236238

237239
it(`upgrades room with no parent spaces or members when changing join rule to ${joinRule}`, async () => {

0 commit comments

Comments
 (0)