mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Retry popup openning
sometimes checkout refreshes and the buttons becomes inactive for some time
This commit is contained in:
parent
e032edcc8c
commit
19f004becd
1 changed files with 15 additions and 8 deletions
|
@ -31,17 +31,24 @@ async function fillCheckoutForm(page) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openPaypalPopup(page) {
|
async function openPaypalPopup(page, retry = true) {
|
||||||
await page.locator('.component-frame').scrollIntoViewIfNeeded();
|
try {
|
||||||
|
await page.locator('.component-frame').scrollIntoViewIfNeeded();
|
||||||
|
|
||||||
const [popup] = await Promise.all([
|
const [popup] = await Promise.all([
|
||||||
page.waitForEvent('popup'),
|
page.waitForEvent('popup', {timeout: 5000}),
|
||||||
page.frameLocator('.component-frame').locator('[data-funding-source="paypal"]').click(),
|
page.frameLocator('.component-frame').locator('[data-funding-source="paypal"]').click(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await popup.waitForLoadState();
|
await popup.waitForLoadState();
|
||||||
|
|
||||||
return popup;
|
return popup;
|
||||||
|
} catch (err) {
|
||||||
|
if (retry) {
|
||||||
|
return openPaypalPopup(page, false);
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginIntoPaypal(popup) {
|
async function loginIntoPaypal(popup) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue