From 78bb1e118bb752706aab0c3d851c2adf28811f0f Mon Sep 17 00:00:00 2001 From: Gianluca Zuccarelli Date: Wed, 18 Jun 2025 16:51:39 +0100 Subject: [PATCH] multiple: fix act errors in the tests This also helps reduce noise in the test output. --- src/test/Components/Blueprints/Blueprints.test.tsx | 4 +++- .../steps/Registration/Registration.test.tsx | 2 +- src/test/Components/ImagesTable/ImagesTable.test.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/Components/Blueprints/Blueprints.test.tsx b/src/test/Components/Blueprints/Blueprints.test.tsx index fd966fdd..1caa2e1a 100644 --- a/src/test/Components/Blueprints/Blueprints.test.tsx +++ b/src/test/Components/Blueprints/Blueprints.test.tsx @@ -65,7 +65,7 @@ describe('Blueprints', () => { }) ); - const { router } = await renderCustomRoutesWithReduxRouter(); + const view = renderCustomRoutesWithReduxRouter(); await screen.findByText('No blueprints yet'); const emptyStateAction = screen.getByRole('link', { name: /Add blueprint/i, @@ -73,6 +73,8 @@ describe('Blueprints', () => { expect(emptyStateAction).toBeInTheDocument(); user.click(emptyStateAction); + + const { router } = await view; await waitFor(() => expect(router.state.location.pathname).toBe( '/insights/image-builder/imagewizard' diff --git a/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx b/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx index de50c6d6..d818532a 100644 --- a/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx @@ -104,7 +104,7 @@ const addSatelliteRegistrationCommandViaKeyDown = async (command: string) => { await waitFor(() => user.clear(satelliteRegistrationCommand)); await waitFor(() => user.type(satelliteRegistrationCommand, command)); - satelliteRegistrationCommand.blur(); + await waitFor(() => satelliteRegistrationCommand.blur()); }; const uploadFile = async (scriptName: string): Promise => { diff --git a/src/test/Components/ImagesTable/ImagesTable.test.tsx b/src/test/Components/ImagesTable/ImagesTable.test.tsx index 4b15a30e..7ef07ac5 100644 --- a/src/test/Components/ImagesTable/ImagesTable.test.tsx +++ b/src/test/Components/ImagesTable/ImagesTable.test.tsx @@ -15,7 +15,7 @@ describe('Images Table', () => { const user = userEvent.setup(); test('render ImagesTable', async () => { - await renderCustomRoutesWithReduxRouter(); + renderCustomRoutesWithReduxRouter(); const table = await screen.findByTestId('images-table');