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