Repository navigation
127 lines (112 loc) · 3.83 KB
/
Copy pathui-tests.yml
File metadata and controls
127 lines (112 loc) · 3.83 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
name: UI Tests
on:
push:
branches:
- develop
- main
paths-ignore:
- "**.md"
- "docs/**"
pull_request:
paths-ignore:
- "**.md"
- "docs/**"
merge_group:
workflow_dispatch:
concurrency:
group: ui-tests-buzz-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
ui-tests:
# Pinned: the ubuntu-26.04 image lacks libmysqlclient.so.21 and Playwright support
runs-on: ubuntu-24.04
timeout-minutes: 20
name: Playwright E2E Tests
env:
PYTHONWARNINGS: ignore
services:
redis-cache:
image: redis:alpine
ports:
- 13000:6379
redis-queue:
image: redis:alpine
ports:
- 11000:6379
mariadb:
image: mariadb:11.8
env:
MARIADB_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s --health-timeout=2s --health-retries=3
--tmpfs=/var/lib/mysql:rw,noexec,nosuid,size=2g
steps:
- name: Clone
uses: actions/checkout@v4
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Setup Bench
uses: ./.github/actions/setup-bench
with:
site-name: buzz.test
build-assets: true
- name: Create Test User
working-directory: /home/runner/frappe-bench
run: >-
bench --site buzz.test add-user testuser@buzz.test
--first-name Test --last-name User --password Test@123
--add-role "System Manager"
- name: Start Frappe Server
working-directory: /home/runner/frappe-bench
run: |
# No SMTP on CI: muting still queues Email Queue rows, it only never sends them.
bench --site buzz.test set-config mute_emails 1
# bench serve is one Python process; the parallel Playwright workers need several.
# Frappe creates the encryption key on first use, and separate gunicorn workers
# would each create their own, so guest booking tokens would not verify across them.
bench --site buzz.test execute frappe.utils.password.get_encryption_key > /dev/null
sed -i "s|^web: .*|web: cd sites \&\& ../env/bin/gunicorn -b 127.0.0.1:8000 -w 4 -t 120 'frappe.app:application_with_statics()'|" Procfile
bench start &> bench_start.log &
timeout 60 bash -c \
'until curl -sf http://buzz.test:8000 > /dev/null; do sleep 1; done'
- name: Install Playwright
run: |
# --ignore-scripts skips the postinstall that reinstalls the whole
# dashboard tree; the tests only need @playwright/test.
yarn install --frozen-lockfile --ignore-scripts
npx playwright install --with-deps --only-shell chromium
- name: Run Playwright Tests
run: npx playwright test
env:
BASE_URL: http://buzz.test:8000
FRAPPE_USER: testuser@buzz.test
FRAPPE_PASSWORD: Test@123
- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: test-results/
retention-days: 7
- name: Show Bench Logs on Failure
if: failure()
working-directory: /home/runner/frappe-bench
run: |
echo "=== Bench Start Log ==="
cat bench_start.log || true
echo ""
echo "=== Frappe Logs ==="
cat logs/*.log || true