Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonasB88 committed Feb 26, 2024
1 parent ea4eb82 commit d4e3835
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 156 deletions.
18 changes: 2 additions & 16 deletions cypress/e2e/ps1785/01_mollie.ps1785.ModuleConfiguration.specs.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
cy.visit('/en/my-account')
cy.get('#login-form [name="email"]').eq(0).type('[email protected]')
cy.get('#login-form [name="password"]').eq(0).type('demodemo')
cy.get('#login-form [type="submit"]').eq(0).click({force:true})
cy.get('#history-link > .link-item').click()
})
}

//Checking the console for errors
let windowConsoleError;
Cypress.on('window:before:load', (win) => {
Expand All @@ -30,7 +16,7 @@ afterEach(function() {
describe('PS1785 Module initial configuration setup', () => {
beforeEach(() => {
cy.viewport(1920,1080)
login('MollieBOFOLoggingIn')
cy.CachingBOFOPS1785()
})
it('C339305: 01 Connecting test API successsfully', () => {
cy.visit('/admin1/')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
})
}

//Checking the console for errors
let windowConsoleError;
Cypress.on('window:before:load', (win) => {
Expand All @@ -25,7 +16,7 @@ afterEach(function() {
describe('PS1785 Enabling Payments', () => {
beforeEach(() => {
cy.viewport(1920,1080)
login('MollieBOFOLoggingIn')
cy.CachingBOFOPS1785()
})
it('C339341: 04 Enabling All payments in Module BO [Orders API]', () => {
cy.visit('/admin1/')
Expand Down
47 changes: 4 additions & 43 deletions cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
cy.visit('/en/my-account')
cy.get('#login-form [name="email"]').eq(0).type('[email protected]')
cy.get('#login-form [name="password"]').eq(0).type('demodemo')
cy.get('#login-form [type="submit"]').eq(0).click({force:true})
cy.get('#history-link > .link-item').click()
})
}

//Checking the console for errors
let windowConsoleError;
Cypress.on('window:before:load', (win) => {
Expand All @@ -28,8 +14,8 @@ describe('PS1785 Tests Suite [Orders API]', {
},
}, () => {
beforeEach(() => {
login('MollieBOFOLoggingIn')
cy.viewport(1920,1080)
cy.CachingBOFOPS1785()
})
it.skip('C339342: 05 Vouchers Checkouting [Orders API]', () => { //possible bug
cy.navigatingToThePayment()
Expand Down Expand Up @@ -216,31 +202,6 @@ it('C339361: 24 Paypal Checkouting [Orders API]', () => {
it('C339362: 25 Paypal Order Shipping, Refunding [Orders API]', () => {
cy.OrderRefundingShippingOrdersAPI()
})
it('C339363: 26 SOFORT Checkouting [Orders API]', () => {
cy.navigatingToThePayment()
//Payment method choosing
cy.contains('SOFORT').click({force:true})
cy.get('.condition-label > .js-terms').click({force:true})
cy.contains('Place order').click()
cy.get('[value="paid"]').click()
cy.get('[class="button form__button"]').click()
cy.get('#content-hook_order_confirmation > .card-block').should('be.visible')
});
it('C339364: 27 SOFORT Order Shipping, Refunding [Orders API]', () => {
cy.visit('/admin1/index.php?controller=AdminOrders')
cy.get(':nth-child(1) > .column-payment').click()
//Shipping button in React
cy.get('.btn-group > .btn-primary').click()
cy.get('[class="swal-button swal-button--confirm"]').click()
cy.get('.swal-modal').should('exist')
cy.get('#input-carrier').clear({force: true}).type('FedEx',{delay:0})
cy.get('#input-code').clear({force: true}).type('123456',{delay:0})
cy.get('#input-url').clear({force: true}).type('https://www.invertus.eu',{delay:0})
cy.get(':nth-child(2) > .swal-button').click()
cy.get('#mollie_order > :nth-child(1) > .alert').contains('Shipment was made successfully!')
cy.get('[class="alert alert-success"]').should('be.visible')
//Refunding not possible because "We haven't received the payment on our bank accounts yet" message from Mollie Dashboard
})
it('C339365: 28 Przelewy24 Checkouting [Orders API]', () => {
cy.navigatingToThePayment()
//Payment method choosing
Expand Down Expand Up @@ -357,7 +318,7 @@ it('C1765085: Billie Checkouting [Orders API]', () => {
it('C1765086: Billie Order Shipping, Refunding [Orders API]', () => {
cy.OrderShippingRefundingOrdersAPI()
})
it.skip('C1860460: Pay with Klarna UK Checkouting [Orders API]', () => { // currently not supported for PS, skipping temporary
it('C1860460: Pay with Klarna UK Checkouting [Orders API]', () => { // currently not supported for PS, skipping temporary
cy.visit('/en/order-history')
cy.contains('Reorder').click()
cy.contains('UK').click({force:true})
Expand All @@ -372,7 +333,7 @@ it.skip('C1860460: Pay with Klarna UK Checkouting [Orders API]', () => { // curr
cy.get('[class="button form__button"]').click()
cy.get('#content-hook_order_confirmation > .card-block').should('be.visible')
});
it.skip('C1860461: Pay with Klarna UK Order Shipping, Refunding [Orders API]', () => { // currently not supported for PS, skipping temporary
it.only('C1860461: Pay with Klarna UK Order Shipping, Refunding [Orders API]', () => { // currently not supported for PS, skipping temporary
cy.OrderShippingRefundingOrdersAPI()
})
})
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
})
}

//Checking the console for errors
let windowConsoleError;
Cypress.on('window:before:load', (win) => {
Expand All @@ -25,7 +16,7 @@ afterEach(function() {
describe('PS1785 Enabling Payments', () => {
beforeEach(() => {
cy.viewport(1920,1080)
login('MollieBOFOLoggingIn')
cy.CachingBOFOPS1785()
})
it('C339377: 42 [SWITCH TO PAYMENTS API] Enabling All payments in Module BO [Payments API]', () => {
cy.visit('/admin1/')
Expand Down
18 changes: 2 additions & 16 deletions cypress/e2e/ps1785/05_mollie.ps1785.PaymentTestsPaymentsAPI.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
cy.visit('/en/my-account')
cy.get('#login-form [name="email"]').eq(0).type('[email protected]')
cy.get('#login-form [name="password"]').eq(0).type('demodemo')
cy.get('#login-form [type="submit"]').eq(0).click({force:true})
cy.get('#history-link > .link-item').click()
})
}

//Checking the console for errors
let windowConsoleError;
Cypress.on('window:before:load', (win) => {
Expand All @@ -28,8 +14,8 @@ describe('PS1785 Tests Suite [Payments API]', {
},
}, () => {
beforeEach(() => {
login('MollieBOFOLoggingIn')
cy.viewport(1920,1080)
cy.CachingBOFOPS1785()
})
it('C339378: 43 Check if Bancontact QR payment dropdown exists [Payments API]', () => {
cy.visit('/admin1/')
Expand Down
18 changes: 2 additions & 16 deletions cypress/e2e/ps1785/06_mollie.ps1785.Subscriptions.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
cy.visit('/en/my-account')
cy.get('#login-form [name="email"]').eq(0).type('[email protected]')
cy.get('#login-form [name="password"]').eq(0).type('demodemo')
cy.get('#login-form [type="submit"]').eq(0).click({force:true})
cy.get('#history-link > .link-item').click()
})
}

//Checking the console for errors
let windowConsoleError;
Cypress.on('window:before:load', (win) => {
Expand All @@ -25,7 +11,7 @@ expect(windowConsoleError).to.not.be.called;
describe('PS1785 Subscriptions Test Suite', () => {
beforeEach(() => {
cy.viewport(1920,1080)
login('MollieBOFOLoggingIn')
cy.CachingBOFOPS1785()
})
it.skip('C176305: Check if Subscription options added in Product BO', () => { // temporary skip, somehow duplicated Subscriptions UI appearing in the product page
cy.visit('/admin1/')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ps1785/07_mollie.ps1785.Cloudsync.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ afterEach(function() {
describe('PS8 Cloudsync tests', () => {
beforeEach(() => {
cy.viewport(1920,1080)
cy.CachingBOFOPS8()
cy.CachingBOFOPS1785()
})
it('Checking if Cloudsync UI is appearing in the module', () => {
cy.OpeningModuleDashboardURL()
Expand Down
17 changes: 1 addition & 16 deletions cypress/e2e/ps1785/07_mollie.ps1785.VisualRegressionTests.cy.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
/// <reference types="Cypress" />
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
cy.visit('/admin1/')
cy.url().should('contain', 'https').as('Check if HTTPS exists')
cy.get('#email').type('[email protected]',{delay: 0, log: false})
cy.get('#passwd').type('demodemo',{delay: 0, log: false})
cy.get('#submit_login').click().wait(1000).as('Connection successsful')
cy.visit('/en/my-account')
cy.get('#login-form [name="email"]').eq(0).type('[email protected]')
cy.get('#login-form [name="password"]').eq(0).type('demodemo')
cy.get('#login-form [type="submit"]').eq(0).click({force:true})
cy.get('#history-link > .link-item').click()
})
}

describe('PS1785 Visual Regression tests suite', {
retries: {
Expand All @@ -25,7 +10,7 @@ describe('PS1785 Visual Regression tests suite', {
}
},() => {
beforeEach(() => {
login('MollieBOFOLoggingIn')
cy.CachingBOFOPS1785()
})
it('PS1785 - Testing the visual regression of General Settings page', () => {
cy.visit('/admin1/')
Expand Down
27 changes: 1 addition & 26 deletions cypress/e2e/ps8/03_mollie.ps8.PaymentTestsOrdersAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,31 +191,6 @@ it('C339361: 24 Paypal Checkouting [Orders API]', () => {
it('C339362: 25 Paypal Order Shipping, Refunding [Orders API]', () => {
cy.OrderRefundingShippingOrdersAPI()
})
it('C339363: 26 SOFORT Checkouting [Orders API]', () => {
cy.navigatingToThePaymentPS8()
//Payment method choosing
cy.contains('SOFORT').click({force:true})
cy.get('.condition-label > .js-terms').click({force:true})
cy.contains('Place order').click()
cy.get('[value="paid"]').click()
cy.get('[class="button form__button"]').click()
cy.get('#content-hook_order_confirmation > .card-block').should('be.visible')
});
it('C339364: 27 SOFORT Order Shipping, Refunding [Orders API]', () => {
cy.visit('/admin1/index.php?controller=AdminOrders')
cy.get(':nth-child(1) > .column-payment').click()
//Shipping button in React
cy.get('.btn-group > .btn-primary').click()
cy.get('[class="swal-button swal-button--confirm"]').click()
cy.get('.swal-modal').should('exist')
cy.get('#input-carrier').clear({force: true}).type('FedEx',{delay:0})
cy.get('#input-code').clear({force: true}).type('123456',{delay:0})
cy.get('#input-url').clear({force: true}).type('https://www.invertus.eu',{delay:0})
cy.get(':nth-child(2) > .swal-button').click()
cy.get('#mollie_order > :nth-child(1) > .alert').contains('Shipment was made successfully!')
cy.get('[class="alert alert-success"]').should('be.visible')
//Refunding not possible because "We haven't received the payment on our bank accounts yet" message from Mollie Dashboard
})
it('C339365: 28 Przelewy24 Checkouting [Orders API]', () => {
cy.navigatingToThePaymentPS8()
//Payment method choosing
Expand All @@ -240,7 +215,7 @@ it('C339367: 30 Giropay Checkouting [Orders API]', () => {
cy.get('#content-hook_order_confirmation > .card-block').should('be.visible')
});
it('C339368: 31 Giropay Order Shipping, Refunding [Orders API]', () => {
cy.OrderRefundingShippingOrdersAPI()
cy.OrderRefundingShippingOrdersAPI()
})
it('C339369: 32 EPS Checkouting [Orders API]', () => {
cy.navigatingToThePaymentPS8()
Expand Down

0 comments on commit d4e3835

Please sign in to comment.