mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
8302048bc4
* test(mobile): single-source map for per-view mobile treatment Declare how every top-level view behaves on a phone in one place: MOBILE_TREATMENTS is a Record<ActiveView, ...>, so adding a new view without classifying it (bespoke / responsive / desktop-only / detail) fails the type check. BESPOKE_MOBILE_VIEWS is derived from it instead of hand-maintained, and a unit test keeps the two in lockstep and pins the current bespoke set so a change is deliberate. EditorLayout consumes the derived set; behavior is unchanged. * ci(visual): run the desktop-unchanged gate in its own job Split the visual-regression spec into a dedicated Playwright "visual" project, excluded from the default chromium project the functional E2E job runs, so a missing or platform-mismatched baseline can no longer fail every PR. Add a Visual Regression workflow: a compare job gates PRs into main against committed baselines (and skips with a warning until they are seeded), and a manual seed job regenerates the baselines on the Linux runner and commits them to a feature branch (refusing main). Baselines are platform-specific, so they must be produced on the runner rather than locally. Drop the stack-detail view from the gate: a fresh CI app has no stack to open and its live log stream is not deterministic; the shell plus the four content views still catch a desktop base-class regression.
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright E2E config for Sencho.
|
|
*
|
|
* Before running: ensure both dev servers are up:
|
|
* cd backend && npm run dev &
|
|
* cd frontend && npm run dev &
|
|
*
|
|
* Or use the webServer config below (which starts them automatically).
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
// Don't stop on first failure - show all results
|
|
maxFailures: 0,
|
|
// How long to wait for a single test
|
|
timeout: 30_000,
|
|
// How long to wait for an expect() assertion
|
|
expect: { timeout: 5_000 },
|
|
// Run tests serially - Sencho is a single-user app and tests share DB state
|
|
workers: 1,
|
|
reporter: [['list'], ['html', { outputFolder: 'e2e/report', open: 'never' }]],
|
|
|
|
use: {
|
|
baseURL: 'http://localhost:5173',
|
|
// Persist auth state between tests in the same file
|
|
storageState: undefined,
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
// Default project (what CI runs via --project=chromium). Skips the manual
|
|
// screenshot capture spec and the visual-regression gate: the gate needs
|
|
// committed, platform-matched baselines and runs in its own job, so it
|
|
// must not fail the functional E2E run on a missing snapshot.
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
testIgnore: ['**/screenshots.spec.ts', '**/desktop-visual-regression.spec.ts'],
|
|
},
|
|
{
|
|
// Desktop-unchanged visual gate. Run explicitly (and in the dedicated
|
|
// Visual Regression workflow):
|
|
// npx playwright test --project=visual
|
|
// Baselines are platform-specific; regenerate with --update-snapshots in
|
|
// the same environment you compare in (locally, or the workflow's
|
|
// Playwright container for the CI baselines).
|
|
name: 'visual',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
testMatch: ['**/desktop-visual-regression.spec.ts'],
|
|
},
|
|
{
|
|
// Manual-only project for capturing docs/images/. Run explicitly:
|
|
// npx playwright test --project=screenshots
|
|
name: 'screenshots',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
testMatch: ['**/screenshots.spec.ts'],
|
|
},
|
|
],
|
|
});
|