Skip to content

Commit

Permalink
Merge pull request #843 from mollie/e2efix2-6.0.x
Browse files Browse the repository at this point in the history
E2Efix2 6.0.x
  • Loading branch information
SimonasB88 authored Dec 12, 2023
2 parents 2d5228a + f9564ba commit 5a8cfaa
Show file tree
Hide file tree
Showing 28 changed files with 2,538 additions and 2,647 deletions.
25 changes: 10 additions & 15 deletions .docker/.htaccess8
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L]

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

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
Expand All @@ -54,11 +54,6 @@ AddType font/woff2 .woff2
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>

<FilesMatch "\.pdf$">
Header set Content-Disposition "Attachment"
Header set X-Content-Type-Options "nosniff"
</FilesMatch>
</IfModule>

<Files composer.lock>
Expand Down
6 changes: 5 additions & 1 deletion .docker/Dockerfile.8
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
FROM prestashop/prestashop:8.0.5-apache
FROM prestashop/prestashop:8.1.2-apache

RUN cd /usr/local/etc/php/conf.d/ && \
echo 'memory_limit = 4096M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini

RUN echo 'max_execution_time = 120' >> /usr/local/etc/php/conf.d/docker-php-maxexectime.ini

HEALTHCHECK --interval=5m --timeout=3s \
CMD curl -f http://localhost/ || exit 1


32 changes: 32 additions & 0 deletions .docker/wait-loader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

spinner() {
local pid=$1
local delay=0.1
local spinstr='|/-\'
while ps a | awk '{print $1}' | grep -q $pid; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}

# Function to display loader with a message
show_loader() {
local message=$1
shift
echo -n "$message"
( "$@" ) &
local loader_pid=$!
while ps a | awk '{print $1}' | grep -q $loader_pid; do
sleep 0.5
echo -n ""
done
echo " Done."
}

# Usage example
show_loader "Building app containers. Please wait " sleep 60
15 changes: 14 additions & 1 deletion .github/workflows/E2E_On_PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
TestRailID: R6470
env:
NGROK_TOKEN: ${{ secrets.NGROK_TOKEN }}
DB_PASSWD: ${{ secrets.DB_PASSWD }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down Expand Up @@ -60,8 +61,18 @@ jobs:
- name: Waiting for Ngrok tunnel
run: |
URL="${{ matrix.url }}"
TIMEOUT=120
start_time=$(date +%s)
while true; do
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
echo "Timeout reached. Ngrok tunnel is not ready within $TIMEOUT seconds."
exit 1
fi
response=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$response" = "302" ]; then
echo "URL is returning 302 HTTP status code, Ngrok tunnel is reached, good to go!"
Expand All @@ -73,6 +84,7 @@ jobs:
fi
done
- name: Running ${{ matrix.prestashop }} Cypress E2E tests
run: |
export CYPRESS_baseUrl='${{ matrix.url }}'
Expand All @@ -82,9 +94,10 @@ jobs:
export CYPRESS_TESTRAIL_DOMAIN='${{ secrets.TESTRAIL_DOMAIN }}'
export CYPRESS_TESTRAIL_USERNAME='${{ secrets.TESTRAIL_USERNAME }}'
export CYPRESS_TESTRAIL_PASSWORD='${{ secrets.TESTRAIL_PASSWORD }}'
npx cypress cache prune
npm install -D cypress
npm ci
npx cypress run --spec "${{ matrix.test_spec }}" --browser chrome
npx cypress run --spec "${{ matrix.test_spec }}"
- name: Archive videos and screenshots
if: ${{ always() }}
Expand Down
28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,34 @@ e2eh1785:
docker exec -i prestashop-mollie-1785 sh -c "chmod -R 777 /var/www/html"

#PS8
e2eh8_local:
# detaching containers
docker-compose -f docker-compose.8.yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.8.yml ps
# waiting for app containers to build up
/bin/bash .docker/wait-loader.sh
# 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
# installing module
docker exec -i prestashop-mollie-8 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"
# installing the module again
docker exec -i prestashop-mollie-8 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"
# chmod all folders
docker exec -i prestashop-mollie-8 sh -c "chmod -R 777 /var/www/html"

e2eh8:
# detaching containers
docker-compose -f docker-compose.8.yml up -d --force-recreate
# sees what containers are running
docker-compose -f docker-compose.8.yml ps
# waits for mysql to load
/bin/bash .docker/wait-for-container.sh mysql-mollie-8
# configuring your prestashop
docker exec -i prestashop-mollie-8 sh -c "rm -rf /var/www/html/install"
# configuring base database
# 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
# installing module
docker exec -i prestashop-mollie-8 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module.exports = defineConfig({
chromeWebSecurity: false,
experimentalMemoryManagement: true,
experimentalSourceRewriting: true,
numTestsKeptInMemory: 0,
numTestsKeptInMemory: 5,
defaultCommandTimeout: 30000,
projectId: 'xb89dr',
retries: 3,
retries: 2,
videoCompression: 8,
viewportHeight: 1080,
viewportWidth: 1920,
Expand Down
20 changes: 0 additions & 20 deletions cypress/downloads/index.php

This file was deleted.

40 changes: 6 additions & 34 deletions cypress/e2e/ps1785/01_mollie.ps1785.ModuleConfiguration.specs.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
/// <reference types="Cypress" />
function prepareCookie()
{
const name = 'PrestaShop-';

cy.request(
{
url: '/'
}
).then((res) => {

const cookies = res.requestHeaders.cookie.split(/; */);

cookies.forEach(cookie => {

const parts = cookie.split('=');
const key = parts[0]
const value = parts[1];

if (key.startsWith(name)) {
cy.setCookie(
key,
value,
{
sameSite: 'None',
secure: true
}
);
}
});

});
}
//Caching the BO and FO session
const login = (MollieBOFOLoggingIn) => {
cy.session(MollieBOFOLoggingIn,() => {
Expand Down Expand Up @@ -74,8 +42,10 @@ it('C339305: 01 Connecting test API successsfully', () => {
it('C339338: 02 Enabling Mollie carriers in Prestashop successfully', () => {
cy.visit('/admin1/')
cy.get('[id="subtab-AdminPaymentPreferences"]').find('[href]').eq(0).click({force:true})
cy.get('[class="js-multiple-choice-table-select-column"]').eq(6).click()
cy.get('[class="btn btn-primary"]').eq(3).click()
cy.get('[class="js-multiple-choice-table-select-column"]').each(($element) => { // checks all the checkboxes in the loop, if not checked
cy.wrap($element).click()
})
cy.get('[id="form-carrier-restrictions-save-button"]').click()
})
it('C339339: 03 Checking the Advanced Settings tab, verifying the Front-end components, Saving the form, checking if there are no Errors in Console', () => {
cy.visit('/admin1/')
Expand Down Expand Up @@ -107,6 +77,8 @@ 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.window() will check if there are no Errors in console
Expand Down
Loading

0 comments on commit 5a8cfaa

Please sign in to comment.