Add APM tests in pw

This commit is contained in:
Alex P 2023-06-23 10:56:21 +03:00
parent e0a39b1c4e
commit a088c9cabb
No known key found for this signature in database
GPG key ID: 54487A734A204D71
4 changed files with 64 additions and 4 deletions

View file

@ -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();

View file

@ -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),
]);
}