mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Add APM tests in pw
This commit is contained in:
parent
e0a39b1c4e
commit
a088c9cabb
4 changed files with 64 additions and 4 deletions
|
@ -26,6 +26,10 @@ export const fillCheckoutForm = async (page) => {
|
|||
await differentShippingLocator.uncheck();
|
||||
}
|
||||
|
||||
await acceptTerms(page);
|
||||
}
|
||||
|
||||
export const acceptTerms = async (page) => {
|
||||
const termsLocator = page.locator('[name="terms"]');
|
||||
if (await termsLocator.count() > 0) {
|
||||
await termsLocator.check();
|
||||
|
|
|
@ -91,9 +91,20 @@ export const waitForPaypalShippingList = async (popup) => {
|
|||
await expect(popup.locator('#shippingMethodsDropdown')).toBeVisible({timeout: 15000});
|
||||
}
|
||||
|
||||
export const completePaypalPayment = async (popup) => {
|
||||
/**
|
||||
* @param popup
|
||||
* @param {{timeout: ?int, selector: ?string}} options
|
||||
*/
|
||||
export const completePaypalPayment = async (popup, options) => {
|
||||
options = {
|
||||
...{
|
||||
timeout: 20000,
|
||||
selector: '#payment-submit-btn',
|
||||
},
|
||||
...options
|
||||
};
|
||||
await Promise.all([
|
||||
popup.waitForEvent('close', {timeout: 20000}),
|
||||
popup.click('#payment-submit-btn'),
|
||||
popup.waitForEvent('close', {timeout: options.timeout}),
|
||||
popup.click(options.selector),
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue