-
Notifications
You must be signed in to change notification settings - Fork 6
218 lines (189 loc) · 7.87 KB
/
microapps-ui-test.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
name: Microapps UI tests
on:
workflow_dispatch:
inputs:
scriptName:
description: 'Name of the script to run'
required: false
default: 'test-gasp-ui'
environment:
description: 'Environment to run the tests:[develop,testnet]'
required: false
default: ''
uiUrl:
description: 'http address of app ui'
required: false
default: ''
# For manual triggering
jobs:
test:
name: Run UI tests
runs-on: ubuntu-latest
env:
API_URL: 'wss://collator-01-ws-rollup-frontend.gasp.xyz'
TEST_SUDO_NAME: ${{ secrets.TEST_SUDO_NAME }}
TEST_SCRIPT: 'test-gasp-ui'
TEST_ENV_TAG: 'develop'
NODE_ENV: test
UI_URL : 'https://gasp-testnet-dot-direct-pixel-353917.oa.r.appspot.com/'
SELENIUM_REMOTE_URL: http://localhost:4444/wd/hub
MNEMONIC_META: 'twelve insect obvious hurdle control nature search response march version cake buffalo'
PRIVKEY_META: ${{ secrets.PRIVKEY_META }}
outputs:
testmo-run-id: ${{ steps.setTestRun.outputs.testmo-run-id }}
steps:
- name: Set Script to run
run: |
echo ${{ github.event.inputs.scriptName }}
if [ "$FROM_INPUT" != "" ]; then
echo "Input"
echo "TEST_SCRIPT=${{ github.event.inputs.scriptName }}" >> $GITHUB_ENV
echo "TEST_ENV_TAG=${{ github.event.inputs.environment }}" >> $GITHUB_ENV
echo "UI_URL=${{ github.event.inputs.uiUrl }}" >> $GITHUB_ENV
fi
if [ "$FROM_PAYLOAD" != "" ]; then
echo "Payload"
echo "TEST_SCRIPT=${{ github.event.client_payload.scriptName }}" >> $GITHUB_ENV
echo "TEST_ENV_TAG=${{ github.event.client_payload.environment }}" >> $GITHUB_ENV
echo "UI_URL=${{ github.event.client_payload.uiUrl }}" >> $GITHUB_ENV
fi
echo 'WEBHOOK_URL=${{ secrets.STG_SLACK_WEBHOOK }}' >> $GITHUB_ENV
env:
FROM_INPUT: ${{ github.event.inputs.scriptName }}
FROM_PAYLOAD: ${{ github.event.client_payload.scriptName }}
- name: Start Selenoid Server
uses: Xotabu4/selenoid-github-action@v2
with:
selenoid-start-arguments: |
--args "-timeout 300s" --browsers 'chrome:110.0;chrome:112.0;chrome:114.0'
- name: Set Configuration - testnet
if: contains(github.event.client_payload.environment, 'testnet') || contains(github.event.inputs.environment, 'testnet')
run: |
echo 'API_URL=wss://collator-01-ws-rollup-holesky.gasp.xyz' >> $GITHUB_ENV
- name: Set Configuration - Develop
if: contains(github.event.client_payload.environment, 'develop') || contains(github.event.inputs.environment, 'develop')
run: |
echo 'API_URL=wss://collator-01-ws-rollup-frontend.gasp.xyz' >> $GITHUB_ENV
echo 'TEST_SUDO_NAME=${{ secrets.DEV_SUDO_NAME }}' >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
- name: Install testmo
run: yarn global add @testmo/testmo-cli
- name: Install dependencies with Yarn
run: yarn
- name: Tsc code quality check
run: yarn tsc-lint
- name: ESLint code quality check
run: yarn eslint
- name: installed packages
run: yarn list
- name: is selenoid started?
run: curl http://localhost:4444/status
- name: Add extra params
run: |
testmo automation:resources:add-field --name git --type string \
--value ${GITHUB_SHA:0:7} --resources resources.json
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
testmo automation:resources:add-link --name build \
--url $RUN_URL --resources resources.json
- name: Create test run
run: |
testmo automation:run:create \
--instance https://mangata-finance.testmo.net \
--project-id 2 \
--name "FE microapps e2e test run" \
--resources resources.json \
--source "fe-microapps-e2e-job" > testmo-run-id.txt \
--tags ${{ env.TEST_ENV_TAG }}
ID=$(cat testmo-run-id.txt)
echo "testmo-run-id=$ID" >> $GITHUB_OUTPUT
echo "ID=$ID" >> $GITHUB_ENV
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
id: setTestRun
- name: Run tests
run: yarn ${{ env.TEST_SCRIPT }}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: JEST Tests # Name of the check run which will be created
path: reports/*.xml # Path to test results
reporter: jest-junit # Format of test results
- name: Submit results to the testmo-run
if: always()
run: |
testmo automation:run:submit-thread \
--instance https://mangata-finance.testmo.net \
--run-id $(cat testmo-run-id.txt) \
--results reports/*.xml
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
- name: Sleep for 5 seconds
run: sleep 10s #close buffers of videos.
- name: Copy video files to reports folder
if: success() || failure()
run: "cp ~/.aerokube/selenoid/* -r reports/artifacts/"
- name: Create reports zip
uses: vimtor/action-zip@v1
if: success() || failure()
with:
files: reports/
dest: reports.zip
- name: Archive report files
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: ReportData
path: reports.zip
- name: Archive report files
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: TestReport
path: reports/html-report/report.html
- name: Slack Notification - OK
if: success()
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ env.WEBHOOK_URL }}
SLACK_TITLE: 'Slack Notification - results - OK'
SLACK_COLOR: "#00ff11"
SLACK_MESSAGE: 'Test succeed in [ ${{ env.TEST_SCRIPT }} ]- ${{ env.UI_URL }} - ${{ env.API_URL }} - ${{ github.ref }}
testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{ env.ID }}'
GITHUB_REF: 'https://mangata-finance.github.io/mangata-e2e/${{ github.run_number }}'
- name: Slack Notification - Error
if: failure()
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ env.WEBHOOK_URL }}
SLACK_TITLE: 'Slack Notification - results - NOOK'
SLACK_COLOR: "#ff0011"
SLACK_MESSAGE: 'Test failures [ ${{ env.TEST_SCRIPT }} ]- ${{ env.UI_URL }} - ${{ env.API_URL }} - ${{ github.ref }}
testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{ env.ID }}'
GITHUB_REF: 'https://mangata-finance.github.io/mangata-e2e/${{ github.run_number }}'
test-complete:
needs: [test]
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
cache: yarn
- name: Install testmo
run: yarn global add @testmo/testmo-cli
- name: Complete test run
run: |
testmo automation:run:complete \
--instance https://mangata-finance.testmo.net \
--run-id ${{needs.test.outputs.testmo-run-id}}
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}