Files
tinker_tickets/tests/ui/pages.ui.js
T
jaredandClaude Opus 5.5 f1decca31f
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
Add Playwright UI tests and before/after screenshots to CI
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>
2026-11-23 19:06:52 -05:00

43 lines
1.5 KiB
JavaScript

'use strict';
// Every main page loads for a signed-in admin with no page errors, console
// errors or failed requests (checked by the fixture).
const { test, expect } = require('./fixtures');
const PAGES = [
['/', 'dashboard'],
['/ticket/100000001', 'markdown ticket'],
['/ticket/100000002', 'alert ticket'],
['/ticket/100000003', 'plain-text ticket'],
['/ticket/create', 'create ticket'],
['/admin/templates', 'templates admin'],
['/admin/workflow', 'workflow admin'],
['/admin/audit-log', 'audit log'],
['/admin/api-keys', 'API keys'],
];
for (const [path, name] of PAGES) {
test(`${name} (${path}) loads cleanly`, async ({ page }) => {
const res = await page.goto(path);
expect(res.status()).toBe(200);
await page.waitForLoadState('networkidle');
await expect(page.locator('body')).not.toContainText('Fatal error');
await expect(page.locator('body')).not.toContainText('Warning:');
});
}
test('the dashboard lists the seeded tickets', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('heading', { level: 1 })).toContainText('TICKETS');
for (const id of ['100000001', '100000002', '100000003']) {
await expect(page.locator(`a[href*="/ticket/${id}"]`).first()).toBeVisible();
}
});
test('requests without the SSO headers are not let in', async ({ baseURL }) => {
// Plain fetch: Playwright's own request contexts pick up the fixture's SSO
// headers.
const res = await fetch(new URL('/', baseURL), { redirect: 'manual' });
expect(res.status, 'anonymous request to the dashboard').toBe(401);
});