[e2e] External - Expand WPCOM suite, part 2 (#51414)

* Add /merchant tests to the WPCOM suite

* Skip "can manually add a variation" on WPCOM

* Skip "Coupon management" - API returns 500 on delete

* Resolve `wp-block-woocommerce-checkout-order-summary-block` on the first element

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ivan Stojadinov 2024-09-17 10:43:43 +02:00 committed by GitHub
parent 861bc091d4
commit acc313a9b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 215 additions and 181 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Expand the e2e suite we're running on WPCOM part #2.

View File

@ -15,6 +15,14 @@ config = {
'**/admin-tasks/**/*.spec.js',
'**/shopper/**/*.spec.js',
'**/api-tests/**/*.test.js',
'**/merchant/products/add-variable-product/**/*.spec.js',
'**/merchant/command-palette.spec.js',
'**/merchant/create-cart-block.spec.js',
'**/merchant/create-checkout-block.spec.js',
'**/merchant/create-coupon.spec.js',
'**/merchant/create-order.spec.js',
'**/merchant/create-page.spec.js',
'**/merchant/create-post.spec.js',
],
grepInvert: /@skip-on-default-wpcom/,
},

View File

@ -149,9 +149,11 @@ test.describe(
.locator( 'legend' )
).toBeVisible();
await expect(
page.locator(
page
.locator(
'.wp-block-woocommerce-checkout-order-summary-block'
)
.first()
).toBeVisible();
await expect(
page.locator( '.wc-block-components-address-form' ).first()

View File

@ -39,7 +39,10 @@ const test = baseTest.extend( {
},
} );
test.describe( 'Coupon management', { tag: '@services' }, () => {
test.describe(
'Coupon management',
{ tag: [ '@services', '@skip-on-default-wpcom' ] },
() => {
for ( const couponType of Object.keys( couponData ) ) {
test( `can create new ${ couponType } coupon`, async ( {
page,
@ -70,7 +73,9 @@ test.describe( 'Coupon management', { tag: '@services' }, () => {
if ( couponData[ couponType ].freeShipping ) {
await page.getByLabel( 'Allow free shipping' ).check();
} else {
await page.getByLabel( 'Allow free shipping' ).uncheck();
await page
.getByLabel( 'Allow free shipping' )
.uncheck();
}
} );
@ -91,7 +96,9 @@ test.describe( 'Coupon management', { tag: '@services' }, () => {
// verify the creation of the coupon and details
await test.step( 'verify coupon creation', async () => {
await page.goto( 'wp-admin/edit.php?post_type=shop_coupon' );
await page.goto(
'wp-admin/edit.php?post_type=shop_coupon'
);
await expect(
page.getByRole( 'cell', {
name: couponData[ couponType ].code,
@ -137,4 +144,5 @@ test.describe( 'Coupon management', { tag: '@services' }, () => {
}
} );
}
} );
}
);

View File

@ -84,7 +84,10 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
}
} );
test( 'can manually add a variation', async ( { page } ) => {
test(
'can manually add a variation',
{ tag: '@skip-on-default-wpcom' },
async ( { page } ) => {
await test.step( `Open "Edit product" page of product id ${ productId_addManually }`, async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_addManually }&action=edit`
@ -98,12 +101,14 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
window
.jQuery( '#variable_product_options' )
.on( 'woocommerce_variations_added', ( event, data ) => {
window.woocommerceVariationsAddedFunctionCalls.push( [
event,
data,
] );
} );
.on(
'woocommerce_variations_added',
( event, data ) => {
window.woocommerceVariationsAddedFunctionCalls.push(
[ event, data ]
);
}
);
} );
} );
@ -112,7 +117,9 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} );
await test.step( `Manually add ${ variationsToManuallyCreate.length } variations`, async () => {
const variationRows = page.locator( '.woocommerce_variation h3' );
const variationRows = page.locator(
'.woocommerce_variation h3'
);
let variationRowsCount = await variationRows.count();
const originalVariationRowsCount = variationRowsCount;
@ -131,7 +138,8 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
// verify that the woocommerce_variations_added jQuery trigger was fired
const woocommerceVariationsAddedFunctionCalls =
await page.evaluate(
() => window.woocommerceVariationsAddedFunctionCalls
() =>
window.woocommerceVariationsAddedFunctionCalls
);
expect(
woocommerceVariationsAddedFunctionCalls.length
@ -142,7 +150,8 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
for ( const attributeValue of variationToCreate ) {
const attributeName = productAttributes.find(
( { options } ) => options.includes( attributeValue )
( { options } ) =>
options.includes( attributeValue )
).name;
const addAttributeMenu = variationRows
.nth( 0 )
@ -153,7 +162,9 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} );
await test.step( `Select "${ attributeValue }" from the "${ attributeName }" attribute menu`, async () => {
await addAttributeMenu.selectOption( attributeValue );
await addAttributeMenu.selectOption(
attributeValue
);
} );
}
@ -184,5 +195,6 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} );
}
} );
} );
}
);
} );