diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js index 289339801b5290364df911cc9ba136b94cca2e0b..7e47597f9a485aa44417235061b1b5bb50e94039 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/test.helper.js @@ -1,5 +1,5 @@ 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"; const TIMEOUT = 300 @@ -12,6 +12,7 @@ export async function clickItem(item, 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)); let items = []