mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 12:13:52 +00:00
fix: flaky unit test
This commit is contained in:
parent
daac815e03
commit
4b88793037
@ -1,5 +1,5 @@
|
||||
import { unstable_useDocument } from '@strapi/content-manager/strapi-admin';
|
||||
import { render as renderRTL, waitFor, server } from '@tests/utils';
|
||||
import { act, render as renderRTL, waitFor, server } from '@tests/utils';
|
||||
import { rest } from 'msw';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
|
||||
@ -40,6 +40,7 @@ describe('AssigneeSelect', () => {
|
||||
await waitFor(() => expect(queryByText('John Doe')).not.toBeInTheDocument());
|
||||
|
||||
await user.click(getByRole('combobox'));
|
||||
|
||||
await waitFor(() => expect(queryByText('Loading content...')).not.toBeInTheDocument());
|
||||
|
||||
await findByText('John Doe');
|
||||
@ -133,9 +134,15 @@ describe('AssigneeSelect', () => {
|
||||
|
||||
const { getByRole, getByText, queryByText, user, findByText } = render();
|
||||
|
||||
await user.click(getByRole('combobox'));
|
||||
await act(async () => {
|
||||
await user.click(getByRole('combobox'));
|
||||
});
|
||||
|
||||
await waitFor(() => expect(queryByText('Loading content...')).not.toBeInTheDocument());
|
||||
await user.click(getByText('John Doe'));
|
||||
|
||||
await act(async () => {
|
||||
await user.click(getByText('John Doe'));
|
||||
});
|
||||
|
||||
await findByText('Server side error message');
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user