Fix flaky filling SKU and verifying CYS footer e2e tests (#49191)

This commit is contained in:
Veljko V 2024-07-08 10:24:02 +02:00 committed by GitHub
parent c763bdf695
commit 05c47d8566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
E2E tests: Fix flaky filling SKU field and CYS footer

View File

@ -147,7 +147,7 @@ test.describe( 'Assembler -> Footers', { tag: '@gutenberg' }, () => {
for ( const footerPicker of footerPickers ) {
await footerPicker.waitFor();
await footerPicker.click();
await footerPicker.click( { delay: 300 } );
const footerPickerClass = await footerPicker
.frameLocator( 'iframe' )
@ -160,6 +160,7 @@ test.describe( 'Assembler -> Footers', { tag: '@gutenberg' }, () => {
`footer div.wc-blocks-footer-pattern`
);
await footerPattern.waitFor();
await expect(
await footerPattern.getAttribute( 'class' )
).toContain( expectedFooterClass );

View File

@ -25,10 +25,20 @@ const test = baseTest.extend( {
},
page: async ( { page, product }, use ) => {
await test.step( 'go to product editor, inventory tab', async () => {
// This wait for response is only to avoid flakiness when filling SKU field
const waitResponse = page.waitForResponse(
( response ) =>
response
.url()
.includes(
'wp-json/wc-admin/options?options=woocommerce_dimension_unit'
) && response.status() === 200
);
await page.goto(
`wp-admin/post.php?post=${ product.id }&action=edit`
);
await page.getByRole( 'tab', { name: 'Inventory' } ).click();
await waitResponse;
} );
await use( page );