Upgrade @testing-library/user-event to v14 (#47898)

* Update dependency @testing-library/user-event to v14

* everything is async...

* everything is async pt.2

* Fix cascader tests

* hack the yarn.lock file to remove the old version of @testing-library/dom

* some more fixes!

* MOAR FIXES

* more fixes

* remove a bunch of places where we're wrapping in act()

* down to 7 failing tests...

* Fix arrow tests

* Fix rest of NavBarItem tests

* Fix last tests

* Use {Enter} instead of {enter}

* Revert "Use {Enter} instead of {enter}"

This reverts commit e72453bb522245cbc2acd0736929fbb351ad070a.

* remove some unused act imports

* Fix LibraryPanelsSearch tests

* more stable test

* More consistent test...

Co-authored-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
Ashley Harrison
2022-04-21 13:15:21 +01:00
committed by GitHub
parent 9ed7e48454
commit d832bde270
89 changed files with 900 additions and 912 deletions

View File

@ -60,10 +60,10 @@ describe('Signup Page', () => {
fireEvent.click(screen.getByRole('button', { name: 'Submit' }));
expect(await screen.findByText('Email is required')).toBeInTheDocument();
userEvent.type(screen.getByRole('textbox', { name: 'Email' }), 'test');
await userEvent.type(screen.getByRole('textbox', { name: 'Email' }), 'test');
await waitFor(() => expect(screen.queryByText('Email is invalid')).toBeInTheDocument());
userEvent.type(screen.getByRole('textbox', { name: 'Email' }), 'test@gmail.com');
await userEvent.type(screen.getByRole('textbox', { name: 'Email' }), 'test@gmail.com');
await waitFor(() => expect(screen.queryByText('Email is invalid')).not.toBeInTheDocument());
});
it('should pass validation checks for password and confirm password field', async () => {
@ -73,11 +73,11 @@ describe('Signup Page', () => {
expect(await screen.findByText('Password is required')).toBeInTheDocument();
expect(await screen.findByText('Confirmed password is required')).toBeInTheDocument();
userEvent.type(screen.getByLabelText('Password'), 'admin');
userEvent.type(screen.getByLabelText('Confirm password'), 'a');
await userEvent.type(screen.getByLabelText('Password'), 'admin');
await userEvent.type(screen.getByLabelText('Confirm password'), 'a');
await waitFor(() => expect(screen.queryByText('Passwords must match!')).toBeInTheDocument());
userEvent.type(screen.getByLabelText('Confirm password'), 'dmin');
await userEvent.type(screen.getByLabelText('Confirm password'), 'dmin');
await waitFor(() => expect(screen.queryByText('Passwords must match!')).not.toBeInTheDocument());
});
it('should navigate to default url if signup is successful', async () => {
@ -89,10 +89,10 @@ describe('Signup Page', () => {
postMock.mockResolvedValueOnce({ message: 'Logged in' });
render(<SignupPage {...props} />);
userEvent.type(screen.getByRole('textbox', { name: 'Your name' }), 'test-user');
userEvent.type(screen.getByRole('textbox', { name: 'Email' }), 'test@gmail.com');
userEvent.type(screen.getByLabelText('Password'), 'admin');
userEvent.type(screen.getByLabelText('Confirm password'), 'admin');
await userEvent.type(screen.getByRole('textbox', { name: 'Your name' }), 'test-user');
await userEvent.type(screen.getByRole('textbox', { name: 'Email' }), 'test@gmail.com');
await userEvent.type(screen.getByLabelText('Password'), 'admin');
await userEvent.type(screen.getByLabelText('Confirm password'), 'admin');
fireEvent.click(screen.getByRole('button', { name: 'Submit' }));
await waitFor(() =>