Skip to content

Commit

Permalink
test: use vi.waitFor by default (#5478)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Makowski <[email protected]>
  • Loading branch information
petermakowski authored Jun 21, 2024
1 parent 64a5a6e commit a9dd8af
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/testing/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ export const expectTooltipOnHover = async (
await userEvent.hover(element.querySelector("i")!);
}

const pass =
screen.getAllByRole("tooltip", { name: tooltipText }).length === 1;
const pass = await vi.waitFor(
() => screen.getAllByRole("tooltip", { name: tooltipText }).length === 1
);

if (pass) {
return {
Expand All @@ -325,5 +326,15 @@ export const renderHookWithMockStore = (hook: Hook) => {
return renderHook(hook, { wrapper: generateWrapper() });
};

export * from "@testing-library/react";
export const waitFor = vi.waitFor;
export {
act,
cleanup,
fireEvent,
getDefaultNormalizer,
screen,
render,
renderHook,
within,
} from "@testing-library/react";
export { default as userEvent } from "@testing-library/user-event";

0 comments on commit a9dd8af

Please sign in to comment.