Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Fix: Attribute filter flaky test (#6862)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhtungdu authored Aug 9, 2022
1 parent 9568e09 commit b61566a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/e2e/specs/shopper/filter-products-by-attribute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -119,14 +121,17 @@ describe( `${ block.name } Block`, () => {
);
await canvasEl.click( selectors.editor.doneButton );
await saveTemplate();
await goToShopPage();
} );

afterAll( async () => {
await deleteAllTemplates( 'wp_template' );
await deleteAllTemplates( 'wp_template_part' );
} );

beforeEach( async () => {
await goToShopPage();
} );

it( 'should render', async () => {
const products = await page.$$(
selectors.frontend.classicProductsList
Expand All @@ -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 ),
Expand Down

0 comments on commit b61566a

Please sign in to comment.