-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (179 loc) · 5.49 KB
/
run_e2e_fe.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
name: run_e2e_fe
on:
workflow_call:
inputs:
name:
description: Test suite name
type: string
required: false
default: "FE E2E"
tags:
description: Cucumber test tags
type: string
required: true
default: ""
be_url:
description: The backend URL for testing
type: string
required: true
default: ""
fe_url:
description: The frontend URL for testing
type: string
required: true
default: ""
project:
description: Lagoon project name
type: string
required: true
default: ""
browser:
description: Browser, default to headless Chrome.
type: string
default: "chrome"
retry:
description: Cucumber-js retry option
type: number
default: 2
parallel:
description: Cucumber-js parallel option
type: number
default: 4
eyes_appname:
description: The appname used to compare against in Appltiools
type: string
default: "sdp-core-v1"
app:
type: string
default: 'frontend'
failfast:
type: string
default: ''
test_id:
type: string
required: true
test_type:
type: string
required: false
default: ':e2e:'
test_subtype:
type: string
required: false
default: ''
runner:
type: string
required: false
default: biggy
tag:
description: SDP testing Docker image tag
type: string
required: false
default: migration
slack_channel:
type: string
required: false
default: "sdp-test-report-dev"
slack_notify:
description: When to send the Slack notifications
type: string
required: false
default: "release_only"
env:
# Test users
BE_ADMIN_USER: ${{ secrets.TEST_BE_ADMIN_USER }}
BE_ADMIN_PASS: ${{ secrets.TEST_BE_ADMIN_PASS }}
BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }}
BE_APPROVER_PASS: ${{ secrets.TEST_BE_APPROVER_PASS }}
BE_EDITOR_USER: ${{ secrets.TEST_BE_EDITOR_USER }}
BE_EDITOR_PASS: ${{ secrets.TEST_BE_EDITOR_PASS }}
# Keys
BROWSERSTACK_USER: ${{ secrets.TEST_BROWSERSTACK_USER }}
BROWSERSTACK_KEY: ${{ secrets.TEST_BROWSERSTACK_KEY }}
APPLITOOLS_API_KEY: ${{ secrets.TEST_APPLITOOLS_API_KEY }}
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.TEST_CUCUMBER_PUBLISH_TOKEN }}
# Settings
TESTID: ${{ inputs.test_id }}
NIGHTWATCH_OUTPUT: true
CIRCLE_BRANCH: ${{ github.event.pull_request && github.head_ref || github.ref_name }}
EYES_APPNAME: ${{ inputs.eyes_appname }}
jobs:
run_e2e_fe:
name: run_e2e_fe
runs-on: ${{ inputs.runner }}
container:
image: docker://sdptestautomation/e2e:${{ inputs.tag }}
credentials:
username: ${{ secrets.E2E_DOCKERHUB_USERNAME }}
password: ${{ secrets.E2E_DOCKERHUB_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get repo name
id: repo_name
run: echo "::set-output name=REPO_NAME::$(echo ${GITHUB_REPOSITORY#*/})"
-
name: Check browsers
run: |
node --version
google-chrome --version
printenv
-
name: Set up Environment variables
run: |
echo 'BE_BASE_URL=${{ inputs.be_url }}' >> $GITHUB_ENV
echo 'FE_BASE_URL=${{ inputs.fe_url }}' >> $GITHUB_ENV
echo 'PROJECT=${{ inputs.project }}' >> $GITHUB_ENV
echo 'EYES_APPNAME=${{ inputs.eyes_appname }}' >> $GITHUB_ENV
-
name: Check test environment urls
run: |
echo $BE_BASE_URL
echo $FE_BASE_URL
echo $PROJECT
echo $CIRCLE_BRANCH
-
name: "Wait up servers in case they are idle"
run: |
curl ${BE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null;
curl ${FE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null;
-
name: run e2e test
run: |
cd /app
Xvfb :99 -screen 0 1920x1080x24 &
NIGHTWATCH_BROWSER="${{ inputs.browser }}" npm run cucumber:${{ inputs.app }} -- --tags "${{ inputs.tags }}" --retry "${{ inputs.retry }}" --parallel "${{ inputs.parallel }}"
-
name: Report test results
if: always()
uses: dpc-sdp/sdp-testing/actions/test-report
with:
report_name: 'test-reports-${{ inputs.name }}'
-
name: Store Cucumber Cloud test report URL
uses: actions/upload-artifact@v2
if: always()
with:
name: ${{ inputs.name }}-report-url
path: /app/reports/report-url.txt
notify_slack:
uses: ./.github/workflows/notify_slack.yml
if: |
always() &&
( inputs.slack_notify == 'always' ||
( inputs.slack_notify == 'release_only' &&
( startsWith(github.ref_name, 'release/') ||
contains(fromJSON('["uat", "master", "standby", "production"]'), github.ref_name)
)
)
)
needs: [run_e2e_fe]
secrets: inherit
with:
workflow_name: ${{ inputs.name }}
test_type: ${{ inputs.test_type }}
test_subtype: ${{ inputs.test_subtype }}
artifact_name: "${{ inputs.name }}-report-url"
fe_url: ${{ inputs.fe_url }}
be_url: ${{ inputs.be_url }}
project: ${{ inputs.project }}
slack_channel: ${{ inputs.slack_channel }}