mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-29 16:49:35 +08:00
Mark the tab root with data-sidebar-chat so main-composer selectors exclude it, drop the tab type's ineffective multiple and builtin priority, guard the fork refusal check against a missing RPC error, log a /side with no conversation on screen, align the no-completed-turn notice with the fork shortcut wording, list the package in the experimental table, and add a browser test.
67 lines
3.0 KiB
TypeScript
67 lines
3.0 KiB
TypeScript
/** Side conversations: `/side` opens the child in the right Sidebar as a sidebar chat, and the tab survives a reload. */
|
|
import { readFile } from 'node:fs/promises'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { chromium, type Browser, type Page } from 'playwright'
|
|
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
|
import { acknowledgeReloadConnectionLoss, launchWebScaffold, seedSession, watchConsole, type WebScaffold } from './scaffold.ts'
|
|
import { newEnglishPage, saveFailureShot } from './support.ts'
|
|
|
|
const SEED = fileURLToPath(new URL('../../../snapshots/web/seeded-history/session.v3.jsonl', import.meta.url))
|
|
const SIDECHAT = fileURLToPath(new URL('../../../packages/experimental/client-ui-sidechat', import.meta.url))
|
|
const TITLE = 'Release checklist'
|
|
const SIDE_TITLE = `${TITLE} (1)`
|
|
|
|
describe('web e2e: side conversations', () => {
|
|
let scaffold: WebScaffold
|
|
let browser: Browser
|
|
let page: Page
|
|
let tripwire: ReturnType<typeof watchConsole>
|
|
|
|
beforeAll(async () => {
|
|
// No replay fixture: a bare `/side` forks without a model call, so a stray stream fails loud.
|
|
scaffold = await launchWebScaffold({ profile: { packages: [{ dir: SIDECHAT, enabled: true }] } })
|
|
const workspace = await scaffold.ctx.workspaceRegistry.create(scaffold.workspaceCwd)
|
|
const id = await seedSession(scaffold, await readFile(SEED, 'utf8'), 'sidechat')
|
|
await workspace.attachSession(id)
|
|
await scaffold.ctx.sessionController.rename({ sessionId: id, title: TITLE })
|
|
browser = await chromium.launch()
|
|
page = await newEnglishPage(browser)
|
|
await page.setViewportSize({ width: 1600, height: 900 })
|
|
tripwire = watchConsole(page)
|
|
await page.addInitScript((sessionId) => {
|
|
localStorage.setItem('dsh.sessions.current', JSON.stringify({ sessionId }))
|
|
}, id)
|
|
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
|
|
})
|
|
|
|
afterAll(async () => {
|
|
await browser?.close()
|
|
await scaffold?.close()
|
|
})
|
|
|
|
it('opens /side as a sidebar chat beside the main composer and restores the tab after reload', async () => {
|
|
onTestFailed(() => saveFailureShot(page, 'web-e2e-sidechat'))
|
|
// The main composer excludes sidebar chats, as the other Web specs select it.
|
|
const mainInput = page.locator('[data-composer-input]:not([data-sidebar-chat] [data-composer-input])')
|
|
const sideInput = page.locator('[data-sidechat][data-sidebar-chat] [data-composer-input]')
|
|
const sideTab = page.getByRole('tab', { name: SIDE_TITLE })
|
|
|
|
await mainInput.waitFor()
|
|
await mainInput.fill('/side')
|
|
await mainInput.press('Enter')
|
|
await sideTab.waitFor()
|
|
await sideInput.waitFor()
|
|
expect(await mainInput.count()).toBe(1)
|
|
await expect.poll(() => mainInput.textContent()).toBe('')
|
|
|
|
const warningStart = tripwire.warnings.length
|
|
await page.reload({ waitUntil: 'load' })
|
|
acknowledgeReloadConnectionLoss(tripwire, warningStart)
|
|
await sideTab.waitFor()
|
|
await sideInput.waitFor()
|
|
|
|
expect(tripwire.pageErrors).toEqual([])
|
|
expect(tripwire.warnings).toEqual([])
|
|
})
|
|
})
|