Fix some e2e tests for linked products (#46506)

* Fix some e2e tests for linked products

* Add changelog
This commit is contained in:
Fernando Marichal 2024-04-15 10:59:30 -03:00 committed by GitHub
parent 0704db9af9
commit a32433ce1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 12 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Fix some e2e tests for linked product #46506

View File

@ -63,11 +63,11 @@ test.describe( 'General tab', () => {
await clickOnTab( 'Linked products', page );
await page
.getByRole( 'heading', {
await expect(
page.getByRole( 'heading', {
name: 'Cross-sells',
} )
.isVisible();
).toBeVisible();
await page
.locator(
@ -79,9 +79,7 @@ test.describe( 'General tab', () => {
await page.getByText( linkedProductsData[ 0 ].name ).click();
await page.getByText( 'Choose products for me' ).first().click();
await page.waitForResponse(
const chooseProductsResponsePromise = page.waitForResponse(
( response ) =>
response
.url()
@ -90,6 +88,9 @@ test.describe( 'General tab', () => {
) && response.status() === 200
);
await page.getByText( 'Choose products for me' ).first().click();
await chooseProductsResponsePromise;
await expect(
page.getByRole( 'row', { name: 'Product name' } )
).toHaveCount( 4 );
@ -98,9 +99,7 @@ test.describe( 'General tab', () => {
'div.woocommerce-product-list div[role="table"] div[role="rowgroup"] div[role="row"]'
);
const upsellsRowsCount = await upsellsRows.count();
await expect( upsellsRowsCount ).toBe( 4 );
await expect( upsellsRows ).toHaveCount( 4 );
await page
.locator(
@ -154,9 +153,7 @@ test.describe( 'General tab', () => {
'section.upsells.products ul > li'
);
const productsCount = await productsList.count();
await expect( productsCount ).toBe( 4 );
await expect( productsList ).toHaveCount( 4 );
} );
} );
} );