Merge pull request #6887 from deepseek-harness/turtle/trace-tab-indicator-clip-bede5ab93d0f
fix(ui-conversation): keep the active tab bar visible over Trajectory and widen tab targets
This commit is contained in:
commit
a0cbe9331c
7 files changed
+138
-10
No files matched your search
@@ -0,0 +1,110 @@
|
||||
// Browser hit testing for the conversation view tabs: each tab accepts presses
|
||||
// beyond its label, and the selected tab's bar stays above the Trajectory
|
||||
// view's sticky toolbar where the two meet.
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
||||
import { createChatScrollFixture } from './chat-scroll-fixture.ts'
|
||||
import { launchWebScaffold, seedSession, watchConsole, type WebScaffold } from './scaffold.ts'
|
||||
import { newEnglishPage, saveFailureShot } from './support.ts'
|
||||
|
||||
const FIXTURE = createChatScrollFixture({
|
||||
markerPrefix: 'VIEW_TABS',
|
||||
title: 'VIEW_TABS short session',
|
||||
turns: 4,
|
||||
})
|
||||
const SEED_ID = 'conversation-view-tabs-web-e2e'
|
||||
|
||||
/** Label and button rectangles of one tab, and which element owns each probe point. */
|
||||
interface TabProbe {
|
||||
readonly label: { left: number; top: number; right: number; bottom: number }
|
||||
readonly button: { left: number; top: number; right: number; bottom: number }
|
||||
readonly ownsAboveLabel: boolean
|
||||
readonly ownsBesideLabel: boolean
|
||||
readonly ownsBarOverhang: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Probe one tab: the run above and beside its label, and the bar's lowest
|
||||
* half pixel, below the button box.
|
||||
* @param page - the page under test.
|
||||
* @param name - the tab's accessible name.
|
||||
* @returns the tab's rectangles and probe owners.
|
||||
*/
|
||||
async function probeTab(page: Page, name: string): Promise<TabProbe> {
|
||||
return page.getByRole('tab', { name, exact: true }).evaluate((tab) => {
|
||||
const range = document.createRange()
|
||||
range.selectNodeContents(tab)
|
||||
const label = range.getBoundingClientRect()
|
||||
const button = tab.getBoundingClientRect()
|
||||
const owns = (x: number, y: number): boolean => document.elementFromPoint(x, y)?.closest('[role="tab"]') === tab
|
||||
const centerX = (label.left + label.right) / 2
|
||||
return {
|
||||
label: { left: label.left, top: label.top, right: label.right, bottom: label.bottom },
|
||||
button: { left: button.left, top: button.top, right: button.right, bottom: button.bottom },
|
||||
ownsAboveLabel: owns(centerX, label.top - 8),
|
||||
ownsBesideLabel: owns(label.left - 8, (label.top + label.bottom) / 2),
|
||||
ownsBarOverhang: owns(centerX, button.bottom + 0.5),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function openSeededSession(page: Page): Promise<void> {
|
||||
const searchButton = page.getByRole('button', { name: 'Search sessions' })
|
||||
if (await searchButton.getAttribute('aria-expanded') !== 'true') await searchButton.click()
|
||||
await page.getByRole('textbox', { name: 'Search session names', exact: true }).fill(FIXTURE.markers.user(1))
|
||||
const results = page.getByRole('tree', { name: 'Search results' }).getByRole('treeitem')
|
||||
const deadline = Date.now() + 60_000
|
||||
while (await results.count() !== 1) {
|
||||
if (Date.now() > deadline) throw new Error('seeded session never appeared in the sidebar search results')
|
||||
await page.waitForTimeout(200)
|
||||
}
|
||||
await results.click()
|
||||
}
|
||||
|
||||
describe('web e2e: conversation view tabs', () => {
|
||||
let scaffold: WebScaffold
|
||||
let browser: Browser
|
||||
let page: Page
|
||||
let tripwire: ReturnType<typeof watchConsole>
|
||||
|
||||
beforeAll(async () => {
|
||||
scaffold = await launchWebScaffold({})
|
||||
await seedSession(scaffold, FIXTURE.log, SEED_ID)
|
||||
browser = await chromium.launch()
|
||||
page = await newEnglishPage(browser, 900)
|
||||
tripwire = watchConsole(page)
|
||||
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
|
||||
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
||||
await openSeededSession(page)
|
||||
await page.getByText(FIXTURE.markers.assistant(FIXTURE.turns), { exact: false }).last()
|
||||
.waitFor({ timeout: 30_000 })
|
||||
}, 180_000)
|
||||
|
||||
afterAll(async () => {
|
||||
await browser?.close()
|
||||
await scaffold?.close()
|
||||
})
|
||||
|
||||
it('takes presses above and beside the label', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-conversation-view-tabs-target'))
|
||||
const chat = await probeTab(page, 'Chat')
|
||||
expect(chat.button.top).toBeLessThan(chat.label.top - 8)
|
||||
expect(chat.button.left).toBeLessThan(chat.label.left - 8)
|
||||
expect(chat.ownsAboveLabel).toBe(true)
|
||||
expect(chat.ownsBesideLabel).toBe(true)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it('keeps the selected bar above the Trajectory toolbar', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-conversation-view-tabs-trajectory'))
|
||||
await page.getByRole('tab', { name: 'Trajectory', exact: true }).click()
|
||||
const toolbar = page.getByRole('toolbar', { name: 'Trajectory toolbar' })
|
||||
await toolbar.waitFor({ timeout: 30_000 })
|
||||
const trajectory = await probeTab(page, 'Trajectory')
|
||||
// The toolbar must start within the bar's overhang, or the probe cannot fail.
|
||||
expect((await toolbar.boundingBox())!.y).toBeLessThanOrEqual(trajectory.button.bottom + 1)
|
||||
expect(trajectory.ownsBarOverhang).toBe(true)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
})
|
||||
@@ -374,7 +374,9 @@ describe('web e2e: macOS window drag coverage', () => {
|
||||
{
|
||||
row: 'conversation header',
|
||||
what: 'the blank run right of the view tabs, on the tab strip row',
|
||||
at: () => [tabs.x + tabs.width + 8, tabs.y + tabs.height / 2],
|
||||
// The last tab's press target overhangs the tablist by 10px and the
|
||||
// More launcher starts 20px past it; probe the run between them.
|
||||
at: () => [tabs.x + tabs.width + 15, tabs.y + tabs.height / 2],
|
||||
drag: true,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -223,6 +223,7 @@
|
||||
"tests/chat-long-interactions.e2e.ts",
|
||||
"tests/chat-continuous-conversation.e2e.ts",
|
||||
"tests/composer-tab-geometry.e2e.ts",
|
||||
"tests/conversation-view-tabs.e2e.ts",
|
||||
"tests/window-drag-coverage.e2e.ts",
|
||||
"tests/complex-history.perf.ts",
|
||||
"tests/pwsh-terminal.e2e.ts",
|
||||
|
||||
@@ -215,12 +215,20 @@
|
||||
min-height: 25px;
|
||||
}
|
||||
|
||||
/* The 16px text line retains 9px below it. The active bar reaches 1px past
|
||||
the tab box to sit over the header rule. */
|
||||
/* The 16px text line retains 9px below it. The press target extends 10px
|
||||
above the text into the strip's top margin and 10px to each side, matching
|
||||
the inline padding of the Sidebar tab chips (ui-dockkit `.tab`); negative
|
||||
margins keep the layout box at its 25px row and text width. The active bar
|
||||
spans the text and reaches 1px past the tab box to sit over the header
|
||||
rule. */
|
||||
.tab {
|
||||
--dsh-tab-hit-inline: 10px;
|
||||
|
||||
position: relative;
|
||||
min-height: 25px;
|
||||
padding: 0 0 9px;
|
||||
box-sizing: border-box;
|
||||
min-height: 35px;
|
||||
margin: -10px calc(-1 * var(--dsh-tab-hit-inline)) 0;
|
||||
padding: 10px var(--dsh-tab-hit-inline) 9px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 13px;
|
||||
@@ -233,9 +241,9 @@
|
||||
.tab::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
right: var(--dsh-tab-hit-inline);
|
||||
bottom: -1px;
|
||||
left: 0;
|
||||
left: var(--dsh-tab-hit-inline);
|
||||
height: 2px;
|
||||
border-radius: 2px;
|
||||
background: transparent;
|
||||
|
||||
@@ -8,8 +8,10 @@ describe('conversation header geometry', () => {
|
||||
it('keeps the single-line header at the shared 76px height', () => {
|
||||
expect(css.match(/\.header\s*\{([^}]*)\}/)?.[1]).toContain('min-height: 76px')
|
||||
expect(css.match(/\.viewTabs\s*\{([^}]*)\}/)?.[1]).toContain('min-height: 25px')
|
||||
expect(css.match(/\.tab\s*\{([^}]*)\}/)?.[1]).toContain('min-height: 25px')
|
||||
expect(css.match(/\.tab\s*\{([^}]*)\}/)?.[1]).toContain('padding: 0 0 9px')
|
||||
// The tab's 35px press target sits 10px above its 25px row through a negative top margin.
|
||||
expect(css.match(/\.tab\s*\{([^}]*)\}/)?.[1]).toContain('min-height: 35px')
|
||||
expect(css.match(/\.tab\s*\{([^}]*)\}/)?.[1]).toContain('margin: -10px calc(-1 * var(--dsh-tab-hit-inline)) 0')
|
||||
expect(css.match(/\.tab\s*\{([^}]*)\}/)?.[1]).toContain('padding: 10px var(--dsh-tab-hit-inline) 9px')
|
||||
})
|
||||
|
||||
it('uses 32px between view labels without changing the action gap', () => {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
/* Full-bleed, fixed-height host for the trajectory ledger. */
|
||||
/* Full-bleed, fixed-height host for the trajectory ledger. Isolation keeps the
|
||||
sticky toolbar's z-index inside this view, so the conversation tab row
|
||||
stacked above the view still paints its active bar over the view's top
|
||||
edge. */
|
||||
.root {
|
||||
--dsh-trajectory-toolbar-height: 32px;
|
||||
|
||||
isolation: isolate;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
"apps/web/tests/chat-long-interactions.e2e.ts",
|
||||
"apps/web/tests/chat-continuous-conversation.e2e.ts",
|
||||
"apps/web/tests/composer-tab-geometry.e2e.ts",
|
||||
"apps/web/tests/conversation-view-tabs.e2e.ts",
|
||||
"apps/web/tests/composer-shortcuts.e2e.ts",
|
||||
"apps/web/tests/window-drag-coverage.e2e.ts",
|
||||
"apps/web/tests/complex-history.perf.ts",
|
||||
|
||||
Reference in new issue
Block a user