Files
hapi/playwright.config.ts
T
a82dd49049 feat(web): markdown Source | Preview toggle in session file pane (#957)
* feat(web): markdown Source | Preview toggle in session file pane

Add Source | Preview toggle for .md/.mdx files in the session file route,
defaulting to preview with localStorage persistence. Reuse chat markdown
pipeline via MarkdownRenderer standalone mode (no assistant-ui thread).

Includes unit tests, Playwright smoke, and e2e fixture.

Closes tiann/hapi#954

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web): cast standalone MarkdownRenderer components for react-markdown

Soup verify gate: defaultComponents merge type is wider than
react-markdown Components; standalone file-pane path needs explicit cast.

* fix(web): route file-pane markdown fences through SyntaxHighlighter

Standalone file preview now mirrors chat code-block rendering: fenced
blocks use SyntaxHighlighter and MARKDOWN_COMPONENTS_BY_LANGUAGE (mermaid
included) without requiring ThreadPrimitive context.

Addresses HAPI Bot Major on tiann/hapi#957.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web): detect fenced vs inline code in standalone markdown preview

Move block detection to the pre override (react-markdown v10 does not pass
inline to custom code components). Add inline-code regression test.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 11:06:38 +08:00

49 lines
1.7 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
const PORT = Number(process.env.PLAYWRIGHT_WEB_PORT ?? 5179)
const BASE_URL = `http://localhost:${PORT}`
export default defineConfig({
testDir: './e2e',
timeout: 30_000,
expect: { timeout: 5_000 },
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL: BASE_URL,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
// The CI runner and most sandboxed dev environments
// run as root or under restricted user namespaces;
// without --no-sandbox chromium silently exits 0 a
// few seconds after launch and the page handshake
// times out. Keep the flag scoped to launchOptions
// so this is the only place a future maintainer has
// to revisit if they harden the runner.
args: ['--no-sandbox'],
},
},
},
],
webServer: {
// The fixture page mounts ScratchlistPanel in isolation; no hub
// is required, which is why this dev server doesn't proxy /api.
command: `bun run --cwd web dev -- --port ${PORT} --strictPort`,
url: `${BASE_URL}/e2e-fixtures/scratchlist-fixture.html`,
timeout: 60_000,
reuseExistingServer: !process.env.CI,
stdout: 'ignore',
stderr: 'pipe',
},
})