Fix flaky Jest test: RoomView search results (#31785)
Signed-off-by: aditya-cherukuru <cherukuru.aditya01@gmail.com>
This commit is contained in:
@@ -24,16 +24,7 @@ import {
|
|||||||
} from "matrix-js-sdk/src/matrix";
|
} from "matrix-js-sdk/src/matrix";
|
||||||
import { type CryptoApi, CryptoEvent, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api";
|
import { type CryptoApi, CryptoEvent, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api";
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||||
import {
|
import { act, cleanup, fireEvent, render, type RenderResult, screen, waitFor } from "jest-matrix-react";
|
||||||
act,
|
|
||||||
cleanup,
|
|
||||||
fireEvent,
|
|
||||||
render,
|
|
||||||
type RenderResult,
|
|
||||||
screen,
|
|
||||||
waitFor,
|
|
||||||
waitForElementToBeRemoved,
|
|
||||||
} from "jest-matrix-react";
|
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -872,12 +863,13 @@ describe("RoomView", () => {
|
|||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(container.querySelector(".mx_RoomView_searchResultsPanel")).toBeVisible();
|
expect(container.querySelector(".mx_RoomView_searchResultsPanel")).toBeVisible();
|
||||||
});
|
});
|
||||||
const prom = waitForElementToBeRemoved(() => container.querySelector(".mx_RoomView_searchResultsPanel"));
|
|
||||||
|
|
||||||
await userEvent.hover(getByText("search term"));
|
await userEvent.hover(getByText("search term"));
|
||||||
await userEvent.click(await findByLabelText("Edit"));
|
await userEvent.click(await findByLabelText("Edit"));
|
||||||
|
|
||||||
await prom;
|
await waitFor(() => {
|
||||||
|
expect(container.querySelector(".mx_RoomView_searchResultsPanel")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should switch rooms when edit is clicked on a search result for a different room", async () => {
|
it("should switch rooms when edit is clicked on a search result for a different room", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user