Handle terms and different shipping/billing checkboxes in playwright

This commit is contained in:
Alex P 2023-03-22 11:27:59 +02:00
parent 715e3d4a92
commit d99c59ef75
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -18,6 +18,16 @@ async function fillCheckoutForm(page) {
await page.fill('#billing_city', '10715');
await page.fill('#billing_phone', '1234567890');
await page.fill('#billing_email', CUSTOMER_EMAIL);
const differentShippingLocator = page.locator('[name="ship_to_different_address"]');
if (await differentShippingLocator.count() > 0) {
await differentShippingLocator.uncheck();
}
const termsLocator = page.locator('[name="terms"]');
if (await termsLocator.count() > 0) {
await termsLocator.check();
}
}
test('PayPal button place order from Product page', async ({page}) => {