Add Playwright UI tests and before/after screenshots to CI
Lint / UI screenshots (before/after) (push) Skipped
Lint / JS (eslint) (push) Successful in 16s
Lint / PHP (phpcs PSR-12) (push) Successful in 30s
Lint / PHP requirements (version + extensions) (push) Successful in 50s
Lint / UI (playwright) (push) Successful in 3m29s
Lint / Deploy (push) Skipped
Lint / Notify on failure (push) Skipped
Security / PHP Security (semgrep) (push) Successful in 2m59s
Lint / JS (eslint) (pull_request) Successful in 16s
Lint / PHP (phpcs PSR-12) (pull_request) Successful in 33s
Lint / PHP requirements (version + extensions) (pull_request) Successful in 32s
Lint / UI (playwright) (pull_request) Successful in 2m23s
Lint / Deploy (pull_request) Skipped
Lint / Notify on failure (pull_request) Skipped
Security / PHP Security (semgrep) (pull_request) Successful in 1m32s
Lint / UI screenshots (before/after) (pull_request) Successful in 4m14s
Lint / UI screenshots (before/after) (push) Skipped
Lint / JS (eslint) (push) Successful in 16s
Lint / PHP (phpcs PSR-12) (push) Successful in 30s
Lint / PHP requirements (version + extensions) (push) Successful in 50s
Lint / UI (playwright) (push) Successful in 3m29s
Lint / Deploy (push) Skipped
Lint / Notify on failure (push) Skipped
Security / PHP Security (semgrep) (push) Successful in 2m59s
Lint / JS (eslint) (pull_request) Successful in 16s
Lint / PHP (phpcs PSR-12) (pull_request) Successful in 33s
Lint / PHP requirements (version + extensions) (pull_request) Successful in 32s
Lint / UI (playwright) (pull_request) Successful in 2m23s
Lint / Deploy (pull_request) Skipped
Lint / Notify on failure (pull_request) Skipped
Security / PHP Security (semgrep) (pull_request) Successful in 1m32s
Lint / UI screenshots (before/after) (pull_request) Successful in 4m14s
New UI (playwright) job: PHP and MariaDB inside the Playwright image, a seeded instance (tests/ui/stack.sh, synthetic data only) and 21 tests: every main page loads with no page errors, console errors or failed requests, description and comment markdown render safely (#114), and pages fit a phone screen. Deploys now wait for it. New UI screenshots (before/after) job: for PRs that change assets/ or views/, runs the base branch and the PR side by side with the same data and uploads one side-by-side PNG per page and view (dark, light, phone). Modelled on Pulse's ui and ui-screenshots jobs. Fixes found while building it: - migrate.php split statements on semicolons inside -- comments, so 001 and 003 failed on a fresh database. - API endpoints applied rate limiting before loading config, so RATE_LIMIT_DEFAULT/RATE_LIMIT_API from .env and TRUSTED_PROXIES were ignored there: every user behind the proxy shared one per-IP bucket. The limiter now loads config itself; the per-IP limits are configurable (RATE_LIMIT_IP, RATE_LIMIT_IP_API) with unchanged defaults. - The avatar error fallback was registered in the footer, after the header avatar, so a fast 404 left a broken image instead of initials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bdc6028572
commit
f1decca31f
22 files changed
+777
-8
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# CI only: installs PHP and a throwaway MariaDB inside the Playwright job
|
||||
# container (Ubuntu, as root) and starts MariaDB on 127.0.0.1:3306. Run once per
|
||||
# job, before tests/ui/stack.sh. MariaDB runs in the job container rather than
|
||||
# as a service container because the Gitea runner puts jobs on Docker's default
|
||||
# bridge network, where services can't be reached by name (same as Pulse).
|
||||
set -euo pipefail
|
||||
|
||||
# The Playwright image points apt at Azure's Ubuntu mirror, which our runner
|
||||
# can't always reach; use the main Ubuntu mirror instead, and retry.
|
||||
for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do
|
||||
[ -f "$f" ] && sed -i 's#http://azure\.archive\.ubuntu\.com/#http://archive.ubuntu.com/#g' "$f"
|
||||
done
|
||||
PKGS="mariadb-server php-cli php-mysql php-mbstring php-curl php-ldap php-xml"
|
||||
for attempt in 1 2 3; do
|
||||
# shellcheck disable=SC2086
|
||||
if apt-get -o Acquire::Retries=3 update -qq \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 install -y -qq --no-install-recommends $PKGS >/dev/null; then
|
||||
break
|
||||
fi
|
||||
[ "$attempt" = 3 ] && { echo "::error::could not install $PKGS"; exit 1; }
|
||||
echo "apt failed (attempt $attempt); retrying in 10s"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
mkdir -p /run/mysqld && chown mysql:mysql /run/mysqld
|
||||
if ! mariadb-admin ping --silent 2>/dev/null; then
|
||||
(mariadbd --user=mysql --bind-address=127.0.0.1 --port=3306 >/tmp/mariadb.log 2>&1 &)
|
||||
fi
|
||||
for _ in $(seq 1 30); do mariadb-admin ping --silent 2>/dev/null && break; sleep 1; done
|
||||
mariadb -e "CREATE USER IF NOT EXISTS 'tinker_ui'@'127.0.0.1' IDENTIFIED BY 'ci-only';"
|
||||
echo "$(php --version | head -1), $(mariadb --version)"
|
||||
Reference in new issue
Block a user