Skip to content

Commit

Permalink
Merge pull request #881 from mollie/develop-e2e-improvements
Browse files Browse the repository at this point in the history
`develop` e2e improvements (testing the build)
  • Loading branch information
SimonasB88 authored Mar 6, 2024
2 parents cff9740 + 0a22ff0 commit 07e54f5
Show file tree
Hide file tree
Showing 22 changed files with 2,883 additions and 545 deletions.
79 changes: 0 additions & 79 deletions .docker/.htaccess1785

This file was deleted.

53 changes: 29 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
module = mollie

# target: fix-lint - Launch php cs fixer
fix-lint:
Expand All @@ -14,26 +15,15 @@ endif

# Local machine docker build with PS autoinstall
e2eh$(VERSION)_local:
composer install
# detaching containers
docker-compose -f docker-compose.$(VERSION).yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.$(VERSION).yml ps
# waiting for app containers to build up
/bin/bash .docker/wait-loader.sh 8002
# seeding the customized settings for PS
mysql -h 127.0.0.1 -P 9002 --protocol=tcp -u root -pprestashop prestashop < ${PWD}/tests/seed/database/prestashop_$(VERSION).sql
# installing module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# installing module (in case for Addons Marketplace)
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# uninstalling module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie"
# installing the module again
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# enabling the module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie"
# chmod all folders
docker exec -i prestashop-mollie-$(VERSION) sh -c "chmod -R 777 /var/www/html"
make waiting-for-containers-local
make seeding-customized-sql
make installing-uninstalling-enabling-module
make chmod-app
make open-e2e-tests-locally

# For CI build with PS autoinstall
Expand All @@ -42,20 +32,35 @@ e2eh$(VERSION):
docker-compose -f docker-compose.$(VERSION).yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.$(VERSION).yml ps
make waiting-for-containers-CI
make seeding-customized-sql
make installing-uninstalling-enabling-module
make chmod-app

waiting-for-containers-CI:
# waiting for app containers to build up
sleep 90s
# configuring base database

waiting-for-containers-local:
# waiting for app containers to build up
/bin/bash .docker/wait-loader.sh 8002

seeding-customized-sql:
mysql -h 127.0.0.1 -P 9002 --protocol=tcp -u root -pprestashop prestashop < ${PWD}/tests/seed/database/prestashop_$(VERSION).sql

installing-uninstalling-enabling-module:
# installing module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install $(module)"
# uninstalling module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module uninstall $(module)"
# installing the module again
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install $(module)"
# enabling the module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module enable $(module)"

chmod-app:
# chmod all folders
docker exec -i prestashop-mollie-$(VERSION) sh -c "chmod -R 777 /var/www/html"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "chmod -R 777 /var/www/html"

open-e2e-tests-locally:
npm install -D cypress
Expand All @@ -73,11 +78,11 @@ upgrading-module-test-$(VERSION):
git checkout v5.2.0 .
composer install
# installing 5.2.0 module
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install $(module)"
# installing develop branch module
git checkout -- .
git checkout develop --force
docker exec -i prestashop-mollie-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
docker exec -i prestashop-$(module)-$(VERSION) sh -c "cd /var/www/html && php bin/console prestashop:module install $(module)"

npm-package-install:
cd views/assets && npm i && npm run build
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]', () => {
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('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
Loading

0 comments on commit 07e54f5

Please sign in to comment.