Attempt to stabilise vitest (#34547)
This commit is contained in:
@@ -333,7 +333,10 @@ describe("<MatrixChat />", () => {
|
|||||||
// So then, we start the next test while stuff is still ongoing from the previous test, which messes up the current test.
|
// So then, we start the next test while stuff is still ongoing from the previous test, which messes up the current test.
|
||||||
// There is no obvious event we could wait for which indicates that everything has completed,
|
// There is no obvious event we could wait for which indicates that everything has completed,
|
||||||
// since each test does something different. Instead, we just let real timers and microtasks drain.
|
// since each test does something different. Instead, we just let real timers and microtasks drain.
|
||||||
await sleep(200);
|
await act(() => sleep(200));
|
||||||
|
|
||||||
|
// RTL cleanup won't touch roots we render ourselves so clean those up manually
|
||||||
|
await clearAllModals();
|
||||||
});
|
});
|
||||||
|
|
||||||
resetJsDomAfterEach();
|
resetJsDomAfterEach();
|
||||||
@@ -708,13 +711,16 @@ describe("<MatrixChat />", () => {
|
|||||||
action: Action.WillStartClient,
|
action: Action.WillStartClient,
|
||||||
});
|
});
|
||||||
// client successfully started
|
// client successfully started
|
||||||
await waitFor(() =>
|
// Waiting for login -> startMatrixClient, which can be slow.
|
||||||
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.ClientStarted }),
|
// Allow more time than the 1s default.
|
||||||
|
await waitFor(
|
||||||
|
() => expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.ClientStarted }),
|
||||||
|
{ timeout: 5000 },
|
||||||
);
|
);
|
||||||
|
|
||||||
// set up keys screen is rendered
|
// set up keys screen is rendered
|
||||||
await expect(screen.findByText("Setting up keys")).resolves.toBeInTheDocument();
|
await expect(screen.findByText("Setting up keys")).resolves.toBeInTheDocument();
|
||||||
});
|
}, 15000);
|
||||||
|
|
||||||
it("should persist device language when available", async () => {
|
it("should persist device language when available", async () => {
|
||||||
await SettingsStore.setValue("language", null, SettingLevel.DEVICE, "en");
|
await SettingsStore.setValue("language", null, SettingLevel.DEVICE, "en");
|
||||||
@@ -1356,13 +1362,16 @@ describe("<MatrixChat />", () => {
|
|||||||
defaultDispatcher.dispatch({
|
defaultDispatcher.dispatch({
|
||||||
action: Action.WillStartClient,
|
action: Action.WillStartClient,
|
||||||
});
|
});
|
||||||
await waitFor(() =>
|
// Waiting for login -> startMatrixClient, which can be slow.
|
||||||
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.ClientStarted }),
|
// Allow more time than the 1s default.
|
||||||
|
await waitFor(
|
||||||
|
() => expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.ClientStarted }),
|
||||||
|
{ timeout: 5000 },
|
||||||
);
|
);
|
||||||
|
|
||||||
// Then we are not allowed in - we are being asked to verify
|
// Then we are not allowed in - we are being asked to verify
|
||||||
await screen.findByRole("heading", { name: "Confirm your digital identity", level: 2 });
|
await screen.findByRole("heading", { name: "Confirm your digital identity", level: 2 });
|
||||||
});
|
}, 15000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user