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

Commit

Permalink
Flaky test SecurityRoomSettingsTab enables encryption after confirmat…
Browse files Browse the repository at this point in the history
…ion (#10750)

* try killing all modals before test

* lint
  • Loading branch information
Kerry authored May 2, 2023
1 parent a81940b commit 0adf465
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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("<SecurityRoomSettingsTab />", () => {
Expand Down Expand Up @@ -86,10 +91,12 @@ describe("<SecurityRoomSettingsTab />", () => {
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", () => {
Expand Down Expand Up @@ -343,6 +350,7 @@ describe("<SecurityRoomSettingsTab />", () => {

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, {
Expand Down

0 comments on commit 0adf465

Please sign in to comment.