From 379aa90a06c08b898252c6e19706f6e5f3615550 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Fri, 18 Aug 2023 16:44:55 +0200 Subject: [PATCH 1/2] EditPostPreferencesModal: fix intermittently failing tests --- .../src/components/preferences-modal/test/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/edit-post/src/components/preferences-modal/test/index.js b/packages/edit-post/src/components/preferences-modal/test/index.js index 9a2056f140c23..f12da2c72f1d0 100644 --- a/packages/edit-post/src/components/preferences-modal/test/index.js +++ b/packages/edit-post/src/components/preferences-modal/test/index.js @@ -24,8 +24,12 @@ describe( 'EditPostPreferencesModal', () => { useSelect.mockImplementation( () => [ true, true, false ] ); useViewportMatch.mockImplementation( () => true ); render( ); + await screen.findByRole( 'tab', { + name: 'General', + selected: true, + } ); expect( - await screen.findByRole( 'dialog', { name: 'Preferences' } ) + screen.getByRole( 'dialog', { name: 'Preferences' } ) ).toMatchSnapshot(); } ); it( 'small viewports', async () => { @@ -33,7 +37,7 @@ describe( 'EditPostPreferencesModal', () => { useViewportMatch.mockImplementation( () => false ); render( ); expect( - await screen.findByRole( 'dialog', { name: 'Preferences' } ) + screen.getByRole( 'dialog', { name: 'Preferences' } ) ).toMatchSnapshot(); } ); } ); From bbaf17d4ca4ad551086a2d9fedd394a8e9bd27ca Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Fri, 18 Aug 2023 16:59:24 +0200 Subject: [PATCH 2/2] Remove async --- .../edit-post/src/components/preferences-modal/test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-post/src/components/preferences-modal/test/index.js b/packages/edit-post/src/components/preferences-modal/test/index.js index f12da2c72f1d0..cc88386ff0d52 100644 --- a/packages/edit-post/src/components/preferences-modal/test/index.js +++ b/packages/edit-post/src/components/preferences-modal/test/index.js @@ -32,7 +32,7 @@ describe( 'EditPostPreferencesModal', () => { screen.getByRole( 'dialog', { name: 'Preferences' } ) ).toMatchSnapshot(); } ); - it( 'small viewports', async () => { + it( 'small viewports', () => { useSelect.mockImplementation( () => [ true, true, false ] ); useViewportMatch.mockImplementation( () => false ); render( );