Fix flaky Attributes and Variations E2E tests (#47471)
* Wait for attributes until request is complete * Wait for response * Add changelog
This commit is contained in:
parent
32d10eacf8
commit
2575d455f7
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: fix
|
||||
|
||||
Fix flaky Attributes and Variations E2E tests #47471
|
|
@ -209,8 +209,19 @@ test.describe( 'Variations tab', () => {
|
|||
} )
|
||||
.click();
|
||||
|
||||
const getVariationsResponsePromise = page.waitForResponse(
|
||||
( response ) =>
|
||||
response
|
||||
.url()
|
||||
.includes(
|
||||
`/wp-json/wc/v3/products/${ productId_editVariations }/variations`
|
||||
) && response.status() === 200
|
||||
);
|
||||
|
||||
await clickOnTab( 'Variations', page );
|
||||
|
||||
await getVariationsResponsePromise;
|
||||
|
||||
await page
|
||||
.locator( '.woocommerce-product-variations__table-body > div' )
|
||||
.first()
|
||||
|
@ -267,8 +278,19 @@ test.describe( 'Variations tab', () => {
|
|||
`/wp-admin/admin.php?page=wc-admin&path=/product/${ productId_deleteVariations }`
|
||||
);
|
||||
|
||||
const getVariationsResponsePromise = page.waitForResponse(
|
||||
( response ) =>
|
||||
response
|
||||
.url()
|
||||
.includes(
|
||||
`/wp-json/wc/v3/products/${ productId_deleteVariations }/variations`
|
||||
) && response.status() === 200
|
||||
);
|
||||
|
||||
await clickOnTab( 'Variations', page );
|
||||
|
||||
await getVariationsResponsePromise;
|
||||
|
||||
await page
|
||||
.locator(
|
||||
'.woocommerce-variations-table-error-or-empty-state__actions'
|
||||
|
|
|
@ -210,7 +210,13 @@ test.skip( 'can add existing attributes', async ( {
|
|||
} ) => {
|
||||
await test.step( 'go to product editor, Organization tab', async () => {
|
||||
await page.goto( `wp-admin/post.php?post=${ product.id }&action=edit` );
|
||||
const getAttributesResponsePromise = page.waitForResponse(
|
||||
( response ) =>
|
||||
response.url().includes( '/terms?attribute_id=' ) &&
|
||||
response.status() === 200
|
||||
);
|
||||
await page.getByRole( 'button', { name: 'Organization' } ).click();
|
||||
await getAttributesResponsePromise;
|
||||
} );
|
||||
|
||||
await test.step( 'add an existing attribute', async () => {
|
||||
|
@ -382,7 +388,13 @@ test( 'can remove product attributes', async ( {
|
|||
await page.goto(
|
||||
`wp-admin/post.php?post=${ productWithAttributes.id }&action=edit`
|
||||
);
|
||||
const getAttributesResponsePromise = page.waitForResponse(
|
||||
( response ) =>
|
||||
response.url().includes( '/terms?attribute_id=' ) &&
|
||||
response.status() === 200
|
||||
);
|
||||
await page.getByRole( 'button', { name: 'Organization' } ).click();
|
||||
await getAttributesResponsePromise;
|
||||
} );
|
||||
|
||||
const attributeItemLocator = page.getByRole( 'listitem' ).filter( {
|
||||
|
|
Loading…
Reference in New Issue