Skip to content

Commit

Permalink
Merge pull request #801 from mollie/e2efix-6.x.x
Browse files Browse the repository at this point in the history
E2E fix 6.x.x
  • Loading branch information
SimonasB88 authored Sep 5, 2023
2 parents 2bde6b2 + 3d7272f commit 187d0ee
Show file tree
Hide file tree
Showing 22 changed files with 4,902 additions and 9,889 deletions.
6 changes: 0 additions & 6 deletions .docker/.htaccess1784
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RewriteEngine on


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

Expand All @@ -35,12 +34,10 @@ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBAS
RewriteCond %{HTTP_HOST} ^demoshop1784.ngrok.io$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^demoshop1784.ngrok.io$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]


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

Expand Down Expand Up @@ -69,16 +66,13 @@ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBAS
RewriteCond %{HTTP_HOST} ^demoshop1784.ngrok.io$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^demoshop1784.ngrok.io$
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]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^demoshop1784.ngrok.io$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^demoshop1784.ngrok.io$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

Expand Down
39 changes: 0 additions & 39 deletions .docker/.htaccess8
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RewriteEngine on


#Domain: demoshop8.ngrok.io
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L]
Expand All @@ -36,51 +35,13 @@ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBAS
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]


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

RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^shop2$ /shop2/ [L,R]
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^shop2/(.*) /$1 [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]
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]
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]
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]
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]
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]
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]
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]
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
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]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^demoshop8.ngrok.io$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

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.0.1-apache
FROM prestashop/prestashop:8.0.5-apache

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 .github/workflows/E2E_On_PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Cypress E2E Automation [develop branch]
on:
pull_request:
types: [opened, reopened]
branches: [develop]
branches: [develop, develop**, develop-**]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrading_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Module upgrade / downgrade testing (last version > v.5.2.0 > `develop` ver
on:
pull_request:
types: [opened, reopened]
branches: [develop]
branches: [develop, develop**, develop-**]
jobs:
Module-upgrading-check:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ cypress/screenshots
vendor
node_modules
composer.lock
ngrok
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ e2eh1784:
# configuring base database
mysql -h 127.0.0.1 -P 9002 --protocol=tcp -u root -pprestashop prestashop < ${PWD}/tests/seed/database/prestashop_1784_2.sql
# installing module
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie --id_shop=3"
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# uninstalling module
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie --id_shop=3"
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module uninstall mollie"
# installing the module again
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie --id_shop=3"
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module install mollie"
# enabling the module
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie --id_shop=3"
docker exec -i prestashop-mollie-1784 sh -c "cd /var/www/html && php bin/console prestashop:module enable mollie"
# chmod all folders
docker exec -i prestashop-mollie-1784 sh -c "chmod -R 777 /var/www/html"

Expand All @@ -40,13 +40,13 @@ e2eh8:
# configuring base database
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 --id_shop=2"
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 --id_shop=2"
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 --id_shop=2"
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 --id_shop=2"
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"

Expand Down
16 changes: 14 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
video: true,
chromeWebSecurity: false,
experimentalMemoryManagement: true,
experimentalSourceRewriting: true,
numTestsKeptInMemory: 0,
defaultCommandTimeout: 15000,
defaultCommandTimeout: 30000,
projectId: 'xb89dr',
retries: 3,
videoUploadOnPasses: false,
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
44 changes: 20 additions & 24 deletions cypress/e2e/ps1784/01_mollie.ps1784.ModuleConfiguration.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,21 @@ function prepareCookie()

});
}
//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')
//switching the multistore PS1784
cy.get('#header_shop > .dropdown').click()
cy.get('.open > .dropdown-menu').find('[class="shop"]').eq(1).find('[href]').eq(0).click()
cy.visit('/SHOP2/index.php?controller=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()
})
}

//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 @@ -70,7 +66,7 @@ describe('PS1784 Module initial configuration setup', () => {
})
it('C339305: 01 Connecting test API successsfully', () => {
cy.visit('/admin1/')
cy.OpenModuleDashboard()
cy.OpeningModuleDashboardURL()
cy.get('#MOLLIE_ACCOUNT_SWITCH_on').click({force:true})
cy.get('#MOLLIE_API_KEY_TEST').type((Cypress.env('MOLLIE_TEST_API_KEY')),{delay: 0, log: false})
cy.get('#module_form_submit_btn').click()
Expand All @@ -83,11 +79,11 @@ it('C339338: 02 Enabling Mollie carriers in Prestashop successfully', () => {
})
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/')
cy.OpenModuleDashboard()
cy.OpeningModuleDashboardURL()
cy.get('[href="#advanced_settings"]').click({force:true})
cy.get('[id="MOLLIE_PAYMENTSCREEN_LOCALE"]').should('be.visible')
cy.get('[id="MOLLIE_SEND_ORDER_CONFIRMATION"]').should('be.visible')
cy.get('[id="MOLLIE_KLARNA_INVOICE_ON"]').should('be.visible')
cy.get('[id="MOLLIE_AUTHORIZABLE_PAYMENT_INVOICE_ON_STATUS"]').should('be.visible')
cy.get('[class="help-block"]').should('be.visible')
cy.get('[id="MOLLIE_STATUS_AWAITING"]').should('be.visible')
cy.get('[id="MOLLIE_STATUS_PAID"]').should('be.visible')
Expand Down Expand Up @@ -117,13 +113,13 @@ it('C339339: 03 Checking the Advanced Settings tab, verifying the Front-end comp
});
it('C688472 Checking the Subscriptions tab, and console errors', () => {
cy.visit('/admin1/')
cy.OpenModuleDashboard()
cy.OpeningModuleDashboardURL()
cy.get('#subtab-AdminMollieSubscriptionOrders').click()
cy.get('[id="invertus_mollie_subscription_grid_panel"]').should('be.visible')
});
it('C688473 Checking the Subscriptions FAQ, and console errors', () => {
cy.visit('/admin1/')
cy.OpenModuleDashboard()
cy.OpeningModuleDashboardURL()
cy.get('#subtab-AdminMollieSubscriptionFAQ').click()
cy.get(':nth-child(2) > .col-lg-12 > .card').should('be.visible')
cy.get(':nth-child(3) > .col-lg-12 > .card').should('be.visible')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <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) => {
windowConsoleError = cy.spy(win.console, 'error');
})
let failEarly = false;
afterEach(() => {
expect(windowConsoleError).to.not.be.called;
if (failEarly) throw new Error("Failing Early due to an API or other module configuration problem. If running on CI, please check Cypress VIDEOS/SCREENSHOTS in the Artifacts for more details.")
})
afterEach(function() {
if (this.currentTest.state === "failed") failEarly = true
});
describe('PS1784 Enabling Payments', () => {
beforeEach(() => {
cy.viewport(1920,1080)
login('MollieBOFOLoggingIn')
})
it('C339341: 04 Enabling All payments in Module BO [Orders API]', () => {
cy.visit('/admin1/')
cy.OpeningModuleDashboardURL()
cy.ConfOrdersAPI1784()
cy.get('[type="submit"]').first().click({force:true})
cy.get('[class="alert alert-success"]').should('be.visible')
})
})
Loading

0 comments on commit 187d0ee

Please sign in to comment.