Procházet zdrojové kódy

test(web): sample queue alignment in one layout

_Kerman před 1 měsícem
rodič
revize
795a9cc226

+ 2 - 2
.agents/notes/implemented/architecture/2026-09-07-sidebar-responsive-tab-info.i18n.yaml

@@ -2,5 +2,5 @@
 # side as of the last confirmed-consistent state. Both languages carry equal authority;
 # after editing either side, bring the other along and re-record with:
 #   pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-07-sidebar-responsive-tab-info.md
-2026-09-07-sidebar-responsive-tab-info.md: ade20148cccd2233224417f762e65492828943bb
-2026-09-07-sidebar-responsive-tab-info.zh.md: 0903e4ff06ca187fcc1fd0e9d8de63f70d5cc427
+2026-09-07-sidebar-responsive-tab-info.md: a7a646d1d7525b305fbeade98e649a3345d97420
+2026-09-07-sidebar-responsive-tab-info.zh.md: 9366861804b6f46980e1f08b028c4fa805f7fa7d

+ 2 - 0
.agents/notes/implemented/architecture/2026-09-07-sidebar-responsive-tab-info.md

@@ -28,4 +28,6 @@ This decision supersedes the flat owner-props choice in [tab types and navigatio
 
 ## Consequences
 
+Browser comparisons of related panel rectangles and CSS insets capture all values in one page execution. Responsive grid updates can occur between browser round trips, so separately sampled rectangles do not establish alignment even when each sample is accurate.
+
 Tab extensions use a framework-injected reader and keep their own store actions separate from `tab.actions`. Layout, seat and docking tests cover width concessions, explicit reopening, body/title visibility, tab lifetimes, horizontal drop zones and divider limits; browser tests exercise the assembled application. Compact mobile controls and layout persistence remain outside this decision.

+ 2 - 0
.agents/notes/implemented/architecture/2026-09-07-sidebar-responsive-tab-info.zh.md

@@ -28,4 +28,6 @@ Slot 框架注入一个 `useTabInfo()`,返回嵌套的 `sidebar`、`panel` 与
 
 ## 后果
 
+浏览器比较相关面板矩形与 CSS 内边距时,会在一次页面执行中获取全部值。响应式网格可能在浏览器往返调用之间更新,因此分次采样的矩形即使各自准确,也不能用于判断对齐。
+
 标签扩展使用框架注入的读取接口,自身 store actions 与 `tab.actions` 保持分离。布局、seat 与停靠测试覆盖列宽让步、显式重开、正文与标题可见性、标签生命周期、水平放置区与分割比例;浏览器测试覆盖组装后的应用。紧凑移动端控件与布局持久化不属于本决策。

+ 19 - 10
apps/web/tests/queue-actions.e2e.ts

@@ -147,8 +147,22 @@ describe('web e2e: queue row actions', () => {
     ).toBe(2)
 
     await page.setViewportSize({ width: 640, height: 1000 })
-    const queueBox = await page.locator('[data-queue-dock]').boundingBox()
-    const composerBox = await page.locator('[data-composer-card]').boundingBox()
+    // Compare one layout: viewport changes can move the grid between browser round trips.
+    const { queueBox, composerBox, dockInset } = await page.evaluate(() => {
+      const queue = document.querySelector('[data-queue-dock]')
+      const composer = document.querySelector('[data-composer-card]')
+      const box = (element: Element | null) => {
+        const rect = element?.getBoundingClientRect()
+        return rect === undefined ? null : { x: rect.x, width: rect.width }
+      }
+      return {
+        queueBox: box(queue),
+        composerBox: box(composer),
+        dockInset: composer === null ? null : Number.parseFloat(
+          getComputedStyle(composer).getPropertyValue('--dsh-composer-dock-inset'),
+        ),
+      }
+    })
     expect(queueBox).not.toBeNull()
     expect(composerBox).not.toBeNull()
     expect(queueBox!.x).toBeGreaterThanOrEqual(composerBox!.x)
@@ -156,14 +170,9 @@ describe('web e2e: queue row actions', () => {
       .toBeLessThanOrEqual(composerBox!.x + composerBox!.width)
     const queueLeftInset = queueBox!.x - composerBox!.x
     const queueRightInset = composerBox!.x + composerBox!.width - queueBox!.x - queueBox!.width
-    const composerMetrics = await page.locator('[data-composer-card]').evaluate((element) => {
-      const style = getComputedStyle(element)
-      return {
-        dockInset: Number.parseFloat(style.getPropertyValue('--dsh-composer-dock-inset')),
-      }
-    })
-    expect(queueLeftInset).toBeCloseTo(composerMetrics.dockInset, 1)
-    expect(queueRightInset).toBeCloseTo(composerMetrics.dockInset, 1)
+    expect(dockInset).not.toBeNull()
+    expect(queueLeftInset).toBeCloseTo(dockInset!, 1)
+    expect(queueRightInset).toBeCloseTo(dockInset!, 1)
     await page.setViewportSize({ width: 1680, height: 1000 })
 
     const editRow = page.locator('[data-queue-dock] li', { hasText: EDIT })