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

Unflake JoinRuleSettings test #11715

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions test/components/views/settings/JoinRuleSettings-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -47,6 +47,7 @@ describe("<JoinRuleSettings />", () => {
const client = getMockClientWithEventEmitter({
...mockClientMethodsUser(userId),
getRoom: jest.fn(),
getDomain: jest.fn(),
getLocalAliases: jest.fn().mockReturnValue([]),
sendStateEvent: jest.fn(),
upgradeRoom: jest.fn(),
Expand Down Expand Up @@ -225,13 +226,14 @@ describe("<JoinRuleSettings />", () => {
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 () => {
Expand Down