From d99c59ef75966ad8d1feece265212e61e02aced3 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 22 Mar 2023 11:27:59 +0200 Subject: [PATCH] Handle terms and different shipping/billing checkboxes in playwright --- tests/playwright/place-order.spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/playwright/place-order.spec.js b/tests/playwright/place-order.spec.js index 1cae8a8a5..843ef267d 100644 --- a/tests/playwright/place-order.spec.js +++ b/tests/playwright/place-order.spec.js @@ -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}) => {