-
Notifications
You must be signed in to change notification settings - Fork 44
executable file
·111 lines (100 loc) · 3.97 KB
/
E2E_On_PR.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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:
# temporary WIP for this PS version, possible bug blocker
# - prestashop: 'PS1785'
# make: 'make VERSION=1785 e2eh1785'
# subdomain: 'demoshop1785'
# port: '8002'
# yml: 'docker-compose.1785.yml'
# url: 'https://demoshop1785debug.ngrok.io'
# test_spec: '**/cypress/e2e/ps1785/**'
# TestRailID: R4954
- prestashop: 'PS8'
make: 'make VERSION=8 e2eh8'
subdomain: 'demoshop8'
port: '8002'
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/checkout@v2.0.0
- 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