mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-07 16:27:09 -04:00
The UI coverage gate was tightened to 0.1pp against a fast-local measurement (39.86% baseline); CI's slower runners measure ~0.9pp lower, so tests-ui-e2e failed there. UI e2e coverage is diffusely non-deterministic and tracks machine speed — a 0.1pp band can't hold across environments. Rather than loosen the gate, raise the floor under it: a render-smoke spec mounts each lazy page (navigate + assert the header renders), covering a dozen previously-untested pages and lifting coverage from ~39% to ~42.7% locally. Restore the tolerance to 0.8pp and set the baseline conservatively (40.0), below the slow-CI floor, so the ratchet holds without flapping. Document the coverage policy — install the git hooks and don't bypass them (no --no-verify, no hand-lowering the baseline or widening the tolerance); raise coverage by adding tests instead; set the UI baseline below the slow-CI floor — in AGENTS.md, CONTRIBUTING.md and .agents/building-and-testing.md. Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Richard Palethorpe <io@richiejp.com>
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
import { test, expect } from './coverage-fixtures.js'
|
|
|
|
// Render-smoke coverage. Each page is lazy-loaded and runs its full render +
|
|
// initial effects on mount, so a bare visit captures the bulk of a page's
|
|
// lines — cheap, real coverage for pages that have no dedicated spec yet.
|
|
//
|
|
// This is the project's preferred way to keep the UI coverage gate green:
|
|
// raise the floor by covering more, rather than loosening the gate's
|
|
// tolerance (see CONTRIBUTING.md → "React UI coverage"). Auth is disabled in
|
|
// the test server, so RequireAdmin/RequireFeature resolve to isAdmin=true and
|
|
// every gated route renders without an auth/capability mock.
|
|
//
|
|
// Asserts the page mounted (its .page-title header is visible) and that it did
|
|
// not bounce to a gate redirect (/login or back to /app home).
|
|
const PAGES = [
|
|
['/app/talk', 'Talk'],
|
|
['/app/usage', 'Usage'],
|
|
['/app/account', 'Account'],
|
|
['/app/studio', 'Studio'],
|
|
['/app/manage', 'Manage'],
|
|
['/app/backends', 'Backends'],
|
|
['/app/settings', 'Settings'],
|
|
['/app/nodes', 'Nodes'],
|
|
['/app/face', 'Face recognition'],
|
|
['/app/voice', 'Voice recognition'],
|
|
['/app/fine-tune', 'Fine-tuning'],
|
|
['/app/quantize', 'Quantize'],
|
|
]
|
|
|
|
test.describe('Page render smoke', () => {
|
|
for (const [path, label] of PAGES) {
|
|
test(`renders ${label} (${path})`, async ({ page }) => {
|
|
await page.goto(path)
|
|
// .page-title for the normal header; .empty-state-title for pages that
|
|
// render a gated/empty state (e.g. Account when auth is disabled).
|
|
await expect(page.locator('.page-title, .empty-state-title').first()).toBeVisible({ timeout: 15_000 })
|
|
await expect(page).toHaveURL(new RegExp(path.replace(/\//g, '\\/') + '$'))
|
|
})
|
|
}
|
|
})
|