Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2Efix2 6.0.x #843

Merged
merged 70 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2def33d
cypress update
SimonasB88 Oct 30, 2023
aa5776a
fixing billie payment test spec
SimonasB88 Oct 30, 2023
29fecd5
adding forEach, refactoring E2E test code
SimonasB88 Oct 30, 2023
76efc2d
removing useless lines
SimonasB88 Oct 30, 2023
cf33269
added Klarna UK payment
SimonasB88 Oct 30, 2023
78a190b
Update prestashop_1785_2.sql
SimonasB88 Oct 30, 2023
714b747
test spec updates
SimonasB88 Oct 30, 2023
dc62b71
specs updates for testrail mapping
SimonasB88 Oct 30, 2023
4dae066
Update prestashop_8.sql
SimonasB88 Oct 30, 2023
082476e
Update 03_mollie.ps1785.PaymentTestsOrdersAPI.js
SimonasB88 Oct 30, 2023
33512b9
Update cypress.config.js
SimonasB88 Oct 30, 2023
71ef707
small fixes
SimonasB88 Nov 6, 2023
c1d55d4
cypress updating
SimonasB88 Nov 6, 2023
a5d5124
Update cypress.config.js
SimonasB88 Nov 6, 2023
c80891b
Update cypress.config.js
SimonasB88 Nov 6, 2023
497b574
fail fast updates
SimonasB88 Nov 6, 2023
157863c
test spec updates
SimonasB88 Nov 6, 2023
e9cb123
Update prestashop_1785_2.sql
SimonasB88 Nov 6, 2023
66779bb
small configs
SimonasB88 Nov 6, 2023
310dcff
small refactoring
SimonasB88 Nov 6, 2023
f10ab99
Update cypress.config.js
SimonasB88 Nov 6, 2023
d78dee8
refactoring the E2E code a bit
SimonasB88 Nov 6, 2023
50822b8
cypress update
SimonasB88 Nov 13, 2023
b0cfbab
updates
SimonasB88 Nov 13, 2023
89a2fe2
ps8 test updates
SimonasB88 Nov 13, 2023
300c9ee
cypress update
SimonasB88 Nov 16, 2023
225b1eb
Update 06_mollie.ps8.Subscriptions.js
SimonasB88 Nov 16, 2023
0af08bf
test updates
SimonasB88 Nov 16, 2023
b3c068c
test code updates (ps8)
SimonasB88 Nov 16, 2023
d821347
test code updates (ps1785)
SimonasB88 Nov 16, 2023
4edd0ed
Update 03_mollie.ps1785.PaymentTestsOrdersAPI.js
SimonasB88 Nov 16, 2023
e91f4d2
small test specs fixes
SimonasB88 Nov 16, 2023
b30dd1a
fixing some test specs
SimonasB88 Nov 16, 2023
fe9fedd
small typo fix
SimonasB88 Nov 16, 2023
417956b
Update cypress.config.js
SimonasB88 Nov 20, 2023
005b3fc
running the CI without console check
SimonasB88 Dec 1, 2023
4fc3c8e
PS812 build adding
SimonasB88 Dec 4, 2023
08ea9c0
improved CI loading
SimonasB88 Dec 5, 2023
5bbf7a1
additional changes
SimonasB88 Dec 5, 2023
bb67ddc
adding --wait flags
SimonasB88 Dec 5, 2023
e629b9c
small flag typo
SimonasB88 Dec 5, 2023
b8ce189
waiting for container updates
SimonasB88 Dec 5, 2023
12e8044
adding a bash loader for wait
SimonasB88 Dec 5, 2023
980ee01
small typo
SimonasB88 Dec 5, 2023
37da1dd
loader updates
SimonasB88 Dec 5, 2023
e64279a
Update docker-compose.8.yml
SimonasB88 Dec 5, 2023
8dd12f8
small updates
SimonasB88 Dec 5, 2023
c80a1e1
Update docker-compose.8.yml
SimonasB88 Dec 5, 2023
ae1e2c0
slight updates
SimonasB88 Dec 5, 2023
292b40c
typo fix
SimonasB88 Dec 5, 2023
c1657c4
adding sleep 1m for CI/CD PS8
SimonasB88 Dec 6, 2023
31b0745
adding sleep for PS8
SimonasB88 Dec 6, 2023
8850718
makefile updating
SimonasB88 Dec 6, 2023
a710aed
updating the makefile
SimonasB88 Dec 6, 2023
6f5fd9f
adding conditional JS statements in test
SimonasB88 Dec 6, 2023
02b4541
small conditional improvement
SimonasB88 Dec 8, 2023
5a75fd8
Update 05_mollie.ps8.PaymentTestsPaymentsAPI.js
SimonasB88 Dec 8, 2023
56b02c8
Update commands.js
SimonasB88 Dec 8, 2023
3212be2
upgrading cypress
SimonasB88 Dec 11, 2023
d7bf8cc
eliminating useless test code
SimonasB88 Dec 11, 2023
542483f
adding command.log notification for information
SimonasB88 Dec 11, 2023
245549b
additional useless code elimination
SimonasB88 Dec 11, 2023
e2ff6ea
small typo
SimonasB88 Dec 11, 2023
5987593
updates
SimonasB88 Dec 11, 2023
d2aa45d
updates
SimonasB88 Dec 11, 2023
38b1375
small update for CI
SimonasB88 Dec 11, 2023
c711c1c
removing unnecessary service
SimonasB88 Dec 11, 2023
2a584aa
small typo
SimonasB88 Dec 11, 2023
63ec737
small update
SimonasB88 Dec 11, 2023
f9564ba
small test fix
SimonasB88 Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading