From ccd5669c2175586cefea83e6d0f4eddd363947c3 Mon Sep 17 00:00:00 2001 From: Ivan Stojadinov Date: Thu, 5 Sep 2024 10:56:48 +0200 Subject: [PATCH] [e2e tests] External sites - update /merchant tests, part 2 (#51016) * Handle error for api.delete( coupons/ ) * 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 --- ...016-e2e-external-sites-update-merchant-tests-pt2 | 4 ++++ .../envs/default-pressable/playwright.config.js | 5 +++++ .../merchant/create-restricted-coupons.spec.js | 13 +++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 plugins/woocommerce/changelog/51016-e2e-external-sites-update-merchant-tests-pt2 diff --git a/plugins/woocommerce/changelog/51016-e2e-external-sites-update-merchant-tests-pt2 b/plugins/woocommerce/changelog/51016-e2e-external-sites-update-merchant-tests-pt2 new file mode 100644 index 00000000000..23131053e0c --- /dev/null +++ b/plugins/woocommerce/changelog/51016-e2e-external-sites-update-merchant-tests-pt2 @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Update /merchant tests (second five files), so they are passing against Pressable env. \ No newline at end of file diff --git a/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js b/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js index 48f83f3e12b..058ae9aef7f 100644 --- a/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js +++ b/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js @@ -16,6 +16,11 @@ config = { '**/admin-marketing/**/*.spec.js', '**/admin-tasks/**/*.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/create-cart-block.spec.js', '**/merchant/create-checkout-block.spec.js', diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-restricted-coupons.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-restricted-coupons.spec.js index dd6941c6cc9..73ee10db158 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-restricted-coupons.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-restricted-coupons.spec.js @@ -74,15 +74,24 @@ const test = baseTest.extend( { coupon: async ( { api }, use ) => { const 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 ) => { let product = {}; + const productName = `Product ${ Date.now() }`; await api .post( 'products', { - name: 'Product', + name: productName, regular_price: '100', } ) .then( ( response ) => {