[e2e tests] External sites - update /merchant tests, part 2 (#51016)
* Handle error for api.delete( coupons/<id> ) * Choose any product that contains "product" in its name * Expand Pressable test suite * Add changefile(s) from automation for the following project(s): woocommerce * Add missing `throw` error * Make product name more unique with `Date.now()` --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
dcbc4dc588
commit
ccd5669c21
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: update
|
||||||
|
|
||||||
|
Update /merchant tests (second five files), so they are passing against Pressable env.
|
|
@ -16,6 +16,11 @@ config = {
|
||||||
'**/admin-marketing/**/*.spec.js',
|
'**/admin-marketing/**/*.spec.js',
|
||||||
'**/admin-tasks/**/*.spec.js',
|
'**/admin-tasks/**/*.spec.js',
|
||||||
'**/customize-store/**/*.spec.js',
|
'**/customize-store/**/*.spec.js',
|
||||||
|
'**/merchant/create-page.spec.js',
|
||||||
|
'**/merchant/create-post.spec.js',
|
||||||
|
'**/merchant/create-restricted-coupons.spec.js',
|
||||||
|
'**/merchant/create-shipping-classes.spec.js',
|
||||||
|
'**/merchant/create-shipping-zones.spec.js',
|
||||||
'**/merchant/command-palette.spec.js',
|
'**/merchant/command-palette.spec.js',
|
||||||
'**/merchant/create-cart-block.spec.js',
|
'**/merchant/create-cart-block.spec.js',
|
||||||
'**/merchant/create-checkout-block.spec.js',
|
'**/merchant/create-checkout-block.spec.js',
|
||||||
|
|
|
@ -74,15 +74,24 @@ const test = baseTest.extend( {
|
||||||
coupon: async ( { api }, use ) => {
|
coupon: async ( { api }, use ) => {
|
||||||
const coupon = {};
|
const coupon = {};
|
||||||
await use( coupon );
|
await use( coupon );
|
||||||
await api.delete( `coupons/${ coupon.id }`, { force: true } );
|
await api
|
||||||
|
.delete( `coupons/${ coupon.id }`, { force: true } )
|
||||||
|
.then( ( response ) => {
|
||||||
|
console.log( 'Delete successful:', response.data );
|
||||||
|
} )
|
||||||
|
.catch( ( error ) => {
|
||||||
|
console.log( 'Error response data:', error.response.data );
|
||||||
|
throw new Error( error.response.data );
|
||||||
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
product: async ( { api }, use ) => {
|
product: async ( { api }, use ) => {
|
||||||
let product = {};
|
let product = {};
|
||||||
|
const productName = `Product ${ Date.now() }`;
|
||||||
|
|
||||||
await api
|
await api
|
||||||
.post( 'products', {
|
.post( 'products', {
|
||||||
name: 'Product',
|
name: productName,
|
||||||
regular_price: '100',
|
regular_price: '100',
|
||||||
} )
|
} )
|
||||||
.then( ( response ) => {
|
.then( ( response ) => {
|
||||||
|
|
Loading…
Reference in New Issue