diff --git a/tests/qa/resources/merchants.ts b/tests/qa/resources/merchants.ts index 788760683..2fbf9a1aa 100644 --- a/tests/qa/resources/merchants.ts +++ b/tests/qa/resources/merchants.ts @@ -12,6 +12,7 @@ const invalid: PcpMerchant = { '123EFzI8FCerbL8qvMs0baJiVAqvA4SwXka3WM-WWE-o0c6b2acaGu_Q7a4n1nEGQf2-dnCgtmKLgm0AXmC', account_id: '123MQEBC2LND7J3L', }; + const germany: PcpMerchant = { email: 'sb-vzlb326615278@business.example.com', password: '-*Gv5z#X', @@ -21,6 +22,7 @@ const germany: PcpMerchant = { 'EFzI8FCerbL8qvMs0baJiVAqvA4SwXka3WM-WWE-o0c6b2acaGu_Q7a4n1nEGQf2-dnCgtmKLgm0AXmC', account_id: 'MQEBC2LND7J3L', }; + const usa: PcpMerchant = { email: 'sb-hskbh29881597@business.example.com', password: '', @@ -31,14 +33,6 @@ const usa: PcpMerchant = { account_id: 'RRPUW6YXX22W2', }; -// const usa: PcpMerchant = { -// email: 'sb-1vqws26578261@business.example.com', -// password: 'xc\'#0\'Xf', -// client_id: 'ASld_H2Yc6Fpkh6Q0NZuQvckyAjAfWfm_kW-IpROgYPUhpsAxU6KCYRcEw1sf60n6xULzj4K_n_Jg_Y5', -// client_secret: 'EJ88I1fmwA7QkGvkkuYC4z1_R_M6ZfV511OpRDPI61D6TuAaCm9rULpr-wxqeVTKJfZV1Zzszj9XtDVR', -// account_id: 'QTGBXV4YCQLD6' -// }; - const mexico: PcpMerchant = { email: 'sb-zafdx26915775@business.example.com', password: 'S*j$Sty5', diff --git a/tests/qa/tests/.setup/woocommerce.setup.ts b/tests/qa/tests/.setup/woocommerce.setup.ts index 35c7972bb..bc48b2ba3 100644 --- a/tests/qa/tests/.setup/woocommerce.setup.ts +++ b/tests/qa/tests/.setup/woocommerce.setup.ts @@ -19,167 +19,167 @@ import { */ import { updateDotenv } from '@inpsyde/playwright-utils/build'; -// setup( 'Setup Permalinks', async ( { requestUtils } ) => { -// await requestUtils.setPermalinks( '/%postname%/' ); -// } ); +setup( 'Setup Permalinks', async ( { requestUtils } ) => { + await requestUtils.setPermalinks( '/%postname%/' ); +} ); -// setup( 'Setup Disable Nonce plugin (inactive)', -// async ( { requestUtils, plugins } ) => { -// if ( -// ! ( await requestUtils.isPluginInstalled( -// disableNoncePlugin.slug -// ) ) -// ) { -// await plugins.installPluginFromFile( -// disableNoncePlugin.zipFilePath -// ); -// } -// await requestUtils.activatePlugin( disableNoncePlugin.slug ); -// } -// ); +setup( 'Setup Disable Nonce plugin (inactive)', + async ( { requestUtils, plugins } ) => { + if ( + ! ( await requestUtils.isPluginInstalled( + disableNoncePlugin.slug + ) ) + ) { + await plugins.installPluginFromFile( + disableNoncePlugin.zipFilePath + ); + } + await requestUtils.activatePlugin( disableNoncePlugin.slug ); + } +); -// setup( 'Setup WP Debugging plugin (active)', async ( { requestUtils } ) => { -// if ( -// ! ( await requestUtils.isPluginInstalled( wpDebuggingPlugin.slug ) ) -// ) { -// await requestUtils.installPlugin( wpDebuggingPlugin.slug ); -// } -// await requestUtils.deactivatePlugin( wpDebuggingPlugin.slug ); -// } ); +setup( 'Setup WP Debugging plugin (active)', async ( { requestUtils } ) => { + if ( + ! ( await requestUtils.isPluginInstalled( wpDebuggingPlugin.slug ) ) + ) { + await requestUtils.installPlugin( wpDebuggingPlugin.slug ); + } + await requestUtils.deactivatePlugin( wpDebuggingPlugin.slug ); +} ); -// setup( 'Setup Disable WooCommerce Setup Wizard Plugin (active)', -// async ( { requestUtils, plugins } ) => { -// if ( -// ! ( await requestUtils.isPluginInstalled( -// disableWcSetupWizard.slug -// ) ) -// ) { -// await plugins.installPluginFromFile( -// disableWcSetupWizard.zipFilePath -// ); -// } -// await requestUtils.activatePlugin( disableWcSetupWizard.slug ); -// } -// ); +setup( 'Setup Disable WooCommerce Setup Wizard Plugin (active)', + async ( { requestUtils, plugins } ) => { + if ( + ! ( await requestUtils.isPluginInstalled( + disableWcSetupWizard.slug + ) ) + ) { + await plugins.installPluginFromFile( + disableWcSetupWizard.zipFilePath + ); + } + await requestUtils.activatePlugin( disableWcSetupWizard.slug ); + } +); -// setup( 'Setup WooCommerce plugin (active)', async ( { requestUtils } ) => { -// if ( ! ( await requestUtils.isPluginInstalled( 'woocommerce' ) ) ) { -// await requestUtils.installPlugin( 'woocommerce' ); -// } -// await requestUtils.activatePlugin( 'woocommerce' ); -// } ); +setup( 'Setup WooCommerce plugin (active)', async ( { requestUtils } ) => { + if ( ! ( await requestUtils.isPluginInstalled( 'woocommerce' ) ) ) { + await requestUtils.installPlugin( 'woocommerce' ); + } + await requestUtils.activatePlugin( 'woocommerce' ); +} ); -// setup( 'Setup WC Subscriptions plugin (inactive)', -// async ( { requestUtils, plugins } ) => { -// if ( -// ! ( await requestUtils.isPluginInstalled( -// subscriptionsPlugin.slug -// ) ) -// ) { -// await plugins.installPluginFromFile( -// subscriptionsPlugin.zipFilePath -// ); -// } -// await requestUtils.deactivatePlugin( subscriptionsPlugin.slug ); -// } -// ); +setup( 'Setup WC Subscriptions plugin (inactive)', + async ( { requestUtils, plugins } ) => { + if ( + ! ( await requestUtils.isPluginInstalled( + subscriptionsPlugin.slug + ) ) + ) { + await plugins.installPluginFromFile( + subscriptionsPlugin.zipFilePath + ); + } + await requestUtils.deactivatePlugin( subscriptionsPlugin.slug ); + } +); -// setup( 'Setup theme', async ( { requestUtils } ) => { -// const slug = 'storefront'; -// if ( ! ( await requestUtils.isThemeInstalled( slug ) ) ) { -// await requestUtils.installTheme( slug ); -// } -// await requestUtils.activateTheme( slug ); -// } ); +setup( 'Setup theme', async ( { requestUtils } ) => { + const slug = 'storefront'; + if ( ! ( await requestUtils.isThemeInstalled( slug ) ) ) { + await requestUtils.installTheme( slug ); + } + await requestUtils.activateTheme( slug ); +} ); -// setup( 'Setup WooCommerce Live site visibility', -// async ( { wooCommerceUtils } ) => { -// await wooCommerceUtils.setSiteVisibility(); -// } -// ); +setup( 'Setup WooCommerce Live site visibility', + async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.setSiteVisibility(); + } +); -// setup( 'Setup WooCommerce API keys', async ( { wooCommerceUtils } ) => { -// if ( ! ( await wooCommerceUtils.apiKeysExist() ) ) { -// const apiKeys = await wooCommerceUtils.createApiKeys(); -// if( ! process.env.CI ) { -// await updateDotenv( './.env', apiKeys ); -// } -// for ( const [ key, value ] of Object.entries( apiKeys ) ) { -// process.env[ key ] = value; -// } -// } -// } ); +setup( 'Setup WooCommerce API keys', async ( { wooCommerceUtils } ) => { + if ( ! ( await wooCommerceUtils.apiKeysExist() ) ) { + const apiKeys = await wooCommerceUtils.createApiKeys(); + if( ! process.env.CI ) { + await updateDotenv( './.env', apiKeys ); + } + for ( const [ key, value ] of Object.entries( apiKeys ) ) { + process.env[ key ] = value; + } + } +} ); -// setup( 'Setup Block and Classic pages', async ( { wooCommerceUtils } ) => { -// await wooCommerceUtils.publishBlockCartPage(); -// await wooCommerceUtils.publishBlockCheckoutPage(); -// await wooCommerceUtils.publishClassicCartPage(); -// await wooCommerceUtils.publishClassicCheckoutPage(); -// } ); +setup( 'Setup Block and Classic pages', async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.publishBlockCartPage(); + await wooCommerceUtils.publishBlockCheckoutPage(); + await wooCommerceUtils.publishClassicCartPage(); + await wooCommerceUtils.publishClassicCheckoutPage(); +} ); -// setup( 'Setup WooCommerce email settings', async ( { wooCommerceApi } ) => { -// const disabled = { enabled: 'no' }; -// await wooCommerceApi.updateEmailSubSettings( 'email_new_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_cancelled_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_failed_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_on_hold_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_processing_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_completed_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_refunded_order', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_note', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_reset_password', disabled ); -// await wooCommerceApi.updateEmailSubSettings( 'email_customer_new_account', disabled ); -// } ); +setup( 'Setup WooCommerce email settings', async ( { wooCommerceApi } ) => { + const disabled = { enabled: 'no' }; + await wooCommerceApi.updateEmailSubSettings( 'email_new_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_cancelled_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_failed_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_on_hold_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_processing_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_completed_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_refunded_order', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_note', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_reset_password', disabled ); + await wooCommerceApi.updateEmailSubSettings( 'email_customer_new_account', disabled ); +} ); -// setup( 'Setup WooCommerce general settings', async ( { wooCommerceApi } ) => { -// await wooCommerceApi.updateGeneralSettings( shopSettings.germany.general ); -// } ); +setup( 'Setup WooCommerce general settings', async ( { wooCommerceApi } ) => { + await wooCommerceApi.updateGeneralSettings( shopSettings.germany.general ); +} ); -// setup( 'Setup WooCommerce shipping', async ( { wooCommerceUtils } ) => { -// await wooCommerceUtils.configureShippingZone( shippingZones.worldwide ); -// } ); +setup( 'Setup WooCommerce shipping', async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.configureShippingZone( shippingZones.worldwide ); +} ); -// setup( 'Setup WooCommerce taxes (included)', async ( { wooCommerceUtils } ) => { -// await wooCommerceUtils.setTaxes( taxSettings.including ); -// } ); +setup( 'Setup WooCommerce taxes (included)', async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.setTaxes( taxSettings.including ); +} ); -// setup( 'Setup Registered Customer', async ( { wooCommerceUtils } ) => { -// await wooCommerceUtils.createCustomer( customers.germany ); -// } ); +setup( 'Setup Registered Customer', async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.createCustomer( customers.germany ); +} ); -// setup( 'Setup Delete Previous Orders', async ( { wooCommerceApi } ) => { -// await wooCommerceApi.deleteAllOrders(); -// } ); +setup( 'Setup Delete Previous Orders', async ( { wooCommerceApi } ) => { + await wooCommerceApi.deleteAllOrders(); +} ); -// setup( 'Setup coupons', async ( { wooCommerceUtils } ) => { -// // create test coupons -// const couponItems = {}; -// const couponEntries = Object.entries( coupons ); -// await Promise.all( -// couponEntries.map( async ( [ key, coupon ] ) => { -// const createdCoupon = await wooCommerceUtils.createCoupon( coupon ); -// couponItems[ coupon.code ] = { id: createdCoupon.id }; -// } ) -// ); -// // store created coupons as CART_ITEMS env var -// process.env.COUPONS = JSON.stringify( couponItems ); -// } ); +setup( 'Setup coupons', async ( { wooCommerceUtils } ) => { + // create test coupons + const couponItems = {}; + const couponEntries = Object.entries( coupons ); + await Promise.all( + couponEntries.map( async ( [ key, coupon ] ) => { + const createdCoupon = await wooCommerceUtils.createCoupon( coupon ); + couponItems[ coupon.code ] = { id: createdCoupon.id }; + } ) + ); + // store created coupons as CART_ITEMS env var + process.env.COUPONS = JSON.stringify( couponItems ); +} ); -// setup( 'Setup products', async ( { wooCommerceUtils } ) => { -// // create test products -// const cartItems = {}; -// const productEntries = Object.entries( products ); -// await Promise.all( -// productEntries.map( async ( [ key, product ] ) => { -// // check if not subscription product - requires Supscriptions plugin -// if ( ! product.slug.includes( 'subscription' ) ) { -// const createdProduct = await wooCommerceUtils.createProduct( -// product -// ); -// cartItems[ product.slug ] = { id: createdProduct.id }; -// } -// } ) -// ); -// // store created products as CART_ITEMS env var -// process.env.PRODUCTS = JSON.stringify( cartItems ); -// } ); +setup( 'Setup products', async ( { wooCommerceUtils } ) => { + // create test products + const cartItems = {}; + const productEntries = Object.entries( products ); + await Promise.all( + productEntries.map( async ( [ key, product ] ) => { + // check if not subscription product - requires Supscriptions plugin + if ( ! product.slug.includes( 'subscription' ) ) { + const createdProduct = await wooCommerceUtils.createProduct( + product + ); + cartItems[ product.slug ] = { id: createdProduct.id }; + } + } ) + ); + // store created products as CART_ITEMS env var + process.env.PRODUCTS = JSON.stringify( cartItems ); +} );