From d98dd02fa353c4d1d333031627ac93129917fe31 Mon Sep 17 00:00:00 2001 From: regexowl Date: Mon, 19 May 2025 14:01:20 +0200 Subject: [PATCH] test: Update tests --- .../Blueprints/ImportBlueprintModal.test.tsx | 14 +++++++------- .../steps/Details/Details.test.tsx | 4 ---- .../steps/Snapshot/Snapshot.test.tsx | 2 +- .../steps/TargetEnvironment/AwsTarget.test.tsx | 10 +++++----- .../steps/TargetEnvironment/GCPTarget.test.tsx | 2 -- .../ShareImageModal/ShareImageModal.test.tsx | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx b/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx index b032fb71..cb8a035d 100644 --- a/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx +++ b/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx @@ -305,14 +305,14 @@ describe('Import modal', () => { const reviewButton = await screen.findByRole('button', { name: /review and finish/i, }); - await waitFor(() => expect(reviewButton).toHaveClass('pf-m-disabled')); + await waitFor(() => expect(reviewButton).toBeDisabled()); }; test('should show alert on invalid blueprint', async () => { await setUp(); await uploadFile(`blueprints.json`, INVALID_JSON); const reviewButton = screen.getByTestId('import-blueprint-finish'); - expect(reviewButton).toHaveClass('pf-m-disabled'); + expect(reviewButton).toBeDisabled(); const helperText = await screen.findByText( /not compatible with the blueprints format\./i ); @@ -323,7 +323,7 @@ describe('Import modal', () => { await setUp(); await uploadFile(`blueprints.json`, INVALID_ARCHITECTURE_JSON); const reviewButton = screen.getByTestId('import-blueprint-finish'); - expect(reviewButton).toHaveClass('pf-m-disabled'); + expect(reviewButton).toBeDisabled(); const helperText = await screen.findByText( /not compatible with the blueprints format\./i ); @@ -334,7 +334,7 @@ describe('Import modal', () => { await setUp(); await uploadFile(`blueprints.json`, IGNORE_SUBSCRIPTION_BLUEPRINT); const reviewButton = screen.getByTestId('import-blueprint-finish'); - await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled')); + await waitFor(() => expect(reviewButton).toBeEnabled()); user.click(reviewButton); await waitFor(async () => @@ -348,7 +348,7 @@ describe('Import modal', () => { await setUp(); await uploadFile(`blueprints.json`, BLUEPRINT_JSON); const reviewButton = screen.getByTestId('import-blueprint-finish'); - await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled')); + await waitFor(() => expect(reviewButton).toBeEnabled()); user.click(reviewButton); await waitFor(async () => @@ -369,7 +369,7 @@ describe('Import modal', () => { await setUp(); await uploadFile(`blueprints.toml`, ONPREM_BLUEPRINT_TOML); const reviewButton = screen.getByTestId('import-blueprint-finish'); - await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled')); + await waitFor(() => expect(reviewButton).toBeEnabled()); user.click(reviewButton); await waitFor(async () => @@ -514,7 +514,7 @@ describe('Import modal', () => { ONPREM_BLUEPRINT_TOML_WITH_INVALID_VALUES ); const reviewButton = screen.getByTestId('import-blueprint-finish'); - await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled')); + await waitFor(() => expect(reviewButton).toBeEnabled()); user.click(reviewButton); // Image output diff --git a/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx b/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx index 688284c5..94179205 100644 --- a/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx @@ -105,12 +105,10 @@ describe('Step Details', () => { // enter invalid image name const invalidName = 'a'.repeat(101); await enterBlueprintName(invalidName); - expect(await getNextButton()).toHaveClass('pf-m-disabled'); expect(await getNextButton()).toBeDisabled(); // enter valid image name await enterBlueprintName(); - expect(await getNextButton()).not.toHaveClass('pf-m-disabled'); expect(await getNextButton()).toBeEnabled(); }); @@ -123,12 +121,10 @@ describe('Step Details', () => { // enter invalid image description const invalidDescription = 'a'.repeat(251); await enterBlueprintDescription(invalidDescription); - expect(await getNextButton()).toHaveClass('pf-m-disabled'); expect(await getNextButton()).toBeDisabled(); // enter valid image description await enterBlueprintDescription(); - expect(await getNextButton()).not.toHaveClass('pf-m-disabled'); expect(await getNextButton()).toBeEnabled(); }); diff --git a/src/test/Components/CreateImageWizard/steps/Snapshot/Snapshot.test.tsx b/src/test/Components/CreateImageWizard/steps/Snapshot/Snapshot.test.tsx index f87b8f79..ef5cb0f3 100644 --- a/src/test/Components/CreateImageWizard/steps/Snapshot/Snapshot.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Snapshot/Snapshot.test.tsx @@ -239,7 +239,7 @@ describe('repository snapshot tab - ', () => { name: /select all/i, }); // eslint-disable-next-line testing-library/no-node-access - expect(bulkSelectCheckbox.closest('div')).toHaveClass('pf-m-disabled'); + expect(bulkSelectCheckbox.closest('div')).toBeDisabled(); }); test('button Reset works to empty the snapshot date', async () => { diff --git a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AwsTarget.test.tsx b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AwsTarget.test.tsx index d9d0fc8d..a6f1f439 100644 --- a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AwsTarget.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AwsTarget.test.tsx @@ -184,20 +184,20 @@ describe('Step Upload to AWS', () => { await goToAwsStep(); const nextButton = await getNextButton(); - expect(nextButton).toHaveClass('pf-m-disabled'); + expect(nextButton).toBeDisabled(); await chooseManualOption(); - expect(nextButton).toHaveClass('pf-m-disabled'); + expect(nextButton).toBeDisabled(); await enterAccountId(); - expect(nextButton).not.toHaveClass('pf-m-disabled'); + expect(nextButton).toBeEnabled(); await chooseSourcesOption(); - await waitFor(() => expect(nextButton).toHaveClass('pf-m-disabled')); + await waitFor(() => expect(nextButton).toBeDisabled()); await getSourceDropdown(); await selectSource(); - await waitFor(() => expect(nextButton).not.toHaveClass('pf-m-disabled')); + await waitFor(() => expect(nextButton).toBeEnabled()); }); test('compose request share_with_sources field is correct', async () => { diff --git a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/GCPTarget.test.tsx b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/GCPTarget.test.tsx index ceed257b..923a6d77 100644 --- a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/GCPTarget.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/GCPTarget.test.tsx @@ -150,13 +150,11 @@ describe('Step Upload to Google', () => { await waitFor(async () => user.type(await screen.findByTestId('principal'), 'a') ); - expect(await getNextButton()).toHaveClass('pf-m-disabled'); expect(await getNextButton()).toBeDisabled(); await waitFor(async () => user.type(await screen.findByTestId('principal'), 'test@test.com') ); - expect(await getNextButton()).not.toHaveClass('pf-m-disabled'); expect(await getNextButton()).toBeEnabled(); }); diff --git a/src/test/Components/ShareImageModal/ShareImageModal.test.tsx b/src/test/Components/ShareImageModal/ShareImageModal.test.tsx index 738991fa..7b95b5d9 100644 --- a/src/test/Components/ShareImageModal/ShareImageModal.test.tsx +++ b/src/test/Components/ShareImageModal/ShareImageModal.test.tsx @@ -43,7 +43,7 @@ describe('Create Share To Regions Modal', () => { const usEast2 = await screen.findByRole('option', { name: /us east \(ohio\) us-east-2/i, }); - expect(usEast2).not.toHaveClass('pf-m-disabled'); + expect(usEast2).toBeEnabled(); user.click(usEast2); await waitFor(() => expect(shareButton).toBeEnabled());