From 32d147fee4bcf6a3d3533e96e518b75351356536 Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Mon, 29 Jul 2024 11:05:40 +0200 Subject: [PATCH] NTR: fix cypress for payconiq --- .../e2e/storefront/checkout/checkout-success.cy.js | 4 ++++ .../e2e/storefront/payment-methods/payconiq.cy.js | 5 +++-- .../actions/storefront/checkout/CheckoutAction.js | 9 +++++++++ .../cypress/support/scenarios/DummyBasketScenario.js | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js b/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js index a209adfeb..680005de7 100644 --- a/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js +++ b/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js @@ -91,6 +91,10 @@ context("Checkout Tests", () => { scenarioDummyBasket.execute(); + if(payment.key === 'payconiq'){ + checkout.changeBillingCountry('Belgium'); + } + paymentAction.switchPaymentMethod(payment.name); diff --git a/tests/Cypress/cypress/e2e/storefront/payment-methods/payconiq.cy.js b/tests/Cypress/cypress/e2e/storefront/payment-methods/payconiq.cy.js index 9c249316a..b285c4e32 100644 --- a/tests/Cypress/cypress/e2e/storefront/payment-methods/payconiq.cy.js +++ b/tests/Cypress/cypress/e2e/storefront/payment-methods/payconiq.cy.js @@ -3,6 +3,7 @@ import Session from "Services/utils/Session" // ------------------------------------------------------ import PaymentAction from "Actions/storefront/checkout/PaymentAction"; import DummyBasketScenario from "Scenarios/DummyBasketScenario"; +import CheckoutAction from "Actions/storefront/checkout/CheckoutAction"; // ------------------------------------------------------ @@ -11,7 +12,7 @@ const session = new Session(); const paymentAction = new PaymentAction(); const scenarioDummyBasket = new DummyBasketScenario(1); - +const checkout = new CheckoutAction(); const device = devices.getFirstDevice(); @@ -31,7 +32,7 @@ describe('Payconiq', () => { it('C3362896: Payconiq is existing in checkout', () => { scenarioDummyBasket.execute(); - + checkout.changeBillingCountry('Belgium'); paymentAction.switchPaymentMethod('Payconiq'); // payment would only work using currency CHF which cannot be done at the moment diff --git a/tests/Cypress/cypress/support/actions/storefront/checkout/CheckoutAction.js b/tests/Cypress/cypress/support/actions/storefront/checkout/CheckoutAction.js index 0f99d66c7..6e0df1291 100644 --- a/tests/Cypress/cypress/support/actions/storefront/checkout/CheckoutAction.js +++ b/tests/Cypress/cypress/support/actions/storefront/checkout/CheckoutAction.js @@ -110,4 +110,13 @@ export default class CheckoutAction { cy.get('.header-minimal-back-to-shop > .btn').click(); } + changeBillingCountry(billingCountry){ + + cy.get('.confirm-shipping-address a[data-address-editor]').click(); + cy.wait(2000); + cy.get('.address-editor-edit').click(); + cy.wait(1000); + cy.get('select#shipping-addressAddressCountry.country-select').eq(0).select(billingCountry); + cy.get('.address-form-actions button').eq(0).click(); + } } diff --git a/tests/Cypress/cypress/support/scenarios/DummyBasketScenario.js b/tests/Cypress/cypress/support/scenarios/DummyBasketScenario.js index 229f3bc04..f0e677e72 100644 --- a/tests/Cypress/cypress/support/scenarios/DummyBasketScenario.js +++ b/tests/Cypress/cypress/support/scenarios/DummyBasketScenario.js @@ -68,6 +68,7 @@ export default class DummyBasketScenario { } checkout.goToCheckoutInOffCanvas(); + checkout.changeBillingCountry('Germany'); } }