forked from JackHamer09/zksync-plus
-
Notifications
You must be signed in to change notification settings - Fork 56
164 lines (143 loc) · 5.77 KB
/
e2e.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
name: Testing Portal using e2e
on:
workflow_call:
secrets:
ALLURE_TOKEN:
description: 'A token passed from the caller workflow'
required: true
inputs:
environmentTags:
type: string
default: ''
required: false
targetUrl:
type: string
default: 'https://staging-portal.zksync.dev/'
required: true
network:
type: string
default: 'Sepolia'
required: true
publish_to_allure: #Here we define the variable that can be overwritten by caller workflow
type: boolean
description: "Publish test results to allure"
default: true
required: false
env:
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
ALLURE_SEARCH_REQUEST: '[{"id":"name","type":"string","value":"#${{ github.run_number }}"}]'
ALLURE_BASIC_TAGS: "${{ github.head_ref }}, #${{ github.run_number }}, ${{ github.event.pull_request.title }}"
ALLURE_PROJECT_ID: ${{ vars.ALLURE_PROJECT_ID }}
ALLURE_ENDPOINT: ${{ vars.ALLURE_ENDPOINT }}
E2E_WALLET_SECRET_PK: ${{ secrets.E2E_WALLET_SECRET_PK }}
E2E_WALLET_SALT_IV: ${{ secrets.E2E_WALLET_SALT_IV }}
E2E_WALLET_PASSWORD_MM: ${{ secrets.E2E_WALLET_PASSWORD_MM }}
E2E_WALLET_1_MAIN: ${{ vars.E2E_WALLET_1_MAIN }}
E2E_WALLET_2_SECOND: ${{ vars.E2E_WALLET_2_SECOND }}
E2E_WALLET_0_EMPTY: ${{ vars.E2E_WALLET_0_EMPTY }}
E2E_WALLET_1_MAIN_PUB_KEY: ${{ vars.E2E_WALLET_1_MAIN_PUB_KEY }}
E2E_WALLET_2_SECOND_PUB_KEY: ${{ vars.E2E_WALLET_2_SECOND_PUB_KEY }}
E2E_WALLET_0_EMPTY_PUB_KEY: ${{ vars.E2E_WALLET_0_EMPTY_PUB_KEY }}
jobs:
e2e:
runs-on: [ matterlabs-ci-runner ]
strategy:
fail-fast: false
max-parallel: 20
matrix:
command: ["xvfb-run --auto-servernum --server-args '-screen 0 1920x1080x24' npx cucumber-js --tags "]
tags: [
"@artifacts and @bridge",
"@artifacts and @contactsPage",
"@artifacts and @depositPage",
"@artifacts and @transferPage",
"@artifacts and @header",
"@artifacts and @menuItems",
"@artifacts and @upperNavigationMenu",
"@artifacts and @contactsPage",
"@artifacts and @withdraw",
"@navigation and not @emptyWallet",
"@redirection and @resetAllowance",
"@artifacts and @various",
"@artifacts and @transactionsItems",
"@transactions and @deposit and @blockchain",
"@transactions and @deposit and @noblockchain",
"@transactions and @deposit and @emptyWallet",
"@transactions and @deposit and @resetAllowance",
"@transactions and @withdraw",
"@various and @emptyWallet",
"@actions and @contacts"
]
name: '${{ matrix.tags }}'
container:
image: mcr.microsoft.com/playwright:v1.35.1-focal
options: --user root
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create metamask extension folder
run: |
mkdir -p ./tests/e2e/src/support/extension
chown -R root ./
chmod 777 -R ./tests/e2e/src/support/extension
- name: Install Dependencies
run: |
npm i --no-audit
- name: Install Metamask extension
run: |
echo "cd to tests/e2e/ dir"
cd tests/e2e/
echo "Postinstall"
npm run postinstall
- name: Download allurectl
run: |
wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O ./allurectl
- name: Change permission for allurectl
run: |
chmod +x ./allurectl
- name: Launch tests
id: launch
env:
CI: 'true'
TARGET_ENV: ${{ inputs.targetUrl }}
DAPP_NETWORK: ${{ inputs.network }}
run: |
echo "Run tests"
cd tests/e2e/
${{ matrix.command }}'${{ matrix.tags }} ${{ inputs.environmentTags }}'
- name: Reset tags quotes
if: always()
run: |
echo "MATRIX_TAG_WITHOUT_QUOTES=$(echo ${{ matrix.tags }} | sed -e 's/@//g' )" >> $GITHUB_ENV
- name: Create launch ID
if: always()
env:
ALLURE_LAUNCH_NAME: "#${{ github.run_number }} ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
ALLURE_LAUNCH_TAGS: "${{ env.ALLURE_BASIC_TAGS }}, ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
run: |
echo "ALLURE_LAUNCH_ID=$(./allurectl launch create --launch-name '${{ env.ALLURE_LAUNCH_NAME }}' --no-header --format ID | tail -n1)" >> $GITHUB_ENV
- name: Upload tests to the Allure proj
if: always() && inputs.publish_to_allure == true # <-- no brackets, 'true' does not work here: https://github.com/actions/runner/issues/1483#issuecomment-1090972149
run: |
./allurectl upload tests/e2e/allure-results --launch-id ${{ env.ALLURE_LAUNCH_ID }}
./allurectl launch close ${{ env.ALLURE_LAUNCH_ID }}
- if: failure()
name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: portal_e2e_${{ github.run_number }}_artifacts
path: tests/e2e/artifacts/*
publish:
name: Publish Allure link to GIT
runs-on: ubuntu-latest
needs: e2e
if: always()
steps:
- name: Prepare a link
run: |
echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV
- name: Publish Allure link to GIT Summary
run: |
LINK="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}"
echo "Allure [e2e tests]($LINK) :rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY