From 81bda493393446f87147b61d434d0a7fcf78e190 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Fri, 5 Aug 2022 18:36:38 +0700 Subject: [PATCH 1/2] fix attribute filter flaky test --- tests/e2e/specs/shopper/filter-products-by-attribute.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts b/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts index 0359b790ee6..02c5003b113 100644 --- a/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts +++ b/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 ); @@ -145,6 +147,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 ), From ca3bc704f016085b566b1961907d950f31478486 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Fri, 5 Aug 2022 22:44:16 +0700 Subject: [PATCH 2/2] e2e: attribute filter: go to shop page before each test --- tests/e2e/specs/shopper/filter-products-by-attribute.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts b/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts index 02c5003b113..2154af8a43c 100644 --- a/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts +++ b/tests/e2e/specs/shopper/filter-products-by-attribute.test.ts @@ -121,7 +121,6 @@ describe( `${ block.name } Block`, () => { ); await canvasEl.click( selectors.editor.doneButton ); await saveTemplate(); - await goToShopPage(); } ); afterAll( async () => { @@ -129,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