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:
parent
7193d4c695
commit
374cee9080
8 changed files with 36 additions and 27 deletions
|
@ -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", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue