-
-
Notifications
You must be signed in to change notification settings - Fork 6
107 lines (87 loc) · 3.12 KB
/
end-to-end-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
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@v4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
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\nSERVER_SAVE_PREVIEW=true" > .env
- name: Upgrade Chrome Driver
run: php hyde dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 &
- 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@v4
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Compiled Source
if: always()
uses: actions/upload-artifact@v4
with:
name: dusk-source
path: tests/Browser/source
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: dusk-console
path: tests/Browser/console
- name: Upload app.css
uses: actions/upload-artifact@v4
with:
name: 'app.css'
path: '_media/app.css'
visual-regression-tests:
runs-on: ubuntu-latest
needs: dusk-browser-tests
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@v4
with:
name: dusk-source
path: _site
- name: Download app.css
uses: actions/download-artifact@v4
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 }}