From 0982cbe8db4a4f12c150663f5263df7a9efca3e2 Mon Sep 17 00:00:00 2001 From: regexowl Date: Tue, 16 Jan 2024 14:32:02 +0100 Subject: [PATCH] test: Update tests After bumping redux from 4.2.1 to 5.0.1 and @reduxjs/toolkit from 1.9.5 to 2.0.1 some tests started to fail. Added async logic solves the issue. --- .../CreateImageWizard/CreateImageWizard.azure.test.js | 8 ++++---- .../CreateImageWizard/CreateImageWizard.content.test.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/Components/CreateImageWizard/CreateImageWizard.azure.test.js b/src/test/Components/CreateImageWizard/CreateImageWizard.azure.test.js index e53d775f..6fedea2b 100644 --- a/src/test/Components/CreateImageWizard/CreateImageWizard.azure.test.js +++ b/src/test/Components/CreateImageWizard/CreateImageWizard.azure.test.js @@ -183,8 +183,8 @@ describe('Step Upload to Azure', () => { }) ); // wait for fetching the upload info - expect(await screen.findByTestId('azure-tenant-id-source')).not.toHaveValue( - '' + await waitFor(() => + expect(screen.getByTestId('azure-tenant-id-source')).not.toHaveValue('') ); await user.click( @@ -212,8 +212,8 @@ describe('Step Upload to Azure', () => { name: /azureSource1/i, }) ); - expect(await screen.findByTestId('azure-tenant-id-source')).not.toHaveValue( - '' + await waitFor(() => + expect(screen.getByTestId('azure-tenant-id-source')).not.toHaveValue('') ); await user.click(sourceDropdown); diff --git a/src/test/Components/CreateImageWizard/CreateImageWizard.content.test.js b/src/test/Components/CreateImageWizard/CreateImageWizard.content.test.js index f10a3352..3039e2e9 100644 --- a/src/test/Components/CreateImageWizard/CreateImageWizard.content.test.js +++ b/src/test/Components/CreateImageWizard/CreateImageWizard.content.test.js @@ -866,13 +866,13 @@ describe('Step Custom repositories', () => { expect(firstRepoCheckbox.checked).toEqual(false); await user.click(firstRepoCheckbox); - expect(firstRepoCheckbox.checked).toEqual(true); + await waitFor(() => expect(firstRepoCheckbox.checked).toEqual(true)); await clickNext(); - clickBack(); + await clickBack(); firstRepoCheckbox = await getFirstRepoCheckbox(); - expect(firstRepoCheckbox.checked).toEqual(true); + await waitFor(() => expect(firstRepoCheckbox.checked).toEqual(true)); }); test('correct number of repositories is fetched', async () => { @@ -1079,7 +1079,7 @@ describe('On Recreate', () => { const availableRepoCheckbox = await screen.findByRole('checkbox', { name: /select row 0/i, }); - expect(availableRepoCheckbox).toBeEnabled(); + await waitFor(() => expect(availableRepoCheckbox).toBeEnabled()); }); test('with repositories that are no longer available', async () => {