-
Notifications
You must be signed in to change notification settings - Fork 58
155 lines (136 loc) · 4.61 KB
/
e2e-cypress-tests.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: End to End Cypress Test
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "e2e-tests/**"
- "frontend/**"
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main
paths:
- "frontend/**"
- "e2e-tests/**"
release:
types:
- published
- released
jobs:
cypress-run:
runs-on: ubuntu-latest
name: E2E on Chrome
steps:
# Step 1: Checkout repo
- name: Checkout
uses: actions/checkout@v3
# Step 2: Remove old build files
- name: Remove old build files
run: |
find backend/src/zango/assets/app_panel/js -name "build.*.min.js" -type f -delete
find backend/src/zango/assets/app_panel/js -name "build.*.min.js.LICENSE.txt" -type f -delete
# Step 3: Installing Node
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
# Step 4: Installing dependencies
- name: Install dependencies
run: |
cd frontend
yarn install
# Step 5: Generating Build and placing it in the folder
- name: Building app
run: |
cd frontend
CI=false yarn build
# Step 6: Removing license file for the new build
- name: Remove old build files
run: |
find backend/src/zango/assets/app_panel/js -name "build.*.min.js.LICENSE.txt" -type f -delete
# Step 7: Set up zango project with latest zango build
- name: Setup latest zango project
uses: ./.github/actions/zango-project-setup-action
with:
platform_username: [email protected]
platform_user_password: Zango@123 #pragma: allowlist secret
project_name: zango_project
postgres_user: zango_admin
postgres_password: zangopass #pragma: allowlist secret
postgres_db: zango
platform_domain_url: localhost
domain_config_path: ./e2e-tests/local_domains.txt
# Step 8: Capturing start time
- name: Capture Start Time
id: start-time
run: echo "START_TIME=$(date +%s)" >> $GITHUB_ENV
# Step 9: Install cypress dependencies
- name: Install cypress dependencies
run: npm install
working-directory: e2e-tests
# Step 10: Run Cypress tests and record results
- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
browser: chrome
working-directory: e2e-tests
continue-on-error: true
# Step 11: Capturing end time
- name: Capture End Time
id: end-time
run: echo "END_TIME=$(date +%s)" >> $GITHUB_ENV
# Step 12: Calculating total duration of cypress tests
- name: Calculate Duration
id: duration
run: |
DURATION_SECONDS=$((END_TIME - START_TIME))
DURATION_MINUTES=$((DURATION_SECONDS / 60))
DURATION_REMAINDER_SECONDS=$((DURATION_SECONDS % 60))
DURATION="${DURATION_MINUTES}m ${DURATION_REMAINDER_SECONDS}s"
echo "DURATION=${DURATION}" >> $GITHUB_ENV
#Step 13: Extracting zango version
- name: Extract Version
id: extract_version
run: |
ZANGO_VERSION=$(grep '__version__' backend/src/zango/__init__.py | sed 's/.*__version__ = "\(.*\)"/\1/' | tail -1)
echo "ZANGO_VERSION=${ZANGO_VERSION}" >> $GITHUB_ENV
# Step 14: Generate Cucumber HTML Report
- name: Generate Cucumber HTML Report
run: |
echo "Running cucumber-html-report.js"
ls -la
node cucumber-html-report.js
working-directory: e2e-tests
env:
BROWSER_NAME: chrome
BROWSER_VERSION: "127"
DEVICE_NAME: "Remote Device"
PLATFORM_NAME: "Ubuntu"
PLATFORM_VERSION: "22.04.4"
CI_ENVIRONMENT: "GitHub Actions"
# Step 15: Upload Cypress screenshots
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
path: e2e-tests/cypress/screenshots
if-no-files-found: ignore
# Step 16: Upload Cypress videos
- name: Upload Cypress videos
uses: actions/upload-artifact@v3
with:
name: cypress-videos
path: e2e-tests/cypress/videos
if-no-files-found: ignore
# Step 17: Upload Cucumber HTML Report
- name: Upload Cucumber HTML Report
uses: actions/upload-artifact@v3
with:
name: cucumber-html-report
path: e2e-tests/reports/cucumber-html-report.html
if-no-files-found: ignore