mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +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) {
|
||||
await page.locator('.component-frame').scrollIntoViewIfNeeded();
|
||||
async function openPaypalPopup(page, retry = true) {
|
||||
try {
|
||||
await page.locator('.component-frame').scrollIntoViewIfNeeded();
|
||||
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.frameLocator('.component-frame').locator('[data-funding-source="paypal"]').click(),
|
||||
]);
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup', {timeout: 5000}),
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue