diff --git a/src/pages/ImportPage.test.jsx b/src/pages/ImportPage.test.jsx index b0e8755..8d8199c 100644 --- a/src/pages/ImportPage.test.jsx +++ b/src/pages/ImportPage.test.jsx @@ -171,7 +171,8 @@ describe('ImportPage', () => { expect(await screen.findByText('IMPORT.STORE_READ:2')).toBeTruthy(); expect(screen.getByText('Pokémon Scarlet · Switch')).toBeTruthy(); - expect(screen.getByLabelText('url').textContent).toBe('/import'); + // The router takes the new URL in a later render than the rows. + await waitFor(() => expect(screen.getByLabelText('url').textContent).toBe('/import')); fireEvent.click(screen.getByRole('button', {name: 'IMPORT.START'})); await screen.findByText('IMPORT.MATCHING'); @@ -185,7 +186,7 @@ describe('ImportPage', () => { renderPage({'GET ': json(200, {imports: []})}, '/import#data=broken'); await waitFor(() => expect(toast.error).toHaveBeenCalledWith('IMPORT.STORE_LIST_BROKEN')); - expect(screen.getByLabelText('url').textContent).toBe('/import'); + await waitFor(() => expect(screen.getByLabelText('url').textContent).toBe('/import')); expect(await screen.findByLabelText('IMPORT.TEXT_LABEL')).toBeTruthy(); });