mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Add test for card block free trial without saved payments
This commit is contained in:
parent
5e5c99bc7d
commit
d0b8f4ccba
2 changed files with 80 additions and 9 deletions
|
@ -12,7 +12,6 @@ const {
|
|||
|
||||
const {
|
||||
CREDIT_CARD_NUMBER,
|
||||
CREDIT_CARD_EXPIRATION,
|
||||
CREDIT_CARD_CVV,
|
||||
PRODUCT_URL,
|
||||
CHECKOUT_URL,
|
||||
|
@ -73,17 +72,17 @@ test( 'Advanced Credit and Debit Card place order from Checkout page', async ( {
|
|||
|
||||
await page.click( 'text=Credit Cards' );
|
||||
|
||||
const creditCardNumber = await page
|
||||
.frameLocator( '[title="paypal_card_number_field"]' )
|
||||
.locator( '.card-field-number' );
|
||||
await creditCardNumber.fill( CREDIT_CARD_NUMBER );
|
||||
|
||||
const expirationDate = await page
|
||||
.frameLocator( 'iframe[title="paypal_card_expiry_field"]' )
|
||||
.locator( 'input.card-field-expiry' );
|
||||
await expirationDate.click();
|
||||
await page.keyboard.type( '01/42' );
|
||||
|
||||
const creditCardNumber = await page
|
||||
.frameLocator( '[title="paypal_card_number_field"]' )
|
||||
.locator( '.card-field-number' );
|
||||
await creditCardNumber.fill( CREDIT_CARD_NUMBER );
|
||||
|
||||
const cvv = await page
|
||||
.frameLocator( '[title="paypal_card_cvv_field"]' )
|
||||
.locator( '.card-field-cvv' );
|
||||
|
|
|
@ -2,6 +2,9 @@ const { test, expect } = require( '@playwright/test' );
|
|||
const { loginAsCustomer } = require( './utils/user' );
|
||||
const { openPaypalPopup, loginIntoPaypal } = require( './utils/paypal-popup' );
|
||||
const { serverExec } = require( './utils/server' );
|
||||
const { expectOrderReceivedPage } = require( './utils/checkout' );
|
||||
|
||||
const { CREDIT_CARD_NUMBER, CREDIT_CARD_CVV } = process.env;
|
||||
|
||||
test( 'PayPal logged-in user free trial subscription without payment token with shipping callback enabled', async ( {
|
||||
page,
|
||||
|
@ -11,7 +14,6 @@ test( 'PayPal logged-in user free trial subscription without payment token with
|
|||
);
|
||||
|
||||
await loginAsCustomer( page );
|
||||
|
||||
await page.goto( '/product/free-trial' );
|
||||
await page.click( 'text=Sign up now' );
|
||||
await page.goto( '/classic-checkout' );
|
||||
|
@ -20,6 +22,76 @@ test( 'PayPal logged-in user free trial subscription without payment token with
|
|||
await loginIntoPaypal( popup );
|
||||
popup.locator( '#consentButton' ).click();
|
||||
|
||||
const title = await page.locator( '.entry-title' );
|
||||
await expect( title ).toHaveText( 'Order received' );
|
||||
await page.waitForURL( '**/order-received/**' );
|
||||
} );
|
||||
|
||||
test( 'ACDC logged-in user free trial subscription without payment token', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
await loginAsCustomer( page );
|
||||
await page.goto( '/product/free-trial' );
|
||||
await page.click( 'text=Sign up now' );
|
||||
await page.goto( '/classic-checkout' );
|
||||
|
||||
await page.click( 'text=Credit Cards' );
|
||||
|
||||
const creditCardNumber = await page
|
||||
.frameLocator( '[title="paypal_card_number_field"]' )
|
||||
.locator( '.card-field-number' );
|
||||
await creditCardNumber.fill( CREDIT_CARD_NUMBER );
|
||||
|
||||
const expirationDate = await page
|
||||
.frameLocator( 'iframe[title="paypal_card_expiry_field"]' )
|
||||
.locator( 'input.card-field-expiry' );
|
||||
await expirationDate.click();
|
||||
await page.keyboard.type( '01/42' );
|
||||
|
||||
const cvv = await page
|
||||
.frameLocator( '[title="paypal_card_cvv_field"]' )
|
||||
.locator( '.card-field-cvv' );
|
||||
await cvv.fill( CREDIT_CARD_CVV );
|
||||
|
||||
await Promise.all( [
|
||||
page.waitForNavigation(),
|
||||
page.locator( '.ppcp-dcc-order-button' ).click(),
|
||||
] );
|
||||
|
||||
await expectOrderReceivedPage( page );
|
||||
} );
|
||||
|
||||
test( 'ACDC purchase free trial in Block checkout page as logged-in without saved card payments', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
await loginAsCustomer( page );
|
||||
await page.goto( '/product/free-trial' );
|
||||
await page.click( 'text=Sign up now' );
|
||||
await page.goto( '/checkout' );
|
||||
|
||||
await page
|
||||
.locator(
|
||||
'#radio-control-wc-payment-method-options-ppcp-credit-card-gateway'
|
||||
)
|
||||
.click();
|
||||
|
||||
const expirationDate = await page
|
||||
.frameLocator( 'iframe[title="paypal_card_expiry_field"]' )
|
||||
.locator( 'input.card-field-expiry' );
|
||||
await expirationDate.click();
|
||||
await page.keyboard.type( '01/42' );
|
||||
|
||||
const creditCardNumber = await page
|
||||
.frameLocator( '[title="paypal_card_number_field"]' )
|
||||
.locator( '.card-field-number' );
|
||||
await creditCardNumber.fill( CREDIT_CARD_NUMBER );
|
||||
|
||||
const cvv = await page
|
||||
.frameLocator( '[title="paypal_card_cvv_field"]' )
|
||||
.locator( '.card-field-cvv' );
|
||||
await cvv.fill( CREDIT_CARD_CVV );
|
||||
|
||||
await page
|
||||
.locator( '.wc-block-components-checkout-place-order-button' )
|
||||
.click();
|
||||
|
||||
await page.waitForURL( '**/order-received/**' );
|
||||
} );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue