From f5ad046168e38b5fd065e32096464690ff4a5abe Mon Sep 17 00:00:00 2001 From: Justas Vaitkus Date: Fri, 12 Jul 2024 19:29:48 +0300 Subject: [PATCH] fix --- cypress/e2e/authorizeAfterAuthorization.cy.js | 24 ++++++++++++----- .../e2e/authorizeBeforeAuthorization.cy.js | 2 +- cypress/e2e/captureAfterAuthorization.cy.js | 2 +- cypress/e2e/captureBeforeAuthorization.cy.js | 2 +- cypress/support/commands.js | 27 ++++++++++++++++++- 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/cypress/e2e/authorizeAfterAuthorization.cy.js b/cypress/e2e/authorizeAfterAuthorization.cy.js index 97e8de8e..4b55b110 100644 --- a/cypress/e2e/authorizeAfterAuthorization.cy.js +++ b/cypress/e2e/authorizeAfterAuthorization.cy.js @@ -33,22 +33,34 @@ describe('PS1789 Tests Suite -> Authorization + After order creation', { it('A2A guest success', () => { cy.clearCookies() - cy.visit('/en/stationery/16-28-mountain-fox-notebook.html#/22-paper_type-ruled', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.visit('/en/home/1-spproduct.html', { headers: {"Accept-Encoding": "gzip, deflate"}}) // cy.changeCurrencyCHF() cy.guestCheckoutCHF() cy.contains('Accounttoaccount').should('be.visible') - }) - it('TWINT Checkouting', () => { - cy.visit('/en/order-history') + + it('Twint guest success', () => { + cy.clearCookies() + cy.visit('/en/home/1-spproduct.html', { headers: {"Accept-Encoding": "gzip, deflate"}}) cy.changeCurrencyCHF() - cy.navigatingToThePaymentCHF() + cy.guestCheckout() 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('TWINT Checkouting', () => { + // cy.visit('/en/order-history') + // cy.changeCurrencyCHF() + // cy.navigatingToThePaymentCHF() + // 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() diff --git a/cypress/e2e/authorizeBeforeAuthorization.cy.js b/cypress/e2e/authorizeBeforeAuthorization.cy.js index f8fccc99..8b1ffd82 100644 --- a/cypress/e2e/authorizeBeforeAuthorization.cy.js +++ b/cypress/e2e/authorizeBeforeAuthorization.cy.js @@ -34,7 +34,7 @@ describe('PS1789 Tests Suite -> Authorization + order creation before authorizat it('A2A guest success', () => { cy.clearCookies() - cy.visit('/en/stationery/16-28-mountain-fox-notebook.html#/22-paper_type-ruled', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.visit('/en/home/1-spproduct.html', { headers: {"Accept-Encoding": "gzip, deflate"}}) // cy.changeCurrencyCHF() cy.guestCheckoutCHF() cy.contains('Accounttoaccount').should('be.visible') diff --git a/cypress/e2e/captureAfterAuthorization.cy.js b/cypress/e2e/captureAfterAuthorization.cy.js index 99048874..cbb00426 100644 --- a/cypress/e2e/captureAfterAuthorization.cy.js +++ b/cypress/e2e/captureAfterAuthorization.cy.js @@ -34,7 +34,7 @@ describe('PS1789 Tests Suite -> With auto capture payments + create order after it('A2A guest success', () => { cy.clearCookies() - cy.visit('/en/stationery/16-28-mountain-fox-notebook.html#/22-paper_type-ruled', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.visit('/en/home/1-spproduct.html', { headers: {"Accept-Encoding": "gzip, deflate"}}) // cy.changeCurrencyCHF() cy.guestCheckoutCHF() cy.contains('Accounttoaccount').should('be.visible') diff --git a/cypress/e2e/captureBeforeAuthorization.cy.js b/cypress/e2e/captureBeforeAuthorization.cy.js index 4d2a4643..5dfb1156 100644 --- a/cypress/e2e/captureBeforeAuthorization.cy.js +++ b/cypress/e2e/captureBeforeAuthorization.cy.js @@ -34,7 +34,7 @@ describe('PS1789 Tests Suite -> With auto capture payments and order creation be it('A2A guest success', () => { cy.clearCookies() - cy.visit('/en/stationery/16-28-mountain-fox-notebook.html#/22-paper_type-ruled', { headers: {"Accept-Encoding": "gzip, deflate"}}) + cy.visit('/en/home/1-spproduct.html', { headers: {"Accept-Encoding": "gzip, deflate"}}) // cy.changeCurrencyCHF() cy.guestCheckoutCHF() cy.contains('Accounttoaccount').should('be.visible') diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 9d148b7f..2616624e 100755 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -99,7 +99,7 @@ Cypress.Commands.add( Cypress.Commands.add("navigatingToThePayment", () => { cy.visit('/en/order-history') cy.contains('Reorder').click() - cy.contains('France').click() + cy.contains('Germany').click() //Billing country LT, DE etc. cy.get('.clearfix > .btn').click() cy.get('#js-delivery > .continue').click() @@ -130,6 +130,31 @@ Cypress.Commands.add( cy.get('#js-delivery > .continue').click() }) + Cypress.Commands.add("guestCheckout", () => { + cy.get('.add > .btn').click() + cy.get('.cart-content-btn > .btn-primary').click() + cy.get('.text-sm-center > .btn').click() + // Creating random user all the time + cy.get(':nth-child(1) > .custom-radio > input').check() + cy.get('#field-firstname').type('AUT',{delay:0}) + cy.get(':nth-child(3) > .col-md-6 > .form-control').type('AUT',{delay:0}) + const uuid = () => Cypress._.random(0, 1e6) + const id = uuid() + const testname = `testemail${id}@testing.com` + cy.get('[name="email"]').first().type(testname, {delay: 0}) + cy.contains('Customer data privacy').click() + cy.contains('I agree').click() + cy.get('#customer-form > .form-footer > .continue').click() + cy.get('#field-address1').type('ADDR',{delay:0}).as('address 1') + cy.get('#field-address2').type('ADDR2',{delay:0}).as('address2') + cy.get('#field-postcode').type('54460',{delay:0}).as('zip') + cy.get('#field-city').type('Zurich',{delay:0}).as('city') + cy.get('#field-id_country').select('Germany').as('country') + cy.get('#field-phone').type('+370 000',{delay:0}).as('telephone') + cy.get('[name="confirm-addresses"]').click(); + cy.get('#js-delivery > .continue').click() + }) + Cypress.Commands.add("changeCurrencyCHF", () => { cy.get('[aria-label="Currency dropdown"]').click(); cy.contains('a', 'CHF').click();