-
-
Notifications
You must be signed in to change notification settings - Fork 6
115 lines (94 loc) · 3.43 KB
/
end-to-end-testing.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
name: End-to-End Testing
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
dusk-browser-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Composer Dependencies
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run smoke tests # if standard tests fail, there is no reason to do visual tests as they are expensive and it's faster to run them in parallel here than to wait for a main test job to run
run: vendor/bin/pest --stop-on-failure
- name: Prepare the Environment
run: echo -e "APP_URL=http://localhost:8080 \nDUSK_ENABLED=true\nSERVER_DASHBOARD=false" > .env
- name: Downgrade Chrome browser to v114
uses: browser-actions/setup-chrome@v1
with:
chrome-version: 1134343 # Last commit number for Chrome v114
id: setup-chrome
- run: sudo ln -fs ${{ steps.setup-chrome.outputs.chrome-path }} /usr/bin/google-chrome
- name: Downgrade Chrome driver to v114
run: php hyde dusk:chrome-driver `/usr/bin/google-chrome --version | cut -d " " -f3 | cut -d "." -f1`
- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux &
- name: Run HydeRC Server
run: php hyde serve &
- name: Run Dusk Tests
env:
APP_URL: "http://127.0.0.1:8080"
run: php hyde dusk --pest
- name: Upload Screenshots
if: always()
uses: actions/upload-artifact@v2
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Compiled Source
if: always()
uses: actions/upload-artifact@v2
with:
name: dusk-source
path: tests/Browser/source
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: dusk-console
path: tests/Browser/console
- name: Upload app.css
uses: actions/upload-artifact@v2
with:
name: 'app.css'
path: '_media/app.css'
visual-regression-testing:
runs-on: ubuntu-latest
needs: dusk-browser-tests
# if: (! github.event.pull_request.draft)
if: contains(github.event.pull_request.labels.*.name, 'run-visual-tests') || github.event_name == 'push'
steps:
- name: Download Dusk generated pages
uses: actions/download-artifact@v2
with:
name: dusk-source
path: _site
- name: Download app.css
uses: actions/download-artifact@v2
with:
name: app.css
path: _site/media
# Since some of the browser tests visually overlap,
# we don't gain any real value from a visual regression test on them.
- name: Remove overlapping fixtures
run: |
rm _site/blank_homepage.html
rm _site/posts_homepage.html
rm _site/docs/index.html
- name: Install Percy
run: npm install --save-dev @percy/cli
- name: Upload build to Percy
run: npx percy snapshot _site/
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}