Skip to content

E2E visual regression testing #326

E2E visual regression testing

E2E visual regression testing #326

Workflow file for this run

name: Cypress E2E Automation [develop branch]
on:
pull_request:
types: [opened, reopened]
branches: [develop, develop**, develop-**]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Cypress-E2E:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- prestashop: 'PS1785'
make: 'make 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'
subdomain: 'demoshop8'
port: '8142'
yml: 'docker-compose.8.yml'
url: 'https://demoshop8.ngrok.io'
test_spec: '**/cypress/e2e/ps8/**'
TestRailID: R6470
env:
NGROK_TOKEN: ${{ secrets.NGROK_TOKEN }}
DB_PASSWD: ${{ secrets.DB_PASSWD }}
steps:
- name: Checkout
uses: actions/[email protected]
- run: wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
shell: bash
- run: unzip -qq -o ngrok-stable-linux-amd64.zip
shell: bash
- run: ./ngrok authtoken ${{ secrets.NGROK_TOKEN }}
shell: bash
- run: ./ngrok http -region=us -subdomain=${{ matrix.subdomain }} ${{ matrix.port }} > ngrok.log &
shell: bash
- name: Install composer
run: composer i
- name: Install package
run: |
npm ci
npm update
npx browserslist@latest --update-db
- name: ${{ matrix.prestashop }} installing / Module Install and Uninstall testing
run: |
${{ matrix.make }}
- 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!"
break # Exit the loop if the response is 302
else
echo "URL is not ready yet, because Ngrok sessions are all in use at the moment, please wait. Retrying to build the Ngrok tunnel again in 5 seconds..."
sleep 5 # Wait for 5 seconds before retrying
./ngrok http -region=us -subdomain=${{ matrix.subdomain }} ${{ matrix.port }} > ngrok.log &
fi
done
- name: Running ${{ matrix.prestashop }} Cypress E2E tests
run: |
export CYPRESS_baseUrl='${{ matrix.url }}'
export CYPRESS_MOLLIE_TEST_API_KEY=${{ secrets.MOLLIE_TEST_API_KEY }}
export CYPRESS_MOLLIE_TEST_PROFILE_ID=${{ secrets.MOLLIE_TEST_PROFILE_ID }}
export CYPRESS_TESTRAIL_RUN_ID=${{ matrix.TestRailID }}
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 }}"
- name: Archive videos and screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: Cypress_Mollie_videos_screenshots_${{ matrix.prestashop }}
retention-days: 2
path: |
cypress/videos
cypress/screenshots