From 0adf465397b41c617d00093015f92d2cdc93a094 Mon Sep 17 00:00:00 2001 From: Kerry Date: Tue, 2 May 2023 19:46:32 +1200 Subject: [PATCH] Flaky test SecurityRoomSettingsTab enables encryption after confirmation (#10750) * try killing all modals before test * lint --- .../tabs/room/SecurityRoomSettingsTab-test.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/components/views/settings/tabs/room/SecurityRoomSettingsTab-test.tsx b/test/components/views/settings/tabs/room/SecurityRoomSettingsTab-test.tsx index e2b4e49464..2595a8f362 100644 --- a/test/components/views/settings/tabs/room/SecurityRoomSettingsTab-test.tsx +++ b/test/components/views/settings/tabs/room/SecurityRoomSettingsTab-test.tsx @@ -22,7 +22,12 @@ import { logger } from "matrix-js-sdk/src/logger"; import SecurityRoomSettingsTab from "../../../../../../src/components/views/settings/tabs/room/SecurityRoomSettingsTab"; import MatrixClientContext from "../../../../../../src/contexts/MatrixClientContext"; import SettingsStore from "../../../../../../src/settings/SettingsStore"; -import { flushPromises, getMockClientWithEventEmitter, mockClientMethodsUser } from "../../../../../test-utils"; +import { + clearAllModals, + flushPromises, + getMockClientWithEventEmitter, + mockClientMethodsUser, +} from "../../../../../test-utils"; import { filterBoolean } from "../../../../../../src/utils/arrays"; describe("", () => { @@ -86,10 +91,12 @@ describe("", () => { room.currentState.setStateEvents(events); }; - beforeEach(() => { + beforeEach(async () => { client.sendStateEvent.mockReset().mockResolvedValue({ event_id: "test" }); client.isRoomEncrypted.mockReturnValue(false); jest.spyOn(SettingsStore, "getValue").mockRestore(); + + await clearAllModals(); }); describe("join rule", () => { @@ -343,6 +350,7 @@ describe("", () => { const dialog = await screen.findByRole("dialog"); + expect(within(dialog).getByText("Enable encryption?")).toBeInTheDocument(); fireEvent.click(within(dialog).getByText("OK")); expect(client.sendStateEvent).toHaveBeenCalledWith(room.roomId, EventType.RoomEncryption, {