Skip to content

Commit

Permalink
e2e WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
frosso committed Nov 7, 2024
1 parent b670563 commit 15661b4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/e2e/specs/wcpay/shopper/shopper-bnpls-checkout.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -49,21 +52,16 @@ 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' ),
[ [ 'Beanie', 3 ] ]
);
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 ) {
Expand Down

0 comments on commit 15661b4

Please sign in to comment.