test(client): align sidebar interactions and browser snapshots

This commit is contained in:
imccyu committed 2026-09-19 12:54:14 +08:00
1 parent 7baccf5d85
commit 7e4045c4c0
35 files changed
+67 -77

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@ async function openSeed(page: Page): Promise<void> {
// Search collapsed into a header action; expand it before filling.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByRole('textbox', { name: 'Search sessions...', exact: true })
const search = page.getByRole('textbox', { name: 'Search session names', exact: true })
await search.fill(FIXTURE.markers.user(1))
const results = page.getByRole('tree', { name: 'Search results' }).getByRole('treeitem')
await results.first().waitFor({ timeout: 60_000 })
+1 -1
View File
@@ -291,7 +291,7 @@ async function openSeed(page: Page, fixture: ChatScrollFixture, tailMarker?: str
// Search collapsed into a header action; expand it before filling.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByRole('textbox', { name: 'Search sessions...', exact: true })
const search = page.getByRole('textbox', { name: 'Search session names', exact: true })
// Cold summaries initially show the temporary workspace basename, so the
// persisted first-prompt marker is the stable user-facing identity. The
// query itself triggers lazy content-index reconciliation; no transient
+1 -1
View File
@@ -192,7 +192,7 @@ async function openSeededSession(page: Page): Promise<void> {
// Search collapsed into a header action; expand it before filling.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByRole('textbox', { name: 'Search sessions...', exact: true })
const search = page.getByRole('textbox', { name: 'Search session names', exact: true })
await search.fill(FIXTURE.markers.user(1))
const results = page.getByRole('tree', { name: 'Search results' }).getByRole('treeitem')
const deadline = Date.now() + 60_000
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "Agent 预设" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "Agent 预设" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "Agent 预设" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -1,8 +1,10 @@
- tree "Sessions":
- treeitem "{{workspace}}" [expanded]
- treeitem "Review deepseek-ai/deepseek-harness#314 Session actions for Review deepseek-ai/deepseek-harness#314" [selected]:
- treeitem "Review deepseek-ai/deepseek-harness#314 Session actions for Review deepseek-ai/deepseek-harness#314 Archive session Pin session" [selected]:
- text: Review deepseek-ai/deepseek-harness#314
- button "Session actions for Review deepseek-ai/deepseek-harness#314"
- button "Archive session"
- button "Pin session"
---
@@ -1,8 +1,10 @@
- tree "Sessions":
- treeitem "{{workspace}}" [expanded]
- treeitem "Review deepseek-ai/deepseek-harness#314 Session actions for Review deepseek-ai/deepseek-harness#314" [selected]:
- treeitem "Review deepseek-ai/deepseek-harness#314 Session actions for Review deepseek-ai/deepseek-harness#314 Archive session Pin session" [selected]:
- text: Review deepseek-ai/deepseek-harness#314
- button "Session actions for Review deepseek-ai/deepseek-harness#314"
- button "Archive session"
- button "Pin session"
---
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- heading "模型" [level=2]
@@ -5,7 +5,6 @@
- button "Models"
- button "Built-in plugins"
- button "Agent presets"
- button "Archived sessions"
- button "Open configuration file"
- button "Close"
- text: Permission Choose the default permission mode for new sessions
@@ -5,7 +5,6 @@
- button "模型"
- button "内置插件"
- button "Agent 预设"
- button "已归档会话"
- button "打开配置文件"
- button "关闭"
- text: 权限 选择新会话的默认权限模式
@@ -7,3 +7,7 @@
- text: Order by
- menuitem "Manual"
- menuitem "Last updated"
- separator
- text: Filter sessions
- menuitem "Show archived"
- menuitem "Archived only"
+4 -3
View File
@@ -241,9 +241,10 @@ describe('web e2e: message IconActions and clocks on settled history', () => {
() => branchButtons.evaluateAll(buttons => buttons.map(button => button.getAttribute('aria-disabled'))),
{ timeout: 5_000 },
).toEqual(['true', null, null])
await branchButtons.first().focus()
await expect.poll(() => page.getByRole('tooltip').textContent(), { timeout: 5_000 })
.toBe('Available only on the last message of a completed turn')
await branchButtons.first().press('Shift+Tab')
await page.keyboard.press('Tab')
await expect.poll(() => page.getByRole('tooltip').allTextContents(), { timeout: 5_000 })
.toEqual(['Available only on the last message of a completed turn'])
await expect.poll(() => page.getByRole('button', { name: 'Edit' }).count(), { timeout: 5_000 }).toBe(0)
}, 60_000)
+2 -2
View File
@@ -62,7 +62,7 @@ async function ensureSeedOpen(page: Page): Promise<void> {
// Search is a collapsed header action; expand it so the input is actionable.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByPlaceholder('Search sessions', { exact: false })
const search = page.getByPlaceholder('Search session names', { exact: false })
if (await chat.count() === 0) {
await search.fill('WATERFALL')
const result = page.getByRole('tree', { name: 'Search results' }).getByRole('treeitem')
@@ -188,7 +188,7 @@ describe('web e2e: navigation & panes over a rich seeded session', () => {
// Search is a collapsed header action; expand it so the input is actionable.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByPlaceholder('Search sessions', { exact: false })
const search = page.getByPlaceholder('Search session names', { exact: false })
// The cold row has not been opened, so only the persisted log can satisfy
// this query. First search lazily reconciles the SQLite content index.
await search.fill('zzzqx-no-such-session')
+1 -1
View File
@@ -72,7 +72,7 @@ describe.skipIf(MODE === 'record' || !HAS_PWSH)('web e2e: pwsh calls use the bas
// collapsed header action; expand it so the input is actionable.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByPlaceholder('Search sessions', { exact: false })
const search = page.getByPlaceholder('Search session names', { exact: false })
await search.fill('Run a PowerShell command')
const result = page.getByRole('tree', { name: 'Search results' }).getByRole('treeitem')
await expect.poll(() => result.count(), { timeout: 15_000 }).toBe(1)
+1 -1
View File
@@ -53,7 +53,7 @@ describe('web e2e: rail search click survives its own document-level bubble', ()
const wideSearch = page.getByRole('button', { name: 'Search sessions' })
await expect.poll(async () => wideSearch.getAttribute('aria-expanded'), { timeout: 10_000 }).toBe('true')
const input = page.getByPlaceholder('Search sessions...')
const input = page.getByPlaceholder('Search session names')
await expect.poll(
async () => input.evaluate(el => document.activeElement === el),
{ timeout: FOCUS_SETTLE_MS + 10_000 },
+1 -1
View File
@@ -681,7 +681,7 @@ describe.skipIf(MODE === 'record')('web e2e: active Schedule catalog', () => {
expect(await catalogRow.getByRole('img', { name: ACTIVE_SCHEDULE_LABEL }).count()).toBe(1)
await page.getByRole('button', { name: 'Search sessions' }).click()
const search = page.getByPlaceholder('Search sessions', { exact: false })
const search = page.getByPlaceholder('Search session names', { exact: false })
await search.fill(CATALOG_TITLE)
const result = page.getByRole('tree', { name: 'Search results' })
.getByRole('treeitem', { name: new RegExp(CATALOG_TITLE) })
+12 -43
View File
@@ -1,8 +1,5 @@
// Web e2e scenario: the archived-session Settings page restores a Session
// through the real wire, from its row menu through the archive set, the page,
// and the reload that rebuilds state from the host baseline. Zero model calls:
// both verbs are host RPCs and the page reads already-loaded Session summaries,
// so no replay fixture mounts and a stray model stream fails loud.
// Archive and restore through sidebar row menus and the archived filter,
// then reload from the Host baseline. This flow makes no model calls.
import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import type { Browser, Locator, Page } from 'playwright'
@@ -19,7 +16,7 @@ import { newEnglishPage, saveFailureShot } from './support.ts'
const SEED = fileURLToPath(new URL('../../../snapshots/web/seeded-history/session.v3.jsonl', import.meta.url))
const SEED_ID = 'session-unarchive-web-e2e'
describe('web e2e: archived sessions are restored from the Settings page', () => {
describe('web e2e: archived sessions are restored from the sidebar filter', () => {
let scaffold: WebScaffold
let browser: Browser
let page: Page
@@ -76,7 +73,7 @@ describe('web e2e: archived sessions are restored from the Settings page', () =>
await scaffold?.close()
})
it('archives the seed, unarchives it from Settings, and keeps it restored across reload', async () => {
it('archives the seed, restores it through the sidebar filter, and keeps it restored across reload', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-session-unarchive'))
// Select the only visible Session, then give it a user-owned title: the
// locator binds to the seed's own copy on both sides of the round trip.
@@ -104,46 +101,18 @@ describe('web e2e: archived sessions are restored from the Settings page', () =>
expect((await scaffold.ctx.sessionPersistence.list()).map(snapshot => snapshot.header.id))
.toContain(SessionId(SEED_ID))
// The Settings page lists the archived Session behind its own search box.
await page.getByRole('button', { name: 'Settings', exact: true }).click()
const dialog = page.getByRole('dialog', { name: 'Settings' })
await dialog.waitFor({ timeout: 10_000 })
await dialog.getByRole('button', { name: 'Archived sessions' }).click()
const search = dialog.getByRole('searchbox', { name: 'Search archived sessions' })
await search.waitFor({ timeout: 10_000 })
const unarchiveRow = dialog.getByRole('button', { name: `Unarchive ${title}` })
await expect.poll(() => unarchiveRow.count(), { timeout: 10_000 }).toBe(1)
expect(await dialog.getByText(title, { exact: true }).count()).toBe(1)
expect(await dialog.getByText(/^Ungrouped · /).count()).toBe(1)
expect(await dialog.getByText('No archived sessions.', { exact: true }).count()).toBe(0)
// The search box filters these rows in both directions.
await search.fill('zzz-no-such-archived-session')
await expect.poll(
() => dialog.getByText('No matching sessions.', { exact: true }).count(),
{ timeout: 5_000 },
).toBe(1)
expect(await unarchiveRow.count()).toBe(0)
await search.fill(title)
await expect.poll(() => unarchiveRow.count(), { timeout: 5_000 }).toBe(1)
expect(await dialog.getByText('No matching sessions.', { exact: true }).count()).toBe(0)
await search.fill('')
await expect.poll(() => unarchiveRow.count(), { timeout: 5_000 }).toBe(1)
// Unarchive: the durable set empties (the row's own RPC), the page row
// leaves with the empty status, and the Session row is back in the sidebar.
await unarchiveRow.click()
await page.getByRole('button', { name: 'View options' }).click()
await page.getByRole('menuitem', { name: 'Show archived', exact: true }).click()
await ungroupedSection()
await expect.poll(() => sessionRow.count(), { timeout: 10_000 }).toBe(1)
await clickHoverAction(sessionRow, `Session actions for ${title}`)
await page.getByRole('menuitem', { name: 'Unarchive session' }).click()
await expect.poll(
() => [...scaffold.ctx.workspaceRegistry.archivedSessionIds],
{ timeout: 10_000 },
).toEqual([])
await expect.poll(() => unarchiveRow.count(), { timeout: 10_000 }).toBe(0)
expect(await dialog.getByText(title, { exact: true }).count()).toBe(0)
await expect.poll(
() => dialog.getByText('No archived sessions.', { exact: true }).count(),
{ timeout: 10_000 },
).toBe(1)
await dialog.getByRole('button', { name: 'Close' }).last().click()
await dialog.waitFor({ state: 'hidden', timeout: 10_000 })
await page.getByRole('button', { name: 'View options' }).click()
await page.getByRole('menuitem', { name: 'Show archived', exact: true }).click()
await ungroupedSection()
await expect.poll(() => sessionRow.count(), { timeout: 15_000 }).toBe(1)
+2 -1
View File
@@ -595,7 +595,8 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
() => page.getByRole('tree', { name: 'Sessions' }).getByRole('treeitem').count(),
{ timeout: 15_000 },
).toBe(3)
expect(await page.getByText('Ungrouped', { exact: true }).count()).toBe(0)
expect(await page.getByRole('tree', { name: 'Sessions' })
.getByRole('treeitem', { name: 'Ungrouped', exact: true }).count()).toBe(0)
const hierarchy = page.getByRole('navigation', { name: 'Session hierarchy' })
await expect.poll(() => hierarchy.getByRole('button').count()).toBe(1)
await compareOrRefreshGolden(
@@ -71,7 +71,7 @@ async function openSeed(page: Page): Promise<void> {
// Search collapsed into a header action; expand it before filling.
const searchButton = page.getByRole('button', { name: 'Search sessions' })
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
const search = page.getByRole('textbox', { name: 'Search sessions...', exact: true })
const search = page.getByRole('textbox', { name: 'Search session names', exact: true })
await search.fill(FIXTURE.markers.user(1))
const result = page.getByRole('tree', { name: 'Search results' }).getByRole('treeitem')
await expect.poll(() => result.count(), { timeout: 60_000 }).toBe(1)
@@ -0,0 +1,10 @@
// @vitest-environment node
import { describe, expect, it } from 'vitest'
import { Tooltip } from '../src/Tooltip.tsx'
describe('Tooltip module in Node', () => {
it('loads without installing browser input listeners', () => {
expect(typeof window).toBe('undefined')
expect(Tooltip).toBeTypeOf('function')
})
})
@@ -95,6 +95,23 @@ describe('Tooltip', () => {
const rect = (left: number, right: number): DOMRect =>
({ left, right, top: 0, bottom: 20, width: right - left, height: 20, x: left, y: 0, toJSON: () => ({}) })
it('aligns the end of a bottom tooltip with the anchor right edge', () => {
const spy = vi.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue(rect(100, 200))
try {
render(
<Tooltip label="End aligned" side="bottom" align="end">
<button type="button">anchor</button>
</Tooltip>,
)
fireEvent.mouseEnter(screen.getByText('anchor'))
const bubble = screen.getByRole('tooltip')
expect(bubble.getAttribute('data-align')).toBe('end')
expect(bubble.style.left).toBe('200px')
} finally {
spy.mockRestore()
}
})
it('caps the bubble width where the label would otherwise slab across the surface', () => {
render(
<Tooltip label="A description long enough to need a cap" side="bottom" maxWidth={360}>
@@ -5,7 +5,7 @@
- button "Plugins"
- text: Workspaces
- button "Search sessions"
- textbox "Search sessions..."
- textbox "Search session names"
- button "View options"
- button "Add workspace"
- tree "Sessions":
@@ -5,7 +5,7 @@
- button "插件"
- text: 工作区
- button "搜索会话"
- textbox "搜索会话…"
- textbox "搜索会话名称"
- button "视图选项"
- button "添加工作区"
- tree "会话":
@@ -5,7 +5,7 @@
- button "Plugins"
- text: Workspaces
- button "Search sessions"
- textbox "Search sessions..."
- textbox "Search session names"
- button "View options"
- button "Add workspace"
- tree "Sessions":
@@ -14,7 +14,6 @@
- paragraph: partial
- text: Stopped
- button "Copy"
- tooltip "Copy"
- button "Good response"
- button "Bad response"
- button "Branch into a new conversation"