This repository has been archived by the owner on Sep 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (98 loc) · 3.83 KB
/
e2e-tests.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
name: E2E-tests Ubuntu Chrome
on:
schedule:
- cron: '0 5 * * *'
# - cron: '0 5,10,21 * * *'
workflow_dispatch:
inputs:
browser:
description: 'In which browser to run the tests (chrome, electron)'
required: true
default: 'chrome'
testsToRun:
description: 'Run all or only a specific test (*.e2e_spec.js)'
required: true
default: 'runAllTests'
videoRecording:
description: 'Record video of the tests if any failures'
required: true
default: 'false'
ticketPurchase:
description: 'Include ticket purchase'
required: true
default: 'false'
branch:
description: 'Define branch to test'
required: true
default: 'master'
jobs:
e2e-test:
name: E2E-test
runs-on: ubuntu-latest
steps:
- name: Set variables
env:
DEFAULT_VIDEO: 'false'
DEFAULT_TICKET_PURCHASE: 'false'
DEFAULT_BRANCH: 'master'
DEFAULT_BROWSER: 'chrome'
DEFAULT_TEST: 'runAllTests'
run: |
echo "INPUT_VIDEO=${{ github.event.inputs.videoRecording || env.DEFAULT_VIDEO }}" >> $GITHUB_ENV
echo "INPUT_TICKET_PURCHASE=${{ github.event.inputs.ticketPurchase || env.DEFAULT_TICKET_PURCHASE }}" >> $GITHUB_ENV
echo "INPUT_BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
echo "INPUT_BROWSER=${{ github.event.inputs.browser || env.DEFAULT_BROWSER }}" >> $GITHUB_ENV
echo "INPUT_TEST=${{ github.event.inputs.testsToRun || env.DEFAULT_TEST }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ env.INPUT_BRANCH }}
- name: Cache node modules
uses: actions/cache@v2
with:
path: 'e2e-tests/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
# https://github.com/marketplace/actions/cypress-io
- name: Run all Cypress tests
if: env.INPUT_TEST == 'runAllTests'
uses: cypress-io/github-action@v2
#env:
# CYPRESS_baseUrl: api.dev.local
with:
#config: video=${{ env.INPUT_VIDEO }}
command: yarn cypress:run:report --config video=${{ env.INPUT_VIDEO }} --env runOnGitHub=true,withBuyTicket=${{ env.INPUT_TICKET_PURCHASE }} --browser ${{ env.INPUT_BROWSER }}
working-directory: e2e-tests
- name: Run single Cypress test
if: env.INPUT_TEST != 'runAllTests'
uses: cypress-io/github-action@v2
with:
command: yarn cypress:run:report --config video=${{ env.INPUT_VIDEO }} --env runOnGitHub=true,withBuyTicket=${{ env.INPUT_TICKET_PURCHASE }} --browser ${{ env.INPUT_BROWSER }} --spec cypress/integration/tests/${{ env.INPUT_TEST }}.e2e_spec.js
working-directory: e2e-tests
- name: Create HTML report
if: always()
run: yarn cypress:html-testreport
working-directory: ./e2e-tests
- name: Upload test report html
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-html
path: |
./e2e-tests/cypress/results/assets
./e2e-tests/cypress/results/cypressTestReport.html
retention-days: 3
- name: Upload test report json
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-json
path: ./e2e-tests/cypress/results/cypressTestReport.json
retention-days: 3
- name: Upload video recording
if: failure() && contains(env.INPUT_VIDEO, 'true')
uses: actions/upload-artifact@v2
with:
name: video-recording
path: ./e2e-tests/cypress/videos
if-no-files-found: ignore
retention-days: 3