diff --git a/plugins/woocommerce/changelog/51014-e2e-external-sites-update-merchant-tests-pt1 b/plugins/woocommerce/changelog/51014-e2e-external-sites-update-merchant-tests-pt1 new file mode 100644 index 00000000000..180673a625b --- /dev/null +++ b/plugins/woocommerce/changelog/51014-e2e-external-sites-update-merchant-tests-pt1 @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Update /merchant tests (first 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 988e4d3bbea..b0747f37c30 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/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', ], grepInvert: /@skip-on-default-pressable/, }, diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js index b262e740846..1f612946ce5 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js @@ -5,6 +5,7 @@ const { insertBlock, transformIntoBlocks, publishPage, + closeChoosePatternModal, } = require( '../../utils/editor' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); @@ -23,6 +24,8 @@ test.describe( } ) => { await goToPageEditor( { page } ); + await closeChoosePatternModal( { page } ); + await fillPageTitle( page, testPage.title ); const wordPressVersion = await getInstalledWordPressVersion(); await insertBlock( page, 'Classic Cart', wordPressVersion ); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js index 23317b1a834..53479325a1b 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js @@ -7,6 +7,7 @@ const { transformIntoBlocks, publishPage, openEditorSettings, + closeChoosePatternModal, } = require( '../../utils/editor' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); @@ -74,6 +75,8 @@ test.describe( } ) => { await goToPageEditor( { page } ); + await closeChoosePatternModal( { page } ); + await fillPageTitle( page, testPage.title ); const wordPressVersion = await getInstalledWordPressVersion(); await insertBlock( page, 'Classic Checkout', wordPressVersion ); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js index 2630674a42b..785f5c0d6b3 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js @@ -35,7 +35,15 @@ 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 ); + } ); }, } ); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-order.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-order.spec.js index aa33c49f167..087e95556b7 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-order.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-order.spec.js @@ -299,10 +299,17 @@ test.describe( await page .getByRole( 'textbox', { name: 'Postcode' } ) .fill( '12345' ); - await page - .getByRole( 'textbox', { name: 'Select an option…' } ) - .click(); - await page.getByRole( 'option', { name: 'Florida' } ).click(); + // eslint-disable-next-line playwright/no-conditional-in-test + if ( + await page + .getByRole( 'textbox', { name: 'Select an option…' } ) + .isVisible() + ) { + await page + .getByRole( 'textbox', { name: 'Select an option…' } ) + .click(); + await page.getByRole( 'option', { name: 'Florida' } ).click(); + } await page .getByRole( 'textbox', { name: 'Email address' } ) .fill( 'elbarto@example.com' );