From 64658427a0d54890831d31ff773124368b76ecab Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 19 Aug 2022 10:21:53 +0200 Subject: [PATCH] chore: fixing tests by wrapping in act Signed-off-by: blam --- .../TemplateWizardPage/Stepper/Stepper.test.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/scaffolder/src/next/TemplateWizardPage/Stepper/Stepper.test.tsx b/plugins/scaffolder/src/next/TemplateWizardPage/Stepper/Stepper.test.tsx index 2b091883ae..90901f22c5 100644 --- a/plugins/scaffolder/src/next/TemplateWizardPage/Stepper/Stepper.test.tsx +++ b/plugins/scaffolder/src/next/TemplateWizardPage/Stepper/Stepper.test.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { TemplateParameterSchema } from '../../../types'; import { Stepper } from './Stepper'; import { renderInTestApp } from '@backstage/test-utils'; -import { fireEvent } from '@testing-library/react'; +import { act, fireEvent } from '@testing-library/react'; describe('Stepper', () => { it('should render the step titles for each step of the manifest', async () => { @@ -53,7 +53,9 @@ describe('Stepper', () => { expect(getByText('Next')).toBeInTheDocument(); - await fireEvent.click(getByText('Next')); + await act(async () => { + await fireEvent.click(getByText('Next')); + }); expect(getByText('Review')).toBeInTheDocument(); }); @@ -93,9 +95,13 @@ describe('Stepper', () => { target: { value: 'im a test value' }, }); - await fireEvent.click(getByText('Next')); + await act(async () => { + await fireEvent.click(getByText('Next')); + }); - await fireEvent.click(getByText('Back')); + await act(async () => { + await fireEvent.click(getByText('Back')); + }); expect(getByRole('textbox', { name: 'name' })).toHaveValue( 'im a test value',