Skip to content
Snippets Groups Projects
Commit 8e0bad23 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

wait for Item to be in the document

parent 97db1291
No related branches found
No related tags found
1 merge request!1182This Fixes allmost all Scheduling unit tests
import {act} from "react-dom/test-utils"; import {act} from "react-dom/test-utils";
import {fireEvent, render, screen} from "@testing-library/react"; import {fireEvent, render, screen,waitFor} from "@testing-library/react";
import {BrowserRouter as Router} from "react-router-dom"; import {BrowserRouter as Router} from "react-router-dom";
const TIMEOUT = 300 const TIMEOUT = 300
...@@ -12,6 +12,7 @@ export async function clickItem(item, timeout = TIMEOUT) { ...@@ -12,6 +12,7 @@ export async function clickItem(item, timeout = TIMEOUT) {
} }
export async function setMultiSelectValue(pageContent, multiSelectTestId, multiSelectValue, timeout = TIMEOUT) { export async function setMultiSelectValue(pageContent, multiSelectTestId, multiSelectValue, timeout = TIMEOUT) {
await waitFor(() => expect(pageContent.queryByTestId(multiSelectTestId)).toBeInTheDocument()); // give rendering the time to have it.
await clickItem(pageContent.queryByTestId(multiSelectTestId)); await clickItem(pageContent.queryByTestId(multiSelectTestId));
let items = [] let items = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment