From bc8704173657471780118b02d57ee38e1e6c0cb2 Mon Sep 17 00:00:00 2001 From: Justas Vaitkus Date: Wed, 7 Aug 2024 16:52:26 +0300 Subject: [PATCH] added more cases --- .github/workflows/saferpayCheckouting.yml | 6 +- .../e2e/02-authorizeAfterAuthorization.cy.js | 10 +- .../e2e/03-authorizeBeforeAuthorization.cy.js | 170 ++++++++++++++++++ .../e2e/04-captureAfterAuthorization.cy.js | 170 ++++++++++++++++++ .../e2e/05-captureBeforeAuthorization.cy.js | 170 ++++++++++++++++++ 5 files changed, 517 insertions(+), 9 deletions(-) create mode 100644 cypress/e2e/03-authorizeBeforeAuthorization.cy.js create mode 100644 cypress/e2e/04-captureAfterAuthorization.cy.js create mode 100644 cypress/e2e/05-captureBeforeAuthorization.cy.js diff --git a/.github/workflows/saferpayCheckouting.yml b/.github/workflows/saferpayCheckouting.yml index 1e9464a8..98dafe6b 100644 --- a/.github/workflows/saferpayCheckouting.yml +++ b/.github/workflows/saferpayCheckouting.yml @@ -13,10 +13,10 @@ jobs: include: - prestashop: 'PS817' make: 'make e2eh817' - subdomain: 'sp817' + subdomain: 'safer817' port: '8002' yml: 'docker-compose.817.yml' - url: 'https://sp817.eu.ngrok.io' + url: 'https://safer817.eu.ngrok.io' test_spec: 'cypress/e2e/**' steps: - name: Checkouting @@ -28,7 +28,7 @@ jobs: shell: bash - run: ./ngrok authtoken ${{ secrets.NGROK_TOKEN }} shell: bash - - run: ./ngrok http --region=eu --log=stdout --subdomain=sp817 8002 > ngrok.log & + - run: ./ngrok http --region=eu --log=stdout --subdomain=safer817 8002 > ngrok.log & shell: bash - name: Extract ngrok URL diff --git a/cypress/e2e/02-authorizeAfterAuthorization.cy.js b/cypress/e2e/02-authorizeAfterAuthorization.cy.js index 078c7126..125ab960 100644 --- a/cypress/e2e/02-authorizeAfterAuthorization.cy.js +++ b/cypress/e2e/02-authorizeAfterAuthorization.cy.js @@ -6,7 +6,7 @@ Cypress.on('window:before:load', (win) => { afterEach(() => { expect(windowConsoleError).to.not.be.called; }) -describe('PS817 Tests Suite -> Authorization + After order creation', { +describe('PS817 Tests Suite -> Authorization + After auth', { failFast: { enabled: false, }, @@ -33,7 +33,7 @@ describe('PS817 Tests Suite -> Authorization + After order creation', { it('A2A guest PM visible', () => { cy.clearCookies() - cy.visit('/en/home/1-spproduct.html', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s', { headers: {"Accept-Encoding": "gzip, deflate"}}) cy.guestCheckout() cy.contains('Accounttoaccount').should('be.visible') }) @@ -140,7 +140,7 @@ describe('PS817 Tests Suite -> Authorization + After order creation', { cy.changeCurrencyCHF() cy.navigatingToThePaymentCHF() //Payment method choosing - cy.contains('Bonuscard').should('be.visible') + cy.contains('BonusCard').should('be.visible') }) it('Paypal Checkouting', () => { @@ -165,8 +165,6 @@ describe('PS817 Tests Suite -> Authorization + After order creation', { //Payment method choosing cy.contains('Postfinancepay').click({ force: true }) cy.get('.condition-label > .js-terms').click({ force: true }) - cy.contains('Place order').click({ force: true }) - cy.get('#redirectedPayButton').click() - cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + cy.contains('Postfinancepay').should('be.visible') }) }) \ No newline at end of file diff --git a/cypress/e2e/03-authorizeBeforeAuthorization.cy.js b/cypress/e2e/03-authorizeBeforeAuthorization.cy.js new file mode 100644 index 00000000..e93eaafb --- /dev/null +++ b/cypress/e2e/03-authorizeBeforeAuthorization.cy.js @@ -0,0 +1,170 @@ +//Checking the console for errors +let windowConsoleError; +Cypress.on('window:before:load', (win) => { + windowConsoleError = cy.spy(win.console, 'error'); +}) +afterEach(() => { + expect(windowConsoleError).to.not.be.called; +}) +describe('PS817 Tests Suite -> Authorization + Before auth', { + failFast: { + enabled: false, + }, +}, () => { + beforeEach(() => { + cy.viewport(1920, 1080) + cy.CachingBOFO() + + }) + + it('Change the setting to Authorize', () => { + cy.visit('/admin1/') + cy.OpeningModuleDashboardURL() + cy.get('#SAFERPAY_PAYMENT_BEHAVIOR_1').click() + cy.get('#configuration_fieldset_2 > .panel-footer > .btn').click() + }) + it('Change the setting create order before authorization', () => { + cy.visit('/admin1/') + cy.OpeningModuleDashboardURL() + cy.get('#SAFERPAY_ORDER_CREATION_AFTER_AUTHORIZATION_0').click() + cy.get('#configuration_fieldset_2 > .panel-footer > .btn').click() + }) + + + it('A2A guest PM visible', () => { + cy.clearCookies() + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.guestCheckout() + cy.contains('Accounttoaccount').should('be.visible') + }) + + it('Twint guest success', () => { + cy.clearCookies() + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s') + cy.guestCheckoutCHF() + cy.contains('Twint').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click() + cy.get('.saferpay-paymentpage').should('be.visible') + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Wechatpay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Wechatpay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.get('.saferpay-paymentpage').should('be.visible') + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('MC Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Mastercard').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Sofort Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Sofort').should('be.visible') + }) + + it('Visa Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Visa').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Visa').should('be.visible') + }) + + it('AmericanExpressCheckouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('AmericanExpress').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillAmex() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('DinersClub Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('DinersClub').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillDiners() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Jcb Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Jcb').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillJcb() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Apple Pay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Applepay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Applepay').should('be.visible') + // cy.contains('Place order').click({ force: true }) + // cy.get('.btn-wallet-applepay').click() + // cy.get('#payButtonText').click() + // cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Myone Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + cy.contains('Myone').should('be.visible') + }) + + it('BonusCard Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + //Payment method choosing + cy.contains('BonusCard').should('be.visible') + }) + + it('Paypal Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Paypal').click({ force: true }) + cy.contains('Paypal').should('be.visible') + }) + + it('Unionpay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Unionpay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Unionpay').should('be.visible') + }) + + it('Postfinancepay Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + //Payment method choosing + cy.contains('Postfinancepay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Postfinancepay').should('be.visible') + }) +}) \ No newline at end of file diff --git a/cypress/e2e/04-captureAfterAuthorization.cy.js b/cypress/e2e/04-captureAfterAuthorization.cy.js new file mode 100644 index 00000000..348f16e7 --- /dev/null +++ b/cypress/e2e/04-captureAfterAuthorization.cy.js @@ -0,0 +1,170 @@ +//Checking the console for errors +let windowConsoleError; +Cypress.on('window:before:load', (win) => { + windowConsoleError = cy.spy(win.console, 'error'); +}) +afterEach(() => { + expect(windowConsoleError).to.not.be.called; +}) +describe('PS817 Tests Suite -> Capture + After auth', { + failFast: { + enabled: false, + }, +}, () => { + beforeEach(() => { + cy.viewport(1920, 1080) + cy.CachingBOFO() + + }) + + it('Change the setting to Capture', () => { + cy.visit('/admin1/') + cy.OpeningModuleDashboardURL() + cy.get('#SAFERPAY_PAYMENT_BEHAVIOR_0').click() + cy.get('#configuration_fieldset_2 > .panel-footer > .btn').click() + }) + it('Change the setting create order after authorization', () => { + cy.visit('/admin1/') + cy.OpeningModuleDashboardURL() + cy.get('#SAFERPAY_ORDER_CREATION_AFTER_AUTHORIZATION_1').click() + cy.get('#configuration_fieldset_2 > .panel-footer > .btn').click() + }) + + + it('A2A guest PM visible', () => { + cy.clearCookies() + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.guestCheckout() + cy.contains('Accounttoaccount').should('be.visible') + }) + + it('Twint guest success', () => { + cy.clearCookies() + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s') + cy.guestCheckoutCHF() + cy.contains('Twint').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click() + cy.get('.saferpay-paymentpage').should('be.visible') + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Wechatpay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Wechatpay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.get('.saferpay-paymentpage').should('be.visible') + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('MC Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Mastercard').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Sofort Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Sofort').should('be.visible') + }) + + it('Visa Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Visa').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Visa').should('be.visible') + }) + + it('AmericanExpressCheckouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('AmericanExpress').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillAmex() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('DinersClub Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('DinersClub').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillDiners() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Jcb Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Jcb').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillJcb() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Apple Pay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Applepay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Applepay').should('be.visible') + // cy.contains('Place order').click({ force: true }) + // cy.get('.btn-wallet-applepay').click() + // cy.get('#payButtonText').click() + // cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Myone Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + cy.contains('Myone').should('be.visible') + }) + + it('BonusCard Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + //Payment method choosing + cy.contains('BonusCard').should('be.visible') + }) + + it('Paypal Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Paypal').click({ force: true }) + cy.contains('Paypal').should('be.visible') + }) + + it('Unionpay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Unionpay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Unionpay').should('be.visible') + }) + + it('Postfinancepay Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + //Payment method choosing + cy.contains('Postfinancepay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Postfinancepay').should('be.visible') + }) +}) \ No newline at end of file diff --git a/cypress/e2e/05-captureBeforeAuthorization.cy.js b/cypress/e2e/05-captureBeforeAuthorization.cy.js new file mode 100644 index 00000000..5696e995 --- /dev/null +++ b/cypress/e2e/05-captureBeforeAuthorization.cy.js @@ -0,0 +1,170 @@ +//Checking the console for errors +let windowConsoleError; +Cypress.on('window:before:load', (win) => { + windowConsoleError = cy.spy(win.console, 'error'); +}) +afterEach(() => { + expect(windowConsoleError).to.not.be.called; +}) +describe('PS817 Tests Suite -> Capture + Before auth', { + failFast: { + enabled: false, + }, +}, () => { + beforeEach(() => { + cy.viewport(1920, 1080) + cy.CachingBOFO() + + }) + + it('Change the setting to Capture', () => { + cy.visit('/admin1/') + cy.OpeningModuleDashboardURL() + cy.get('#SAFERPAY_PAYMENT_BEHAVIOR_0').click() + cy.get('#configuration_fieldset_2 > .panel-footer > .btn').click() + }) + it('Change the setting create order before authorization', () => { + cy.visit('/admin1/') + cy.OpeningModuleDashboardURL() + cy.get('#SAFERPAY_ORDER_CREATION_AFTER_AUTHORIZATION_0').click() + cy.get('#configuration_fieldset_2 > .panel-footer > .btn').click() + }) + + + it('A2A guest PM visible', () => { + cy.clearCookies() + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.guestCheckout() + cy.contains('Accounttoaccount').should('be.visible') + }) + + it('Twint guest success', () => { + cy.clearCookies() + cy.visit('/en/women/2-9-brown-bear-printed-sweater.html#/1-size-s') + cy.guestCheckoutCHF() + cy.contains('Twint').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click() + cy.get('.saferpay-paymentpage').should('be.visible') + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Wechatpay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Wechatpay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.get('.saferpay-paymentpage').should('be.visible') + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('MC Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Mastercard').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Sofort Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Sofort').should('be.visible') + }) + + it('Visa Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Visa').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Visa').should('be.visible') + }) + + it('AmericanExpressCheckouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('AmericanExpress').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillAmex() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('DinersClub Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('DinersClub').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillDiners() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Jcb Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Jcb').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Place order').click({ force: true }) + cy.FillJcb() + cy.get('[class="btn btn-next pay-button"]').click() + cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Apple Pay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Applepay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Applepay').should('be.visible') + // cy.contains('Place order').click({ force: true }) + // cy.get('.btn-wallet-applepay').click() + // cy.get('#payButtonText').click() + // cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') + }) + + it('Myone Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + cy.contains('Myone').should('be.visible') + }) + + it('BonusCard Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + //Payment method choosing + cy.contains('BonusCard').should('be.visible') + }) + + it('Paypal Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Paypal').click({ force: true }) + cy.contains('Paypal').should('be.visible') + }) + + it('Unionpay Checkouting', () => { + cy.navigatingToThePayment() + //Payment method choosing + cy.contains('Unionpay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Unionpay').should('be.visible') + }) + + it('Postfinancepay Checkouting', () => { + cy.visit('/en/order-history') + cy.changeCurrencyCHF() + cy.navigatingToThePaymentCHF() + //Payment method choosing + cy.contains('Postfinancepay').click({ force: true }) + cy.get('.condition-label > .js-terms').click({ force: true }) + cy.contains('Postfinancepay').should('be.visible') + }) +}) \ No newline at end of file