You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-06 10:22:45 +03:00
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 https://github.com/vector-im/element-web/issues/25625 * Provide mock function to avoid warning in JoinRuleSettings test
This commit is contained in:
@@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react";
|
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 {
|
import {
|
||||||
EventType,
|
EventType,
|
||||||
GuestAccess,
|
GuestAccess,
|
||||||
@@ -47,6 +47,7 @@ describe("<JoinRuleSettings />", () => {
|
|||||||
const client = getMockClientWithEventEmitter({
|
const client = getMockClientWithEventEmitter({
|
||||||
...mockClientMethodsUser(userId),
|
...mockClientMethodsUser(userId),
|
||||||
getRoom: jest.fn(),
|
getRoom: jest.fn(),
|
||||||
|
getDomain: jest.fn(),
|
||||||
getLocalAliases: jest.fn().mockReturnValue([]),
|
getLocalAliases: jest.fn().mockReturnValue([]),
|
||||||
sendStateEvent: jest.fn(),
|
sendStateEvent: jest.fn(),
|
||||||
upgradeRoom: jest.fn(),
|
upgradeRoom: jest.fn(),
|
||||||
@@ -225,13 +226,14 @@ describe("<JoinRuleSettings />", () => {
|
|||||||
expect(await screen.findByText("Sending invites... (1 out of 2)")).toBeInTheDocument();
|
expect(await screen.findByText("Sending invites... (1 out of 2)")).toBeInTheDocument();
|
||||||
deferredInvites.pop()!.resolve({});
|
deferredInvites.pop()!.resolve({});
|
||||||
|
|
||||||
// update spaces
|
// Usually we see "Updating space..." in the UI here, but we
|
||||||
expect(await screen.findByText("Updating space...")).toBeInTheDocument();
|
// removed the assertion about it, because it sometimes fails,
|
||||||
|
// presumably because it disappeared too quickly to be visible.
|
||||||
|
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
// done, modal closed
|
// 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 () => {
|
it(`upgrades room with no parent spaces or members when changing join rule to ${joinRule}`, async () => {
|
||||||
|
Reference in New Issue
Block a user