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

Fix: Attribute filter flaky test #6862

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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