You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-06 10:22:45 +03:00
Fix flaky jest tests (#12486)
...and remove the code that causes them to be retried in CI. Most of these were just lack of waiting for async things to happen, mostly lazy loading components, hence whythey worked on the retry: because the code had been loaded by then.
This commit is contained in:
@@ -15,7 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { render, screen, waitFor } from "@testing-library/react";
|
||||
|
||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||
import RoomContext from "../../../../src/contexts/RoomContext";
|
||||
@@ -82,7 +82,7 @@ describe("MessageComposerButtons", () => {
|
||||
expect(getButtonLabels()).toEqual(["Emoji", "Attachment", "More options"]);
|
||||
});
|
||||
|
||||
it("Renders other buttons in menu in wide mode", () => {
|
||||
it("Renders other buttons in menu in wide mode", async () => {
|
||||
wrapAndRender(
|
||||
<MessageComposerButtons
|
||||
{...mockProps}
|
||||
@@ -94,12 +94,16 @@ describe("MessageComposerButtons", () => {
|
||||
false,
|
||||
);
|
||||
|
||||
expect(getButtonLabels()).toEqual([
|
||||
"Emoji",
|
||||
"Attachment",
|
||||
"More options",
|
||||
["Sticker", "Voice Message", "Poll", "Location"],
|
||||
]);
|
||||
// The location code is lazy loaded, so the button will take a little while
|
||||
// to appear, so we need to wait.
|
||||
await waitFor(() => {
|
||||
expect(getButtonLabels()).toEqual([
|
||||
"Emoji",
|
||||
"Attachment",
|
||||
"More options",
|
||||
["Sticker", "Voice Message", "Poll", "Location"],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
it("Renders only some buttons in narrow mode", () => {
|
||||
|
Reference in New Issue
Block a user