Skip to content

Commit

Permalink
Merge pull request #875 from mollie/e2e-updates-january
Browse files Browse the repository at this point in the history
E2E updates january / release 6.0.5 E2E check / code cleaning
  • Loading branch information
SimonasB88 authored Jan 30, 2024
2 parents a084b99 + e43bac9 commit 05418aa
Show file tree
Hide file tree
Showing 27 changed files with 5,803 additions and 25,677 deletions.
32 changes: 0 additions & 32 deletions .docker/.htaccess1785
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,6 @@ RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]


#Domain: demoshop1785.ngrok.io
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^SHOP2$ /SHOP2/ [L,R]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^SHOP2/(.*) /$1 [L]

# Images
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^demoshop1785.ngrok.io$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
Expand Down
2 changes: 1 addition & 1 deletion .docker/Dockerfile.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM prestashop/prestashop:8.1.2-apache
FROM prestashop/prestashop:8.1.3

RUN cd /usr/local/etc/php/conf.d/ && \
echo 'memory_limit = 4096M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini
Expand Down
2 changes: 1 addition & 1 deletion .docker/wait-loader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ if [ "$#" -lt 1 ]; then
fi

port=$1
show_loader "Building app containers. Please wait " "$port" sleep 60
show_loader "Building app containers. Please wait " "$port" sleep 120
6 changes: 3 additions & 3 deletions .github/workflows/E2E_On_PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:
matrix:
include:
- prestashop: 'PS1785'
make: 'make e2eh1785'
make: 'make VERSION=1785 e2eh1785'
subdomain: 'demoshop1785'
port: '8002'
yml: 'docker-compose.1785.yml'
url: 'https://demoshop1785.ngrok.io'
test_spec: '**/cypress/e2e/ps1785/**'
TestRailID: R4954
- prestashop: 'PS8'
make: 'make e2eh8'
make: 'make VERSION=8 e2eh8'
subdomain: 'demoshop8'
port: '8142'
port: '8002'
yml: 'docker-compose.8.yml'
url: 'https://demoshop8.ngrok.io'
test_spec: '**/cypress/e2e/ps8/**'
Expand Down
83 changes: 37 additions & 46 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,61 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
fix-lint:
docker-compose run --rm php sh -c "vendor/bin/php-cs-fixer fix --using-cache=no"

#PS1785 without PS autoinstall, both CI and local
e2eh1785:
# detaching containers
docker-compose -f docker-compose.1785.yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.1785.yml ps
# waits for mysql to load
/bin/bash .docker/wait-for-container.sh mysql-mollie-1785
# configuring your prestashop
docker exec -i prestashop-mollie-1785 sh -c "rm -rf /var/www/html/install"
# configuring base database
mysql -h 127.0.0.1 -P 9002 --protocol=tcp -u root -pprestashop prestashop < ${PWD}/tests/seed/database/prestashop_1785_2.sql
# installing module
docker exec -i prestashop-mollie-1785 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# uninstalling module
docker exec -i prestashop-mollie-1785 sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie"
# installing the module again
docker exec -i prestashop-mollie-1785 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# enabling the module
docker exec -i prestashop-mollie-1785 sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie"
# chmod all folders
docker exec -i prestashop-mollie-1785 sh -c "chmod -R 777 /var/www/html"
# Launch the PS build and E2E Cypress app automatically. Eexample: make VERSION=1785 e2eh1785_local, make VERSION=8 e2eh8_local etc.
# Warning: .env with secrets must be imported if you wanna test locally! This checks the .env existence, ignoring if there is no such on your machine.

#PS8 for local machine docker build with PS autoinstall
e2eh8_local:
ifneq ("$(wildcard .env)","")
include .env
export
endif

# Local machine docker build with PS autoinstall
e2eh$(VERSION)_local:
# detaching containers
docker-compose -f docker-compose.8.yml up -d --force-recreate
docker-compose -f docker-compose.$(VERSION).yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.8.yml ps
docker-compose -f docker-compose.$(VERSION).yml ps
# waiting for app containers to build up
/bin/bash .docker/wait-loader.sh 8142
/bin/bash .docker/wait-loader.sh 8002
# seeding the customized settings for PS
mysql -h 127.0.0.1 -P 9459 --protocol=tcp -u root -pprestashop prestashop < ${PWD}/tests/seed/database/prestashop_8.sql
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie"
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie"
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-8 sh -c "chmod -R 777 /var/www/html"
docker exec -i prestashop-mollie-$(VERSION) sh -c "chmod -R 777 /var/www/html"
make open-e2e-tests-locally

#PS8 for CI build with PS autoinstall
e2eh8:
# For CI build with PS autoinstall
e2eh$(VERSION):
# detaching containers
docker-compose -f docker-compose.8.yml up -d --force-recreate
docker-compose -f docker-compose.$(VERSION).yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.8.yml ps
docker-compose -f docker-compose.$(VERSION).yml ps
# waiting for app containers to build up
sleep 90s
# seeding the customized settings for PS
mysql -h 127.0.0.1 -P 9459 --protocol=tcp -u root -pprestashop prestashop < ${PWD}/tests/seed/database/prestashop_8.sql
# configuring base database
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie"
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
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-8 sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie"
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-8 sh -c "chmod -R 777 /var/www/html"
docker exec -i prestashop-mollie-$(VERSION) sh -c "chmod -R 777 /var/www/html"

npm-package-install:
cd views/assets && npm i && npm run build
open-e2e-tests-locally:
npm install -D cypress
npm ci
npx cypress open --config baseUrl=$(ENV_baseUrl$(VERSION)) --env MOLLIE_TEST_API_KEY='$(ENV_MOLLIE_TEST_API_KEY)'

run-e2e-tests-locally:
npm install -D cypress
Expand All @@ -88,3 +76,6 @@ upgrading-module-test-1785:
git checkout -- .
git checkout develop --force
docker exec -i prestashop-mollie-1785 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"

npm-package-install:
cd views/assets && npm i && npm run build
13 changes: 1 addition & 12 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,14 @@ module.exports = defineConfig({
defaultCommandTimeout: 30000,
projectId: 'xb89dr',
retries: 2,
video: true,
videoCompression: 8,
viewportHeight: 1080,
viewportWidth: 1920,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === 'failed')
)
if (!failures) {
// delete the video if the spec passed and no tests retried
fs.unlinkSync(results.video)
}
}
})
require('./cypress/plugins/index.js')(on, config)
require("cypress-fail-fast/plugin")(on, config);
require('cypress-terminal-report/src/installLogsPrinter')(on);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ it('C339339: 03 Checking the Advanced Settings tab, verifying the Front-end comp
cy.get('[id="MOLLIE_AS_STATUSES_info"]').should('exist')
cy.get('[name="MOLLIE_DISPLAY_ERRORS"]').should('exist')
cy.get('[name="MOLLIE_DEBUG_LOG"]').should('exist')
cy.get('[name="MOLLIE_SUBSCRIPTION_ORDER_CARRIER_ID"]').should('be.visible') // checking the Subscriptions carriers select
cy.get('[name="MOLLIE_SUBSCRIPTION_ORDER_CARRIER_ID"]').select('My carrier')
cy.get('#module_form_submit_btn').click({force:true}) //checking the saving
cy.get('[class="alert alert-success"]').should('be.visible') //checking if saving returns green alert
cy.reload()
cy.matchImage(); // let's make a snapshot for visual regression testing later, if UI matches
//cy.window() will check if there are no Errors in console
Expand All @@ -90,6 +86,7 @@ it('C688472: Checking the Subscriptions tab, and console errors', () => {
cy.OpeningModuleDashboardURL()
cy.get('#subtab-AdminMollieSubscriptionOrders').click()
cy.get('[id="invertus_mollie_subscription_grid_panel"]').should('be.visible')
cy.selectSubscriptionsCarriersCheck() // checking the Subscriptions carriers select and saving
});
it('C688473: Checking the Subscriptions FAQ, and console errors', () => {
cy.visit('/admin1/')
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ it('C339360: 23 IN3 Checking that IN3 logo exists OK [Orders API]', () => {
cy.get('[type="submit"]').first().click({force:true})
cy.get('[class="alert alert-success"]').should('be.visible')
cy.visit('/de/index.php?controller=history')
cy.get('a').click()
cy.contains('Reorder').click()
cy.contains('NL').click()
//Billing country LT, DE etc.
Expand Down Expand Up @@ -342,7 +341,6 @@ it.skip('41 Gift Card Order Shipping, Refunding [Orders API]', () => {
})
it('C1765085: Billie Checkouting [Orders API]', () => {
cy.visit('/de/index.php?controller=history')
cy.get('a').click()
cy.contains('Reorder').click()
cy.contains('DE').click()
//Billing country LT, DE etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ it('C339385: 50 Credit Card Guest Checkouting [Payments API]', () => {
cy.get('#field-siret').type('DE123456')
cy.get('[name="password"]').first().type('123456')
cy.contains('Customer data privacy').click()
cy.contains('I agree').click()
cy.get('#customer-form > .form-footer > .continue').click()
cy.reload()
cy.get(':nth-child(6) > .col-md-6 > .form-control').type('123456',{delay:0})
Expand All @@ -119,7 +120,7 @@ it('C339385: 50 Credit Card Guest Checkouting [Payments API]', () => {
cy.get('[class="button form__button"]').click()
cy.get('#content-hook_order_confirmation > .card-block').should('be.visible')
})
it('C339386: 51 Credit Card Guest Checkouting with not 3DS secure card [Payments API]', () => {
it('C339386: 51 Credit Card Guest Checkouting with non 3DS secure card [Payments API]', () => {
cy.clearCookies()
//Payments API item
cy.visit('/de/', { headers: {"Accept-Encoding": "gzip, deflate"}})
Expand All @@ -139,6 +140,7 @@ it('C339386: 51 Credit Card Guest Checkouting with not 3DS secure card [Payments
cy.get('#field-siret').type('DE123456')
cy.get('[name="password"]').first().type('123456')
cy.contains('Customer data privacy').click()
cy.contains('I agree').click()
cy.get('#customer-form > .form-footer > .continue').click()
cy.reload()
cy.get(':nth-child(6) > .col-md-6 > .form-control').type('123456',{delay:0})
Expand Down Expand Up @@ -263,7 +265,6 @@ it('C339400: 65 Belfius BO Refunding, Partial Refunding [Payments API]', () => {
});
it('C339401: 66 Bank Transfer Checkouting [Payments API]', () => {
cy.visit('/en/index.php?controller=history')
cy.get('a').click()
cy.contains('Reorder').click()
cy.contains('NL').click()
//Billing country LT, DE etc.
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/ps8/01_mollie.ps8.ModuleConfiguration.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ it('C688472: Checking the Subscriptions tab, and console errors', () => {
cy.get('#subtab-AdminMollieModule').click()
cy.get('#subtab-AdminMollieSubscriptionOrders').click()
cy.get('[id="invertus_mollie_subscription_grid_panel"]').should('be.visible')
cy.selectSubscriptionsCarriersCheck() // checking the Subscriptions carriers select and saving
});
it('C688473: Checking the Subscriptions FAQ, and console errors', () => {
cy.visit('/admin1/')
Expand Down
6 changes: 5 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Cypress.Commands.add("navigatingToThePaymentPS8", () => {
})
Cypress.Commands.add("navigatingToThePayment", () => {
cy.visit('/de/index.php?controller=history')
cy.get('a').click()
cy.contains('Reorder').click()
cy.contains('NL').click()
//Billing country LT, DE etc.
Expand Down Expand Up @@ -273,3 +272,8 @@ Cypress.Commands.add("CachingBOFOPS8", {cacheAcrossSpecs: true}, () => {
}
login('MollieBOFOLoggingIn')
})
Cypress.Commands.add("selectSubscriptionsCarriersCheck", {cacheAcrossSpecs: true}, () => {
cy.get('#form_carrier').select(1)
cy.contains('Save').click()
cy.contains('Options saved successfully.').should('be.visible') //checking if saving returns green alert
})
10 changes: 5 additions & 5 deletions docker-compose.1785.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ services:
interval: 10s
networks:
- prestashop_mollie_net_1785

prestashop-17:
#platform: linux/amd64
container_name: prestashop-mollie-1785
build:
context: .
dockerfile: .docker/Dockerfile.1785
environment:
PS_INSTALL_AUTO: 0
PS_INSTALL_AUTO: 1
PS_ENABLE_SSL: 1
DB_PASSWD: $DB_PASSWD
DB_NAME: prestashop
DB_SERVER: mysql
PS_DOMAIN: demoshop1785.ngrok.io:8002
PS_DOMAIN: demoshop1785.ngrok.io
PS_FOLDER_INSTALL: install
PS_FOLDER_ADMIN: admin1
depends_on:
- mysql
ports:
- "8002:80"
volumes:
- ./:/var/www/html/modules/mollie:cached
- ./tests/seed/settings1785/defines.inc.php:/var/www/html/config/defines.inc.php
- ./tests/seed/settings1785/parameters.php:/var/www/html/app/config/parameters.php
- ./:/var/www/html/modules/mollie
- ./.docker/.htaccess1785:/var/www/html/.htaccess
networks:
- prestashop_mollie_net_1785
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
container_name: mysql-mollie-8
image: mysql:5.7
ports:
- "9459:3306"
- "9002:3306"
environment:
MYSQL_ROOT_PASSWORD: prestashop
MYSQL_DATABASE: prestashop
Expand Down Expand Up @@ -34,14 +34,14 @@ services:
depends_on:
- mysql
ports:
- "8142:80"
- "8002:80"
volumes:
- ./:/var/www/html/modules/mollie
- ./.docker/.htaccess8:/var/www/html/.htaccess
networks:
- prestashop_mollie_net_8
healthcheck:
test: "curl -f localhost:8142"
test: "curl -f localhost:8002"
interval: 5s
timeout: 5s
retries: 10
Expand Down
20 changes: 0 additions & 20 deletions docker-compose.e2e.1785.yml

This file was deleted.

Loading

0 comments on commit 05418aa

Please sign in to comment.