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

Commit deb34db

Browse files
dinhtungduopr
authored andcommitted
Fix failed E2E tests related to attribute filter block (#7472)
1 parent 51c64e1 commit deb34db

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

tests/e2e/specs/backend/attribute-filter.test.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,26 @@ describe( `${ block.name } Block`, () => {
2323
await switchUserToAdmin();
2424
await visitBlockPage( `${ block.name } Block` );
2525

26+
await page.waitForSelector( 'span.woocommerce-search-list__item-name' );
27+
2628
// eslint-disable-next-line jest/no-standalone-expect
2729
await expect( page ).toClick(
2830
'span.woocommerce-search-list__item-name',
2931
{ text: 'Capacity' }
3032
);
31-
//needed for attributes list to load correctly
32-
await page.waitForTimeout( 1000 );
3333

3434
// eslint-disable-next-line jest/no-standalone-expect
35-
await expect( page ).toClick( 'button', { text: 'Done' } );
35+
await expect( page ).toClick(
36+
'span.woocommerce-search-list__item-name',
37+
{ text: 'Capacity' }
38+
);
39+
40+
// eslint-disable-next-line jest/no-standalone-expect
41+
await expect( page ).toClick(
42+
'.wp-block-woocommerce-attribute-filter button',
43+
{ text: 'Done' }
44+
);
45+
await page.waitForTimeout( 30000 );
3646
await page.waitForNetworkIdle();
3747
} );
3848

tests/e2e/specs/shopper/filter-products-by-attribute.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ describe( `${ block.name } Block`, () => {
6767

6868
await insertBlock( 'All Products' );
6969
await insertBlock( block.name );
70-
await page.click( selectors.editor.firstAttributeInTheList );
71-
await page.click( selectors.editor.doneButton );
70+
const canvasEl = canvas();
71+
72+
// It seems that .click doesn't work well with radio input element.
73+
await canvasEl.$eval(
74+
block.selectors.editor.firstAttributeInTheList,
75+
( el ) => ( el as HTMLInputElement ).click()
76+
);
77+
await canvasEl.click( selectors.editor.doneButton );
7278
await publishPost();
7379

7480
const link = await page.evaluate( () =>

0 commit comments

Comments
 (0)