diff --git a/src/cartridges/app_adyen_SFRA/cartridge/config/countries.json b/src/cartridges/app_adyen_SFRA/cartridge/config/countries.json index d9ad44311..c68d6015b 100644 --- a/src/cartridges/app_adyen_SFRA/cartridge/config/countries.json +++ b/src/cartridges/app_adyen_SFRA/cartridge/config/countries.json @@ -34,4 +34,8 @@ }, { "id": "ja_JP", "currencyCode": "JPY" +}, +{ + "id": "de_DE", + "currencyCode": "EUR" }] \ No newline at end of file diff --git a/tests/playwright/data/enums.mjs b/tests/playwright/data/enums.mjs index c9d96bfcb..eabc0ae7e 100644 --- a/tests/playwright/data/enums.mjs +++ b/tests/playwright/data/enums.mjs @@ -7,4 +7,5 @@ export const regionsEnum = { SE: 'sv_SE', IN: 'hi_IN', JP: 'ja_JP', + DE: 'de_DE', }; diff --git a/tests/playwright/data/shopperData.mjs b/tests/playwright/data/shopperData.mjs index 2926594ec..ce920d64f 100644 --- a/tests/playwright/data/shopperData.mjs +++ b/tests/playwright/data/shopperData.mjs @@ -233,4 +233,21 @@ export class ShopperData { houseNumberOrName: '37', }, }; + DERiverty = { + shopperName: { + firstName: 'John', + lastName: 'Doe', + }, + telephone: '0513744112', + successShopperEmail: 'test@example.com', + refusalShopperEmail: 'rejection@riverty.com', + address: { + city: 'Verl', + country: 'DE', + stateOrProvince: '', + postalCode: '33415', + street: 'Gütersloher Str.', + houseNumberOrName: '123', + }, + }; } diff --git a/tests/playwright/fixtures/countriesEUR/DE.spec.mjs b/tests/playwright/fixtures/countriesEUR/DE.spec.mjs index 7f932114f..915f000d7 100644 --- a/tests/playwright/fixtures/countriesEUR/DE.spec.mjs +++ b/tests/playwright/fixtures/countriesEUR/DE.spec.mjs @@ -84,4 +84,48 @@ for (const environment of environments) { await checkoutPage.expectRefusal() || test.skip(); }); }); + + test.describe.parallel(`${environment.name} Riverty EUR DE`, () => { + test.beforeEach(async ({ page }) => { + await page.goto(`${environment.urlExtension}`); + checkoutPage = new environment.CheckoutPage(page); + }); + + async function rivertyCheckoutFlow({ page, email, shopperDetails, expectSuccess = true }) { + await checkoutPage.goToCheckoutPageWithFullCart(regionsEnum.DE, 1, email); + await checkoutPage.setShopperDetails(shopperDetails); + + // SFRA 5 email setting flow is different + if (environment.name.indexOf('v5') !== -1) { + await checkoutPage.setEmail(email); + } + redirectShopper = new RedirectShopper(page); + await redirectShopper.doRivertyPayment(email); + await checkoutPage.completeCheckout(); + + if (expectSuccess) { + await checkoutPage.expectSuccess(); + } else { + await checkoutPage.expectRefusal(); + } + } + + test('Riverty Success @quick', async ({ page }) => { + await rivertyCheckoutFlow({ + page, + email: shopperData.DERiverty.successShopperEmail, + shopperDetails: shopperData.DERiverty, + expectSuccess: true, + }); + }); + + test('Riverty Failure @quick', async ({ page }) => { + await rivertyCheckoutFlow({ + page, + email: shopperData.DERiverty.refusalShopperEmail, + shopperDetails: shopperData.DERiverty, + expectSuccess: false, + }); + }); + }); } diff --git a/tests/playwright/pages/CheckoutPageSFRA5.mjs b/tests/playwright/pages/CheckoutPageSFRA5.mjs index 629df8de3..f4a132c1a 100644 --- a/tests/playwright/pages/CheckoutPageSFRA5.mjs +++ b/tests/playwright/pages/CheckoutPageSFRA5.mjs @@ -157,9 +157,9 @@ export default class CheckoutPageSFRA5 { await this.submitShipping(); }; - setEmail = async () => { + setEmail = async (email = 'test@adyenTest.com') => { await this.checkoutPageUserEmailInput.fill(''); - await this.checkoutPageUserEmailInput.fill('test@adyenTest.com'); + await this.checkoutPageUserEmailInput.fill(email); // Pressing Tab to simulate component re-rendering and waiting the components to re-mount await this.page.keyboard.press('Tab'); await new Promise(r => setTimeout(r, 2000)); diff --git a/tests/playwright/pages/CheckoutPageSFRA6.mjs b/tests/playwright/pages/CheckoutPageSFRA6.mjs index d6fbd98d4..d85b0df5f 100644 --- a/tests/playwright/pages/CheckoutPageSFRA6.mjs +++ b/tests/playwright/pages/CheckoutPageSFRA6.mjs @@ -100,12 +100,12 @@ export default class CheckoutPageSFRA { await this.page.goto(this.getCartUrl(locale)); } - goToCheckoutPageWithFullCart = async (locale, itemCount = 1) => { + goToCheckoutPageWithFullCart = async (locale, itemCount = 1, email) => { await this.addProductToCart(locale, itemCount); await this.successMessage.waitFor({ visible: true, timeout: 20000 }); await this.navigateToCheckout(locale); - await this.setEmail(); + await this.setEmail(email); await this.checkoutGuest.click(); }; @@ -165,13 +165,13 @@ export default class CheckoutPageSFRA { await this.submitShipping(); }; - setEmail = async () => { + setEmail = async (email = 'test@adyenTest.com') => { /* After filling the shopper details, clicking "Next" has an autoscroll feature, which leads the email field to be missed, hence the flakiness. Waiting until the full page load prevents this situation */ await this.page.waitForLoadState('networkidle'); await this.checkoutPageUserEmailInput.fill(''); - await this.checkoutPageUserEmailInput.fill('test@adyenTest.com'); + await this.checkoutPageUserEmailInput.fill(email); }; submitShipping = async () => { diff --git a/tests/playwright/pages/PaymentMethodsPage.mjs b/tests/playwright/pages/PaymentMethodsPage.mjs index f006363f8..e46a18044 100644 --- a/tests/playwright/pages/PaymentMethodsPage.mjs +++ b/tests/playwright/pages/PaymentMethodsPage.mjs @@ -453,14 +453,8 @@ export default class PaymentMethodsPage { cancelKlarnaPayment = async () => { await this.waitForKlarnaLoad(); await this.page.waitForLoadState('networkidle', { timeout: 20000 }); - this.firstCancelButton = this.page.locator('#collectPhonePurchaseFlow__nav-bar__right-icon-wrapper'); - this.secondCancelButton = this.page.locator("button[title='Close']"); - await this.firstCancelButton.waitFor({ - state: 'visible', - timeout: 25000, - }); - await this.firstCancelButton.click(); - await this.secondCancelButton.first().click(); + this.cancelButton = this.page.locator("button[title='Close']"); + await this.cancelButton.click(); await this.page.click("button[id='payment-cancel-dialog-express__confirm']"); }; diff --git a/tests/playwright/paymentFlows/redirectShopper.mjs b/tests/playwright/paymentFlows/redirectShopper.mjs index 7b8c84caf..09530b209 100644 --- a/tests/playwright/paymentFlows/redirectShopper.mjs +++ b/tests/playwright/paymentFlows/redirectShopper.mjs @@ -93,6 +93,14 @@ export class RedirectShopper { await this.page.click('#rb_giropay'); }; + doRivertyPayment = async (email) => { + await this.page.click('#rb_riverty'); + await this.page.fill('input[name="dateOfBirth"]', '1980-01-11'); + await this.page.fill('input[name="shopperEmail"]', email); + // There is no static locator to click the checkbox + await this.page.locator('label:has-text("Ich stimme den")').click(); +}; + completeGiropayRedirect = async (success) => { if (success) { await this.paymentMethodsPage.confirmGiropayPayment();