-
Notifications
You must be signed in to change notification settings - Fork 23
270 lines (248 loc) · 8.54 KB
/
e2e-tests-xray_frontend.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Require to set secrets:
# - ORG_IRS_JIRA_USERNAME
# - ORG_IRS_JIRA_PASSWORD
name: "[FE][TEST][E2E]- Cypress"
on:
# triggered manually by Test Manager
workflow_dispatch:
inputs:
jira_filter_id:
description: 'Jira filter ID to fetch test scenarios'
required: false
# by default, we use this filter: https://jira.catena-x.net/issues/?filter=11645
default: 11645
# or automatically by merge to main
#push:
branches: main
paths:
- 'frontend/**'
jobs:
install:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
# Install YARN dependencies, cache them correctly
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Run yarn install
uses: Borales/actions-yarn@v5
with:
cmd: install # will run `yarn install` command
# Fetch feature files
- name: Fetch .feature files from Jira Xray
env:
JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
JIRA_FILTER_ID: ${{ github.event.inputs.jira_filter_id }}
working-directory: frontend
run: ./scripts/xray-download-feature-files.sh
- name: Save cypress/e2e folder
uses: actions/upload-artifact@v4
with:
name: cypress - e2e
if-no-files-found: error
path: frontend/cypress/e2e
overwrite: true
cypress-run-chrome:
timeout-minutes: 15
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
container:
# if you need to change image please make sure use the same version in all places
# (here and in cypress/Dockerfile)
image: cypress/browsers:node16.16.0-chrome107-ff107-edge
options: --user 1001
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download the cypress/e2e folder
uses: actions/download-artifact@v4
with:
name: cypress - e2e
path: frontend/cypress/e2e
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Angular CLI
run: npm install -g @angular/cli
- name: Run yarn install
uses: Borales/actions-yarn@v5
with:
cmd: install # will run `yarn install` command
dir: frontend
- name: Start Frontend Application
working-directory: frontend
run: |
npm run start:auth:e2ea &
sleep 60 &&
curl http://localhost:4200 -I
- name: Cypress run all tests
uses: cypress-io/[email protected] # use the explicit version number
with:
browser: chrome
working-directory: frontend
# using wait-on parameter causes "Error: connect ECONNREFUSED 127.0.0.1:4200"
env:
CYPRESS_SUPERVISOR_LOGIN: ${{ secrets.TRACE_X_SUPERVISOR_LOGIN }}
CYPRESS_SUPERVISOR_PW: ${{ secrets.TRACE_X_SUPERVISOR_PW }}
CYPRESS_ADMIN_LOGIN: ${{ secrets.TRACE_X_ADMIN_LOGIN }}
CYPRESS_ADMIN_PW: ${{ secrets.TRACE_X_ADMIN_PW }}
CYPRESS_USER_LOGIN: ${{ secrets.TRACE_X_USER_LOGIN }}
CYPRESS_USER_PW: ${{ secrets.TRACE_X_USER_PW }}
CYPRESS_REDIRECT_URI: https://traceability-portal-e2e-a.dev.demo.catena-x.net/dashboard
- name: Submit results to Xray
# we don't want to submit results to xray when it was run by PR
if: github.event_name != 'pull_request' && (success() || failure())
env:
JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
run: |
./scripts/xray-push-test-results.sh
- name: Archive cypress artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: cypress generated files - chrome
path: |
frontend/cypress/videos/
frontend/cypress/screenshots/
# cypress-run-firefox:
# timeout-minutes: 15
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: frontend
# container:
# # if you need to change image please make sure use the same version in all places
# # (here and in cypress/Dockerfile)
# image: cypress/browsers:node16.16.0-chrome107-ff107-edge
# options: --user 1001
# needs: install
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Download the cypress/e2e folder
# uses: actions/download-artifact@v4
# with:
# name: cypress - e2e
# path: frontend/cypress/e2e
#
# - name: Use Node.js 18.x
# uses: actions/setup-node@v4
# with:
# node-version: 18.x
#
# - name: Cypress run all tests
# uses: cypress-io/[email protected] # use the explicit version number
# with:
# start: npm start
# wait-on: "http://localhost:4200"
# wait-on-timeout: 120
# browser: firefox
# working-directory: frontend
#
# - name: Submit results to Xray
# # we don't want to submit results to xray when it was run by PR
# if: github.event_name != 'pull_request' && (success() || failure())
# env:
# JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
# JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
# run: |
# ./scripts/xray-push-test-results.sh
#
# - name: Archive cypress artifacts
# if: success() || failure()
# uses: actions/upload-artifact@v4
# with:
# name: cypress generated files - firefox
# path: |
# frontend/cypress/videos/
# frontend/cypress/screenshots/
#
# cypress-run-webkit:
# timeout-minutes: 15
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: frontend
# needs: install
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Download the cypress/e2e folder
# uses: actions/download-artifact@v4
# with:
# name: cypress - e2e
# path: frontend/cypress/e2e
# commented because if we use it here, we face with that problem:
# "http://localhost:4200 timed out on retry 151 of 5, elapsed 150449ms, limit 150000ms
# Error: connect ECONNREFUSED 127.0.0.1:4200"
# - name: Use Node.js 18.x
# uses: actions/setup-node@v4
# with:
# node-version: 18.x
# - name: Use Node.js 16.x
# uses: actions/setup-node@v4
# with:
# node-version: 16.x
#
# # https://docs.cypress.io/guides/guides/launching-browsers#Linux-Dependencies
# - name: Install additional dependencies
# run: npx playwright install --with-deps webkit
#
# - name: Cypress run all tests
# uses: cypress-io/[email protected] # use the explicit version number
# with:
# start: npm start:auth:e2ea
# wait-on: "http://localhost:4200"
# wait-on-timeout: 120
# browser: webkit
# working-directory: frontend
#
# - name: Submit results to Xray
# # we don't want to submit results to xray when it was run by PR
# if: github.event_name != 'pull_request' && (success() || failure())
# env:
# JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }}
# JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }}
# run: |
# ./scripts/xray-push-test-results.sh
#
# - name: Archive cypress artifacts
# if: success() || failure()
# uses: actions/upload-artifact@v4
# with:
# name: cypress generated files - webkit
# path: |
# frontend/cypress/videos/
# frontend/cypress/screenshots/