-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (91 loc) · 3.65 KB
/
firefox-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: Firefox tests
on:
push
# schedule:
# # * is a special character in YAML so you have to quote this string
# - cron: '0 2 * * 2,5'
jobs:
cypress-e2e:
name: Run on firefox
runs-on: ubuntu-latest
container:
image: cypress/browsers:node14.16.0-chrome89-ff86
options: --user 1001
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install a project with a clean slate
run: |
npm install --save-dev cypress@latest
npm install cypress-multi-reporters --save-dev
npm install mochawesome --save-dev
# $(npm bin)/cypress cache path
# $(npm bin)/cypress cache list
# $(npm bin)/cypress verify
mkdir public
mkdir public/videos
ls cypress
- name: Set var
run: |
echo "TOOL_TESTS=$(grep TOOL_TESTS cypress.config.js | sed 's/TOOL_TESTS//' | sed 's/"//g' |sed 's/,//' | sed 's/://')" | tr -d ' ' >> $GITHUB_ENV
echo "REQUESTS_TESTS=$(grep REQUESTS_TESTS cypress.config.js | sed 's/REQUESTS_TESTS//' | sed 's/"//g' |sed 's/,//' | sed 's/://')" | tr -d ' ' >> $GITHUB_ENV
- name: Run firefox tool tests
run: |
touch toolTest.log
toolTestsCommand='npx cypress run --browser firefox --spec ./cypress/e2e/toolTests.js \
--config trashAssetsBeforeRuns=false'
if $toolTestsCommand >> toolTest.log
then
cat toolTest.log
else
if grep -q 'Error: ffmpeg exited' toolTest.log \
|| grep -q 'Because this error occurred during a `before each` hook' toolTest.log \
|| grep -q 'EISDIR: illegal operation on a directory, read' toolTest.log;
then
cat toolTest.log; $toolTestsCommand
else
cat toolTest.log; exit 1
fi
fi
if: ${{env.TOOL_TESTS == 'true'}}
- name: Copy test execution videos
run: |
cp cypress/videos/* public/videos
if: ${{ always() && (env.TOOL_TESTS == 'true')}}
- name: Run firefox requests tests
run: |
touch requestsTest.log
requestsTestsCommand='npx cypress run --browser firefox --spec ./cypress/e2e/requestsTests.js \
--config trashAssetsBeforeRuns=false'
if $requestsTestsCommand >> requestsTest.log
then
cat requestsTest.log
else
if grep -q 'Error: ffmpeg exited' requestsTest.log \
|| grep -q 'Because this error occurred during a `before each` hook' requestsTest.log \
|| grep -q 'EISDIR: illegal operation on a directory, read' requestsTest.log;
then
cat requestsTest.log; $requestsTestsCommand
else
cat requestsTest.log; exit 1
fi
fi
ls cypress
if: ${{always() && (env.REQUESTS_TESTS == 'true')}}
- name: Copy test execution videos
run: |
cp cypress/videos/* public/videos
if: ${{ always() && (env.REQUESTS_TESTS == 'true') }}
- name: Merge test results into one
run: npx mochawesome-merge cypress/results/json/*.json > index.json
if: ${{ always() && ((env.REQUESTS_TESTS == 'true') || (env.TOOL_TESTS == 'true')) }}
- name: Generate HTML report
run: npx marge index.json --reportDir public --assetsDir public/assets --reportPageTitle index.html
if: ${{ always() && ((env.REQUESTS_TESTS == 'true') || (env.TOOL_TESTS == 'true')) }}
- name: Deploy report page
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
if: ${{ always() && ((env.REQUESTS_TESTS == 'true') || (env.TOOL_TESTS == 'true')) }}