diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts index 0359b790ee6..2154af8a43c 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts +++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts @@ -87,6 +87,8 @@ describe( `${ block.name } Block`, () => { it( 'should show only products that match the filter', async () => { const isRefreshed = jest.fn( () => void 0 ); page.on( 'load', isRefreshed ); + + await page.waitForSelector( selectors.frontend.filter ); await page.click( selectors.frontend.filter ); await waitForAllProductsBlockLoaded(); const products = await page.$$( selectors.frontend.productsList ); @@ -119,7 +121,6 @@ describe( `${ block.name } Block`, () => { ); await canvasEl.click( selectors.editor.doneButton ); await saveTemplate(); - await goToShopPage(); } ); afterAll( async () => { @@ -127,6 +128,10 @@ describe( `${ block.name } Block`, () => { await deleteAllTemplates( 'wp_template_part' ); } ); + beforeEach( async () => { + await goToShopPage(); + } ); + it( 'should render', async () => { const products = await page.$$( selectors.frontend.classicProductsList @@ -145,6 +150,8 @@ describe( `${ block.name } Block`, () => { expect( isRefreshed ).not.toBeCalled(); + await page.waitForSelector( selectors.frontend.filter ); + await Promise.all( [ page.waitForNavigation(), page.click( selectors.frontend.filter ),