test(web): expect the fullscreen sidebar 1px past the left edge
Co-authored-by: std4453 <[email protected]>
This commit is contained in:
1 parent
48f553578e
commit
fa0b1522cb
4 files changed
+29
-19
No files matched your search
@@ -10,7 +10,7 @@ import {
|
||||
fixtureUserPrompts, launchWebScaffold, seedSession, watchConsole, webSnapshotMode,
|
||||
type WebScaffold,
|
||||
} from './scaffold.ts'
|
||||
import { connectFreshWorkspace, newEnglishPage, saveFailureShot } from './support.ts'
|
||||
import { connectFreshWorkspace, fullscreenBox, newEnglishPage, saveFailureShot } from './support.ts'
|
||||
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/details-session-lifecycle', import.meta.url))
|
||||
const HANDLES_EXPECTED = join(SNAPSHOT_DIR, 'handles.expected.md')
|
||||
@@ -110,8 +110,8 @@ async function sidebarSnapshot(page: Page) {
|
||||
mode: panel.getAttribute('data-sidebar-right-panel'),
|
||||
panelContentWidth: expanded ? Math.round(Number.parseFloat(style.width)) : 0,
|
||||
panelOuterWidth: expanded ? Math.round(rect.width) : 0,
|
||||
coversViewport: expanded && rect.x === 0 && rect.y === 0
|
||||
&& Math.round(rect.width) === window.innerWidth && Math.round(rect.height) === window.innerHeight,
|
||||
coversViewport: expanded && rect.x === -1 && rect.y === 0
|
||||
&& Math.round(rect.width) === window.innerWidth + 1 && Math.round(rect.height) === window.innerHeight,
|
||||
resizeHandleWidth: handle === null ? 0 : Math.round(handle.getBoundingClientRect().width),
|
||||
expandedDirectories: [...panel.querySelectorAll('[data-files-entry="directory"] button[aria-expanded="true"]')]
|
||||
.map(button => button.textContent?.trim()),
|
||||
@@ -195,7 +195,7 @@ describe.skipIf(MODE === 'record')('web e2e: details panel follows the current S
|
||||
await expect.poll(() => blankColumn.locator('[data-dockkit-host="dock"]:not([hidden])').evaluate(element => getComputedStyle(element).transform))
|
||||
.toBe('none')
|
||||
await expect.poll(() => blankColumn.locator('[data-sidebar-right-panel]').boundingBox())
|
||||
.toEqual({ x: 0, y: 0, width: 767, height: blankViewport.height })
|
||||
.toEqual(fullscreenBox({ width: 767, height: blankViewport.height }))
|
||||
// A preview the files page opened starts with its tree hidden; shown, the tree fills the viewport.
|
||||
const treeToggle = blankColumn.locator('[data-files-navigator-toggle]')
|
||||
await expect.poll(() => treeToggle.getAttribute('aria-expanded')).toBe('false')
|
||||
@@ -360,7 +360,7 @@ describe.skipIf(MODE === 'record')('web e2e: details panel follows the current S
|
||||
await checkpoint('A normal: two panes')
|
||||
|
||||
await column.locator('[data-sidebar-right-mode="fullscreen"]').click()
|
||||
await expect.poll(() => panel.boundingBox()).toEqual({ x: 0, y: 0, ...viewport })
|
||||
await expect.poll(() => panel.boundingBox()).toEqual(fullscreenBox(viewport))
|
||||
expect(await columns(page)).toEqual(normalColumns)
|
||||
expect(await sidebarSnapshot(page)).toMatchObject({ mode: 'fullscreen', resizeHandleWidth: 0, coversViewport: true })
|
||||
expect(await paneSnapshot(page)).toEqual(retainedA)
|
||||
@@ -395,7 +395,7 @@ describe.skipIf(MODE === 'record')('web e2e: details panel follows the current S
|
||||
expect(await panel.getAttribute('data-sidebar-right-panel')).toBe('fullscreen')
|
||||
expect(await paneSnapshot(page)).toEqual(retainedA)
|
||||
await open()
|
||||
await expect.poll(() => panel.boundingBox()).toEqual({ x: 0, y: 0, ...viewport })
|
||||
await expect.poll(() => panel.boundingBox()).toEqual(fullscreenBox(viewport))
|
||||
expect(await paneSnapshot(page)).toEqual(retainedA)
|
||||
await checkpoint('A restored: manual fullscreen, tabs, and panes')
|
||||
await column.locator('[data-sidebar-right-mode="push"]').click()
|
||||
@@ -433,7 +433,7 @@ describe.skipIf(MODE === 'record')('web e2e: details panel follows the current S
|
||||
await page.locator('[data-sidebar-right-expand]').click()
|
||||
await expect.poll(() => columns(page)).toEqual([420, viewport.width - 420 - normalWidth, normalWidth])
|
||||
await page.setViewportSize({ width: 767, height: viewport.height })
|
||||
await expect.poll(() => panel.boundingBox()).toEqual({ x: 0, y: 0, width: 767, height: viewport.height })
|
||||
await expect.poll(() => panel.boundingBox()).toEqual(fullscreenBox({ width: 767, height: viewport.height }))
|
||||
await expect.poll(() => columns(page)).toEqual([0, 767, 0])
|
||||
expect(await sidebarSnapshot(page)).toMatchObject({ mode: 'fullscreen', resizeHandleWidth: 0, coversViewport: true })
|
||||
await checkpoint('A automatic fullscreen at 767px')
|
||||
|
||||
@@ -26,7 +26,7 @@ import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
||||
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import { acknowledgeReloadConnectionLoss, launchWebScaffold, watchConsole, type WebScaffold } from './scaffold.ts'
|
||||
import {
|
||||
connectFreshWorkspace, newEnglishPage, saveFailureShot, ZH_BROWSER_LOCALE,
|
||||
connectFreshWorkspace, fullscreenBox, newEnglishPage, saveFailureShot, ZH_BROWSER_LOCALE,
|
||||
} from './support.ts'
|
||||
|
||||
/** The produced file the seeded turn writes, and what the preview should show. */
|
||||
@@ -524,7 +524,7 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
expect(await width(column)).toBe(trackWidth)
|
||||
const viewport = page.viewportSize()
|
||||
if (viewport === null) throw new Error('expected a fixed viewport')
|
||||
await expect.poll(async () => await panel.boundingBox()).toEqual({ x: 0, y: 0, ...viewport })
|
||||
await expect.poll(async () => await panel.boundingBox()).toEqual(fullscreenBox(viewport))
|
||||
expect(await expandOf(page).count()).toBe(0)
|
||||
expect(await frame.locator('[data-side="rightbar"]').count()).toBe(0)
|
||||
await shot(page, '03-fullscreen-panel')
|
||||
@@ -558,7 +558,7 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
await frame.evaluate(async (node) => { await Promise.allSettled(node.getAnimations().map(animation => animation.finished)) })
|
||||
const normalColumns = (await geometry()).columns
|
||||
await column.locator('[data-sidebar-right-mode="fullscreen"]').click()
|
||||
await expect.poll(() => panel.boundingBox()).toEqual({ x: 0, y: 0, ...viewport })
|
||||
await expect.poll(() => panel.boundingBox()).toEqual(fullscreenBox(viewport))
|
||||
await column.locator('[data-sidebar-right-toggle]').click()
|
||||
await Promise.all([
|
||||
panel.evaluate(async (node) => {
|
||||
@@ -586,7 +586,7 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
|
||||
await held.evaluate((state) => { (state.animation as Animation).finish() })
|
||||
await expect.poll(() => frame.getAttribute('data-rightbar-fullscreen')).toBe('true')
|
||||
expect(await panel.boundingBox()).toEqual({ x: 0, y: 0, ...viewport })
|
||||
expect(await panel.boundingBox()).toEqual(fullscreenBox(viewport))
|
||||
expect(await geometry()).toEqual({ columns: normalColumns, transition: 'none', handles: ['none'], animatingGrid: false })
|
||||
|
||||
const exit = await holdPanelSlide(panel)
|
||||
@@ -621,7 +621,7 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
await expect.poll(() => frame.getAttribute('data-rightbar-fullscreen')).toBeNull()
|
||||
await expandOf(page).click()
|
||||
await expect.poll(() => frame.getAttribute('data-rightbar-fullscreen')).toBe('true')
|
||||
expect(await panel.boundingBox()).toEqual({ x: 0, y: 0, ...viewport })
|
||||
expect(await panel.boundingBox()).toEqual(fullscreenBox(viewport))
|
||||
expect((await geometry()).columns).toBe(normalColumns)
|
||||
expect((await geometry()).animatingGrid).toBe(false)
|
||||
} finally {
|
||||
@@ -733,7 +733,7 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
|
||||
await page.setViewportSize({ width: 767, height: viewport.height })
|
||||
await expect.poll(async () => await panel.getAttribute('data-sidebar-right-panel')).toBe('fullscreen')
|
||||
await expect.poll(async () => await width(panel)).toBe(767)
|
||||
await expect.poll(async () => await width(panel)).toBe(768)
|
||||
await expect.poll(() => frame.getAttribute('data-rightbar-fullscreen')).toBe('true')
|
||||
expect(await expandOf(page).count()).toBe(0)
|
||||
expect(await frame.locator('[data-side="rightbar"]').count()).toBe(0)
|
||||
|
||||
@@ -468,3 +468,13 @@ export async function openSettings(page: Page, locale: 'en' | 'zh' | 'ja'): Prom
|
||||
await trigger.click()
|
||||
await page.getByRole('menuitem', { name: labels[locale][1], exact: true }).click()
|
||||
}
|
||||
|
||||
/**
|
||||
* The right Sidebar's fullscreen panel box: 1px wider than the viewport, so the
|
||||
* first column's divider sits past the window's left edge where the frame clips it.
|
||||
* @param viewport - the page viewport size.
|
||||
* @returns the panel's expected bounding box.
|
||||
*/
|
||||
export function fullscreenBox(viewport: { width: number; height: number }): { x: number; y: number; width: number; height: number } {
|
||||
return { x: -1, y: 0, width: viewport.width + 1, height: viewport.height }
|
||||
}
|
||||
@@ -64,8 +64,8 @@
|
||||
"columnTransition": "none",
|
||||
"expanded": true,
|
||||
"mode": "fullscreen",
|
||||
"panelContentWidth": 1680,
|
||||
"panelOuterWidth": 1680,
|
||||
"panelContentWidth": 1681,
|
||||
"panelOuterWidth": 1681,
|
||||
"coversViewport": true,
|
||||
"resizeHandleWidth": 0,
|
||||
"expandedDirectories": [],
|
||||
@@ -197,8 +197,8 @@
|
||||
"columnTransition": "none",
|
||||
"expanded": true,
|
||||
"mode": "fullscreen",
|
||||
"panelContentWidth": 1680,
|
||||
"panelOuterWidth": 1680,
|
||||
"panelContentWidth": 1681,
|
||||
"panelOuterWidth": 1681,
|
||||
"coversViewport": true,
|
||||
"resizeHandleWidth": 0,
|
||||
"expandedDirectories": [],
|
||||
@@ -424,8 +424,8 @@
|
||||
"columnTransition": "none",
|
||||
"expanded": true,
|
||||
"mode": "fullscreen",
|
||||
"panelContentWidth": 767,
|
||||
"panelOuterWidth": 767,
|
||||
"panelContentWidth": 768,
|
||||
"panelOuterWidth": 768,
|
||||
"coversViewport": true,
|
||||
"resizeHandleWidth": 0,
|
||||
"expandedDirectories": [],
|
||||
|
||||
Reference in new issue
Block a user