diff --git a/tests/playwright/data/paymentData.mjs b/tests/playwright/data/paymentData.mjs index 91440950e..b1ef8e358 100644 --- a/tests/playwright/data/paymentData.mjs +++ b/tests/playwright/data/paymentData.mjs @@ -12,4 +12,7 @@ export class PaymentData { username : process.env.AMAZONPAY_USERNAME, password: process.env.AMAZONPAY_PASSWORD, } + ClickToPay = { + email : process.env.SFCC_USERNAME, + } } diff --git a/tests/playwright/fixtures/countriesEUR/NL.spec.mjs b/tests/playwright/fixtures/countriesEUR/NL.spec.mjs index a44fb76a5..3346f1977 100644 --- a/tests/playwright/fixtures/countriesEUR/NL.spec.mjs +++ b/tests/playwright/fixtures/countriesEUR/NL.spec.mjs @@ -4,10 +4,12 @@ import { environments } from '../../data/environments.mjs'; import { ShopperData } from '../../data/shopperData.mjs'; import { RedirectShopper } from '../../paymentFlows/redirectShopper.mjs'; import { PendingPayments } from '../../paymentFlows/pending.mjs'; +import { PaymentData } from '../../data/paymentData.mjs'; let checkoutPage; let redirectShopper; let pendingPayments; +const paymentData = new PaymentData(); const shopperData = new ShopperData(); for (const environment of environments) { @@ -101,4 +103,20 @@ for (const environment of environments) { await pendingPayments.doGooglePayPayment(); }); }); + + test.describe.parallel(`${environment.name} EUR NL`, () => { + test.beforeEach(async ({ page }) => { + await page.goto(`${environment.urlExtension}`); + checkoutPage = new environment.CheckoutPage(page); + }); + test('Click to Pay', async () => { + await checkoutPage.goToCheckoutPageWithFullCart(regionsEnum.EU, 1, paymentData.ClickToPay.email); + await checkoutPage.setShopperDetails(shopperData.NL); + if (environment.name.indexOf('v5') !== -1) { + await checkoutPage.setEmail(paymentData.ClickToPay.email); + }; + await checkoutPage.expectClickToPay(); + }); + }); } + diff --git a/tests/playwright/pages/CheckoutPageSFRA5.mjs b/tests/playwright/pages/CheckoutPageSFRA5.mjs index 984f30348..1a918e4c9 100644 --- a/tests/playwright/pages/CheckoutPageSFRA5.mjs +++ b/tests/playwright/pages/CheckoutPageSFRA5.mjs @@ -206,6 +206,10 @@ export default class CheckoutPageSFRA5 { await expect(this.thankYouMessage).toBeVisible(); }; + expectClickToPay = async () => { + await expect(this.clickToPayLocator).toBeVisible(); + }; + expectNonRedirectSuccess = async () => { await expect(this.thankYouMessage).toBeVisible(); }; diff --git a/tests/playwright/pages/CheckoutPageSFRA6.mjs b/tests/playwright/pages/CheckoutPageSFRA6.mjs index 35d8a9df1..0be9e0dba 100644 --- a/tests/playwright/pages/CheckoutPageSFRA6.mjs +++ b/tests/playwright/pages/CheckoutPageSFRA6.mjs @@ -63,6 +63,7 @@ export default class CheckoutPageSFRA { this.errorMessage = page.locator('.error-message-text'); this.giftCardWarning = page.locator('#giftCardWarningMessage') this.thankYouMessage = page.locator('.order-thank-you-msg'); + this.clickToPayLocator = page.locator('.adyen-checkout-ctp__section'); this.voucherCode = page.locator('#voucherResult'); @@ -184,12 +185,12 @@ export default class CheckoutPageSFRA { }; submitPayment = async () => { - await this.page.waitForFunction(() => { - const button = document.querySelector('.submit-payment'); - return button && !button.disabled; - }); - - await this.submitPaymentButton.click(); + await this.page.waitForFunction(() => { + const button = document.querySelector('.submit-payment'); + return button && !button.disabled; + }); + + await this.submitPaymentButton.click(); }; placeOrder = async () => { @@ -242,6 +243,10 @@ export default class CheckoutPageSFRA { await expect(this.giftCardWarning).not.toBeEmpty(); }; + expectClickToPay = async () => { + await expect(this.clickToPayLocator).toBeVisible(); + } + getLocation = async () => { await this.page.waitForLoadState('load'); return await this.page.url(); @@ -267,3 +272,4 @@ export default class CheckoutPageSFRA { ); }; } +