mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Add playwright tests for block without final review
This commit is contained in:
parent
071dbe145e
commit
0816495226
1 changed files with 41 additions and 0 deletions
|
@ -70,6 +70,10 @@ async function loginIntoPaypal(popup) {
|
||||||
await popup.locator('#btnLogin').click();
|
await popup.locator('#btnLogin').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function waitForPaypalShippingList(popup) {
|
||||||
|
await expect(popup.locator('#shippingMethodsDropdown')).toBeVisible({timeout: 15000});
|
||||||
|
}
|
||||||
|
|
||||||
async function completePaypalPayment(popup) {
|
async function completePaypalPayment(popup) {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
popup.waitForEvent('close', {timeout: 20000}),
|
popup.waitForEvent('close', {timeout: 20000}),
|
||||||
|
@ -148,6 +152,7 @@ test.describe('Classic checkout', () => {
|
||||||
test.describe('Block checkout', () => {
|
test.describe('Block checkout', () => {
|
||||||
test.beforeAll(async ({browser}) => {
|
test.beforeAll(async ({browser}) => {
|
||||||
await serverExec('wp option update woocommerce_checkout_page_id ' + BLOCK_CHECKOUT_PAGE_ID);
|
await serverExec('wp option update woocommerce_checkout_page_id ' + BLOCK_CHECKOUT_PAGE_ID);
|
||||||
|
await serverExec('wp pcp settings update blocks_final_review_enabled true');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('PayPal express block checkout', async ({page}) => {
|
test('PayPal express block checkout', async ({page}) => {
|
||||||
|
@ -175,4 +180,40 @@ test.describe('Block checkout', () => {
|
||||||
|
|
||||||
await completeBlockContinuation(page);
|
await completeBlockContinuation(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.describe('Without review', () => {
|
||||||
|
test.beforeAll(async ({browser}) => {
|
||||||
|
await serverExec('wp pcp settings update blocks_final_review_enabled false');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('PayPal express block checkout', async ({page}) => {
|
||||||
|
await page.goto('?add-to-cart=' + PRODUCT_ID);
|
||||||
|
|
||||||
|
await page.goto(BLOCK_CHECKOUT_URL)
|
||||||
|
|
||||||
|
const popup = await openPaypalPopup(page);
|
||||||
|
|
||||||
|
await loginIntoPaypal(popup);
|
||||||
|
|
||||||
|
await waitForPaypalShippingList(popup);
|
||||||
|
|
||||||
|
await completePaypalPayment(popup);
|
||||||
|
|
||||||
|
await expectOrderReceivedPage(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('PayPal express block cart', async ({page}) => {
|
||||||
|
await page.goto(BLOCK_CART_URL + '?add-to-cart=' + PRODUCT_ID)
|
||||||
|
|
||||||
|
const popup = await openPaypalPopup(page);
|
||||||
|
|
||||||
|
await loginIntoPaypal(popup);
|
||||||
|
|
||||||
|
await waitForPaypalShippingList(popup);
|
||||||
|
|
||||||
|
await completePaypalPayment(popup);
|
||||||
|
|
||||||
|
await expectOrderReceivedPage(page);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue