From 15661b4d9d5c84d5f3b7bcc647013513c550e0cb Mon Sep 17 00:00:00 2001 From: frosso Date: Thu, 7 Nov 2024 10:33:18 +0100 Subject: [PATCH] e2e WIP --- .../shopper/shopper-bnpls-checkout.spec.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/e2e/specs/wcpay/shopper/shopper-bnpls-checkout.spec.js b/tests/e2e/specs/wcpay/shopper/shopper-bnpls-checkout.spec.js index 4bf7ea14b9b..8c8c4a30c83 100644 --- a/tests/e2e/specs/wcpay/shopper/shopper-bnpls-checkout.spec.js +++ b/tests/e2e/specs/wcpay/shopper/shopper-bnpls-checkout.spec.js @@ -8,9 +8,12 @@ import { uiUnblocked } from '@woocommerce/e2e-utils/build/page-utils'; * Internal dependencies */ import { merchantWCP, shopperWCP } from '../../../utils/flows'; -import { setupProductCheckout } from '../../../utils/payments'; +import { + selectOnCheckout, + setupProductCheckout, +} from '../../../utils/payments'; -const bnplProviders = [ [ 'Affirm' ], [ 'Afterpay' ] ]; +const bnplProviders = [ [ 'affirm' ], [ 'afterpay_clearpay' ] ]; const UPE_METHOD_CHECKBOXES = [ "//label[contains(text(), 'Affirm')]/preceding-sibling::span/input[@type='checkbox']", // affirm @@ -49,8 +52,8 @@ describe.each( cardTestingPreventionStates )( describe.each( bnplProviders )( `Checkout with %s, carding protection ${ cardTestingPreventionEnabled }`, - ( providerName ) => { - it( `should successfully place order with ${ providerName }`, async () => { + ( providerId ) => { + it( `should successfully place order with ${ providerId }`, async () => { await shopperWCP.emptyCart(); await setupProductCheckout( config.get( 'addresses.customer.billing' ), @@ -58,12 +61,7 @@ describe.each( cardTestingPreventionStates )( ); await uiUnblocked(); // Select BNPL provider as payment method. - const xPathPaymentMethodSelector = `//*[@id='payment']/ul/li/label[contains(text(), '${ providerName }')]`; - await page.waitForXPath( xPathPaymentMethodSelector ); - const [ paymentMethodLabel ] = await page.$x( - xPathPaymentMethodSelector - ); - await paymentMethodLabel.click(); + await selectOnCheckout( providerId, page ); // Check the token presence when card testing prevention is enabled. if ( cardTestingPreventionEnabled ) {