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

Commit 0adf465

Browse files
author
Kerry
authored
Flaky test SecurityRoomSettingsTab enables encryption after confirmation (#10750)
* try killing all modals before test * lint
1 parent a81940b commit 0adf465

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/components/views/settings/tabs/room/SecurityRoomSettingsTab-test.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ import { logger } from "matrix-js-sdk/src/logger";
2222
import SecurityRoomSettingsTab from "../../../../../../src/components/views/settings/tabs/room/SecurityRoomSettingsTab";
2323
import MatrixClientContext from "../../../../../../src/contexts/MatrixClientContext";
2424
import SettingsStore from "../../../../../../src/settings/SettingsStore";
25-
import { flushPromises, getMockClientWithEventEmitter, mockClientMethodsUser } from "../../../../../test-utils";
25+
import {
26+
clearAllModals,
27+
flushPromises,
28+
getMockClientWithEventEmitter,
29+
mockClientMethodsUser,
30+
} from "../../../../../test-utils";
2631
import { filterBoolean } from "../../../../../../src/utils/arrays";
2732

2833
describe("<SecurityRoomSettingsTab />", () => {
@@ -86,10 +91,12 @@ describe("<SecurityRoomSettingsTab />", () => {
8691
room.currentState.setStateEvents(events);
8792
};
8893

89-
beforeEach(() => {
94+
beforeEach(async () => {
9095
client.sendStateEvent.mockReset().mockResolvedValue({ event_id: "test" });
9196
client.isRoomEncrypted.mockReturnValue(false);
9297
jest.spyOn(SettingsStore, "getValue").mockRestore();
98+
99+
await clearAllModals();
93100
});
94101

95102
describe("join rule", () => {
@@ -343,6 +350,7 @@ describe("<SecurityRoomSettingsTab />", () => {
343350

344351
const dialog = await screen.findByRole("dialog");
345352

353+
expect(within(dialog).getByText("Enable encryption?")).toBeInTheDocument();
346354
fireEvent.click(within(dialog).getByText("OK"));
347355

348356
expect(client.sendStateEvent).toHaveBeenCalledWith(room.roomId, EventType.RoomEncryption, {

0 commit comments

Comments
 (0)