Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Justas Vaitkus authored and Justas Vaitkus committed Jul 12, 2024
1 parent cde2277 commit f5ad046
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
24 changes: 18 additions & 6 deletions cypress/e2e/authorizeAfterAuthorization.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/authorizeBeforeAuthorization.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/captureAfterAuthorization.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/captureBeforeAuthorization.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
27 changes: 26 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f5ad046

Please sign in to comment.