-
Notifications
You must be signed in to change notification settings - Fork 5
83 lines (73 loc) · 2.88 KB
/
e2e_tests.yaml
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
name: Run Explorer e2e Tests
on:
pull_request:
types: [ opened, synchronize ]
workflow_dispatch:
inputs:
MAINNET_FRONTEND_URL:
description: 'Enter here the URL for a mainnet deployment to run the e2e tests against to.'
required: true
default: 'https://dev.cf-explorer-mainnet.eu-west-1.metadata.dev.cf-deployments.org/'
MAINNET_API_URL:
description: 'Enter here the URL for a mainnet deployment to run the e2e tests against to.'
required: true
default: 'https://api.dev.cf-explorer-mainnet.eu-west-1.metadata.dev.cf-deployments.org/'
branch:
description: 'Select the branch whose e2e tests will be used'
required: true
default: 'main'
jobs:
test:
runs-on: self-hosted
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v3
- name: ⬇️ Checkout repository using specified branch (workflow_dispatch only)
uses: actions/checkout@v3
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ github.event.inputs.branch }}'
- name: 🦾 Create .env file
run: |
echo "PORT=3000" > .env
echo "REACT_APP_VERSION=$npm_package_version" >> .env
echo 'REACT_APP_NETWORK_NAMES="{"mainnet":"Mainnet","preprod":"Preprod"}"' >> .env
if [ ! -z "${{ github.event.inputs.MAINNET_FRONTEND_URL }}" ]
then
echo "REACT_APP_MAINNET_APP_URL=${{ github.event.inputs.MAINNET_FRONTEND_URL }}" >> .env
echo "REACT_APP_API_URL=${{ github.event.inputs.MAINNET_API_URL }}" >> .env
echo "REACT_APP_BOLNISI_NAME_API=${{ github.event.inputs.REACT_APP_BOLNISI_NAME_API }}" >> .env
echo "CYPRESS_BASE_URL=${{ github.event.inputs.MAINNET_FRONTEND_URL }}" >> .env
else
echo "REACT_APP_MAINNET_APP_URL=${EXPLORER_API_MAINNET_URL}" >> .env
echo "REACT_APP_BOLNISI_NAME_API=${{ github.event.inputs.REACT_APP_BOLNISI_NAME_API }}" >> .env
echo "REACT_APP_API_URL=${EXPLORER_API_MAINNET_URL}" >> .env
fi
- name: 🫡 Setup node
uses: actions/setup-node@v4
with:
node-version: 16
- name: 🧘♀️ Download dependencies
run: npm ci
- name: 🎳 Run tests
run: |
if [ ! -z "${{ github.event.inputs.MAINNET_FRONTEND_URL }}" ]
then
npm run cypress:run
else
npm test
fi
- name: 📹 Archive test videos
uses: actions/upload-artifact@v3
if: always()
with:
name: videos
path: ./cypress/videos
- name: 🖼️ Archive test screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots
path: ./cypress/screenshots
env:
EXPLORER_API_MAINNET_URL: ${{ secrets.EXPLORER_API_MAINNET_URL }}