diff --git a/.scratch/annotation-workspace-layout/README.md b/.scratch/annotation-workspace-layout/README.md index 879026f5..cab2e646 100644 --- a/.scratch/annotation-workspace-layout/README.md +++ b/.scratch/annotation-workspace-layout/README.md @@ -27,5 +27,5 @@ - 全部 30 条用户故事和 L01–L16 均有负责票,详细映射保留在拆分记录;共 60 项独立验收检查。 - 产品入口、快捷键、草稿、撤销、真实保存及连续领取沿用现有契约。新旧布局共用编辑逻辑,切换不能丢状态或重复领任务。 -- 本地原版恢复标签为 `codex/annotation-keyboard-baseline-20260918`,指向 `54a35afad95d77b1f23c955f9c4671cae83a664d`;完整 bundle 已验证。运行中回退由 01 实现,不能把代码备份当成已实现的布局切换。 -- 发布只发生在本地 Markdown 任务目录;没有启动实现、修改产品代码、推送远端、合并或部署。 +- 本地原版恢复标签为 `codex/annotation-keyboard-baseline-20260918`,指向 `54a35afad95d77b1f23c955f9c4671cae83a664d`;完整 bundle 已验证。运行中布局回退已由 01 实现并验收;代码备份与页面内布局切换的恢复范围不同。 +- 任务发布记录保留在本地 Markdown 目录。01–07 已实施并独立验收,08 正在整体验收;本轮没有推送远端、合并或部署。 diff --git a/.scratch/annotation-workspace-layout/issues/01-focused-view-and-legacy-switch.md b/.scratch/annotation-workspace-layout/issues/01-focused-view-and-legacy-switch.md index 004d43b7..3a90c7c0 100644 --- a/.scratch/annotation-workspace-layout/issues/01-focused-view-and-legacy-switch.md +++ b/.scratch/annotation-workspace-layout/issues/01-focused-view-and-legacy-switch.md @@ -32,4 +32,6 @@ Parent: [专注工作页布局规格](../spec.md) ## Answer -Implemented in `a5753731`, with continuous-intent browser evidence in `6acc5803`. Independent spec/quality review and scoped re-review approved. Real browser/public API proves media/frame, two slice drafts, save delay, undo/redo, preference isolation and continuous/stop intent preservation. Typecheck, web build and44 focused tests pass. Source tag/bundle independently verified. See [Decisions-so-far](../map.md#decisions-so-far) and [behavior guide](../../../docs/annotation-workspace-layout.md). +已在 `a5753731` 实现专注外壳与原布局切换,`6acc5803` 补充连续工作选择的浏览器证据,独立审查与复审均通过。真实浏览器和 API 验证了播放帧、双片草稿、延迟保存、撤销/重做、账号偏好隔离,以及连续工作和停止选择的保留。类型检查、Web 构建和 44 项定向测试通过;源码标签与 bundle 已独立核验。 + +参见[设计记录](../map.md#decisions-so-far)与[操作说明](../../../docs/annotation-workspace-layout.md)。 diff --git a/.scratch/annotation-workspace-layout/issues/02-single-screen-slicing.md b/.scratch/annotation-workspace-layout/issues/02-single-screen-slicing.md index eb9fc4d2..78a97aaa 100644 --- a/.scratch/annotation-workspace-layout/issues/02-single-screen-slicing.md +++ b/.scratch/annotation-workspace-layout/issues/02-single-screen-slicing.md @@ -32,4 +32,6 @@ Parent: [专注工作页布局规格](../spec.md) ## Answer -Implemented `a3c780e8`, independently approved. Five CSS viewport checks pass; minimum actual effective picture410.5×334 per camera. Real generation completed4slices/412s, authoritativeversion5. Browser keys/media/history/name/confirmation and reviewer error-state hit testing pass;52focusedtests,typecheck,build pass. Minor test improvement (repeat error-state hit testing in durable runner) carried into final combined acceptance. See [Decisions-so-far](../map.md#decisions-so-far) and [guide](../../../docs/annotation-workspace-layout.md). +已在 `a3c780e8` 实现切片阶段固定布局,独立审查通过。五档内容区通过验收,最小每路有效画面约 410.5×334;真实生成完成 4 片、覆盖 412 秒,服务端版本为 5。快捷键、媒体同步、历史、字典命名和二次确认均有浏览器证据,52 项定向测试、类型检查与构建通过。审查时人工检查的错误控件命中测试由 08 补入长期脚本。 + +参见[设计记录](../map.md#decisions-so-far)与[操作说明](../../../docs/annotation-workspace-layout.md)。 diff --git a/.scratch/annotation-workspace-layout/issues/03-fixed-description-editing.md b/.scratch/annotation-workspace-layout/issues/03-fixed-description-editing.md index ec12430c..31874217 100644 --- a/.scratch/annotation-workspace-layout/issues/03-fixed-description-editing.md +++ b/.scratch/annotation-workspace-layout/issues/03-fixed-description-editing.md @@ -30,4 +30,6 @@ Parent: [专注工作页布局规格](../spec.md) ## Answer -Implemented `e462437a`, independently approved. Fixed description editor/save/cancel/history/submit uses same media layout; fiveviewports pass410.5×334minimum. Actualsave/409/history/drafts/cancel API checks pass; isolatedtask senttoquality_reviewv6.56focusedtests/typecheck/build pass, prior01/02browser regressions pass. Minor duplicate CSS declarations noted for final cleanup. See [Decisions-so-far](../map.md#decisions-so-far) and [guide](../../../docs/annotation-workspace-layout.md). +已在 `e462437a` 实现固定描述编辑、保存、取消、历史与送检,独立审查通过。五档内容区均满足每路至少 410.5×334 的实测画面。真实保存、409 冲突、草稿、取消及历史均通过 API 回读;隔离任务送检后进入 quality_review,版本为 6。56 项定向测试、类型检查、构建及 01/02 浏览器回归通过;重复动作区 CSS 留待 08 局部整理。 + +参见[设计记录](../map.md#decisions-so-far)与[操作说明](../../../docs/annotation-workspace-layout.md)。 diff --git a/.scratch/annotation-workspace-layout/issues/04-paged-selection-navigation.md b/.scratch/annotation-workspace-layout/issues/04-paged-selection-navigation.md index 4fd63506..7234c46b 100644 --- a/.scratch/annotation-workspace-layout/issues/04-paged-selection-navigation.md +++ b/.scratch/annotation-workspace-layout/issues/04-paged-selection-navigation.md @@ -28,4 +28,6 @@ Parent: [专注工作页布局规格](../spec.md) ## Answer -Implemented `94b238d5`, review fixes `e95adca8`, independent re-review approved. Real13slice/13description fixtures cover paging/search/exactordinal/tinyitems, drafts, emptylastpage, savedhistory/APIreadback and crossslice closededitorredo. Frozen pageedgepointer mapping passesbidirectional/samecoordinate tests inbothphases withsharedframeAPIreadback. Fiveviewports,shellregression,56focusedtests,typecheck/buildpass. See [Decisions-so-far](../map.md#decisions-so-far) and [guide](../../../docs/annotation-workspace-layout.md). +已在 `94b238d5` 实现分页定位,`e95adca8` 完成审查修复,独立复审通过。13 个切片、13 条描述覆盖分页、查找、序号直达、极小区间、草稿、尾页删除和跨片重做。页尾指针拖动验证了双向移动及同一横坐标不重复移动,描述边界以 API 回读核对。五档尺寸、外壳回归、56 项定向测试、类型检查与构建通过。 + +参见[设计记录](../map.md#decisions-so-far)与[操作说明](../../../docs/annotation-workspace-layout.md)。 diff --git a/.scratch/annotation-workspace-layout/issues/05-inline-dictionaries-and-long-text.md b/.scratch/annotation-workspace-layout/issues/05-inline-dictionaries-and-long-text.md index 799e40e0..d691c4f0 100644 --- a/.scratch/annotation-workspace-layout/issues/05-inline-dictionaries-and-long-text.md +++ b/.scratch/annotation-workspace-layout/issues/05-inline-dictionaries-and-long-text.md @@ -29,4 +29,6 @@ Parent: [专注工作页布局规格](../spec.md) ## Answer -Implemented`1de1d85b`, focusfix`6c76e5d2`, independentre-reviewapproved. Inlinebothdictionaries page/search/keyboard/oneEsc, visiblelongoption andfixedcontrols pass5sizes. Expandedtextarea remainsmounted; longtextrealAPI save/undo/redo andnativecut/undo ownership checks pass. BothdictTab/outsideclick dismissal+Space preserve draft/focus withzeroPOST.47focusedtests/type/buildpass; focusedfix typecheckpass. NativeOS ChineseIME notphysicallytested; syntheticcomposition routing evidence isexplicitlyseparate. See [Decisions-so-far](../map.md#decisions-so-far) and [guide](../../../docs/annotation-workspace-layout.md). +已在 `1de1d85b` 实现固定字典与长文本,`6c76e5d2` 修复焦点返回,独立复审通过。两类字典的搜索、分页、选词、一次 Esc 返回及长词条可读性通过五档尺寸验证;展开编辑保留同一文本框,真实保存/撤销/重做通过 API 回读。Tab 或外部点击后 Esc 与 Space 的焦点归属通过且没有写入。47 项定向测试、类型检查和构建通过。原生剪切/撤销已测,系统中文输入法未实测,组合事件检查单独标明。 + +参见[设计记录](../map.md#decisions-so-far)与[操作说明](../../../docs/annotation-workspace-layout.md)。 diff --git a/.scratch/annotation-workspace-layout/issues/06-camera-inspection-and-aspect-fit.md b/.scratch/annotation-workspace-layout/issues/06-camera-inspection-and-aspect-fit.md index 17593139..a5c85f5f 100644 --- a/.scratch/annotation-workspace-layout/issues/06-camera-inspection-and-aspect-fit.md +++ b/.scratch/annotation-workspace-layout/issues/06-camera-inspection-and-aspect-fit.md @@ -29,4 +29,6 @@ Parent: [专注工作页布局规格](../spec.md) ## Answer -Implemented `ee3d6b16`, reviewed fixes `af7df833`; independent re-review approved. Minimum real dual410.54×334 each and single531×432, reservedprogress space with0occludedpicturepixels. Fiveviewports, realframes/drafts/history/pointermapping and original hide-left/right recovery atframe6 pass, preservingoriginalprefs/nodes/sync. Synthetic16:9/9:16fit explicitlyseparate.79focusedtests/typecheck/build/browserAPIpass withzero fixturewrites. See [Decisions-so-far](../map.md#decisions-so-far) and [guide](../../../docs/annotation-workspace-layout.md). +已在 `ee3d6b16` 实现单路检查,`af7df833` 完成审查修复,独立复审通过。最小双路有效画面每路约 410.54×334,单路约 531×432,进度条不覆盖画面。五档尺寸、帧定位、草稿、历史、指针映射和原布局左右显示偏好恢复通过,未写入 fixture。16:9 / 9:16 为合成比例案例,单独标明。79 项定向测试、类型检查、构建与浏览器/API 检查通过。 + +参见[设计记录](../map.md#decisions-so-far)与[操作说明](../../../docs/annotation-workspace-layout.md)。 diff --git a/.scratch/annotation-workspace-layout/spec.md b/.scratch/annotation-workspace-layout/spec.md index 1b390111..42d8a995 100644 --- a/.scratch/annotation-workspace-layout/spec.md +++ b/.scratch/annotation-workspace-layout/spec.md @@ -2,7 +2,7 @@ Status: ready-for-agent -设计确认:2026-09-18,四轮边界确认及交互示意均已接受。本文将已确认内容整理为书面规格;尚未拆分实施票、修改产品代码或推送本轮文档。 +设计确认:2026-09-18,四轮边界确认及交互示意均已接受。本文记录已确认的范围;实施票 01–07 已完成并独立审查,08 正在完成整体验收与说明书,最终审核尚未结束。 ## Problem Statement @@ -138,7 +138,7 @@ The existing annotation browser fixtures and authoritative API recovery scenario Use local isolated tasks on the existing 5173/3001/27018 verification stack. Company cluster or BOS writes are not part of this specification. Supplement browser checks with existing API conflict/idempotency coverage only where this change affects that behavior; do not create a new test-only backend or duplicate all prior suites. -The preview passed 27 local layout/state checks and screenshot inspection. That validates the design artifact only. The production acceptance cases above remain to be executed after implementation. +The preview passed 27 local layout/state checks and screenshot inspection. That validates the design artifact only. Implementation acceptance evidence is now collected in the per-task reports and the final acceptance report; preview checks remain design-only evidence. ## Out of Scope diff --git a/docs/annotation-workspace-layout.md b/docs/annotation-workspace-layout.md index 31eafdd8..26c38610 100644 --- a/docs/annotation-workspace-layout.md +++ b/docs/annotation-workspace-layout.md @@ -1,43 +1,63 @@ -# 标注工作页的专注视图与原布局 +# 标注工作页操作说明 -从任务池选择项目并点击“开始工作”,仍使用现有的领取与继续任务链路,在当前标签页进入工作页。没有布局偏好的账号默认进入专注视图,收起平台导航和状态栏;“返回任务池”保留原有未保存修改确认。 +选择项目后点击“开始工作”,即可在当前标签页连续标注。系统先续做本人未完成任务,没有时才在有权限的项目与供应商范围内随机领取;领取前不能挑选视频。 -工作页顶部的“切回原布局”恢复现有工作页及平台导航;“进入专注视图”再次收起导航。入口随编辑页面滚动保持可达。任务池原入口仍保持原有呈现。 +## 进入、停止与退出 -布局选择只属于当前账号和当前浏览器,不是项目设置,也不会写入服务端。浏览器禁用本地存储时仍可切换,但无法保证刷新后记住选择。刷新、关闭或重新打开页面后仍需显式“继续工作”,仅恢复后端保存内容,不自动领取任务,也不恢复未保存草稿和撤销历史。 +首次进入默认使用专注视图:平台导航收起,左侧是同步双视频、播放控制和时间轴,右侧是当前切片或动作描述编辑区。页面顶部始终保留“切回原布局”和“返回任务池”。 -运行中切换布局只改变外壳。任务、阶段、播放位置、选中切片、各片草稿和撤销/重做共用原编辑会话;切换不会保存、释放或重新领取任务。正在处理的保存仍归属原会话,原有处理中限制继续生效。 +连续工作中,当前任务真实送检成功后会接续下一条。准备结束时点击“完成当前任务后停止”:仍可完成手中任务,但不会再领取下一条,也不会释放已经领取的任务。需要接着做时点击“恢复连续工作”。任务池为空时连续工作暂停,不会反复领取。 -任务 02 已为切片阶段提供固定布局:左侧为双画面、播放/逐帧控制与时间轴,右侧为当前切片命名、舍弃入口和确认区。1280×640 CSS 像素及以上内容区无需页面滚动;590×480 的实测双视频在最小内容区各约 410.5×334,并随窗口扩大。双画面均等比完整显示。工作状态、较长说明和返工原因可从固定入口展开。 +“返回任务池”会执行原有离开保护。若有未保存草稿,选择继续编辑可返回当前工作;确认离开会丢弃页面中未保存的编辑。刷新、关闭标签页或重新打开后,必须显式点击“继续工作”,只恢复服务端已经保存的内容,不能恢复浏览器草稿与撤销历史。 -原 Space、C、逐帧、B/V、字典命名与撤销快捷键继续使用同一编辑器;右下角另提供撤销/重做按钮。确认全部切片仍需再次确认,处理请求被接收不代表生成完成,服务端完成生成后才进入描述编辑。原布局继续保留原来的滚动方式。 +同一账号、同一项目只能有一个活动工作页。第二个标签页提示已有活动页时,返回原页继续;原页退出或关闭后再恢复。不要通过反复开页重复领取。 -任务 03 将动作描述接入相同骨架:右侧固定文本、精确边界、保存和取消,底部固定撤销/重做与送检入口。N 定起点,再按 N / Enter 定结束点后仍聚焦编辑区;Enter 进入文本,Ctrl / ⌘ + Enter 优先保存当前描述。已有描述可在专注视图点击“取消编辑”,丢弃当前未保存修改;保存、撤销、重做仍走现有版本与归属校验。跨片草稿继续保留,提交时必须先处理草稿;真实送检仍等待审核数据准备完成。 +## 切片:确认名称后生成 -任务 04 为专注视图中的切片和描述时间轴提供每页最多 4 条的连续时间区间。页码、全局条目范围、前后页、查找及当前项定位始终可达;输入名称或描述文本查找下一匹配项,输入 `#13` 可直接打开第 13 条,即使区间只有一帧也无需点击狭小色块。搜索不筛除数据,Ctrl / ⌘ + 左右仍选择全局相邻切片;B/V、草稿恢复与撤销/重做会显示目标所在页。翻页、查找和切换布局不会保存草稿。原布局继续显示完整时间轴。 +1. 观看两路视频,用播放、逐帧按钮或快捷键定位。按 `C` 或“在播放头分割切片”新增边界;切分点须位于片内,不能落在现有边界。 +2. 从项目切片字典选择名称。`F` / `D` 可打开字典,搜索、分页后用鼠标或方向键选择,`Enter` 填入,按一次 `Esc` 返回工作台。选择名称仅修改当前编辑,未确认前不会保存。 +3. 检查边界与名称,点击“确认全部切片”,再点击“确认生成”。系统处理完成后才进入描述阶段;收到处理中提示不代表已经生成完成。 -任务 05 将两类字典放入固定编辑区:搜索、每页 2 项、前后页和返回入口固定,长词条显示两行预览,悬停或辅助技术可读取完整词条,填入后可继续完整阅读。F / D 打开,方向键选择,Enter 填入,Esc 一次返回工作台;选择描述模板不会保存,可继续修改。长描述在同一个文本框内滚动,“展开描述编辑”暂时收起精确边界区域以增加文字空间,保存和取消始终在文本滚动区外;收起、切片导航与布局切换不保存草稿。原布局仍使用原有字典弹层。 +切片保持源视频有效帧范围的完整覆盖。删除切片会把范围并入相邻切片。需要舍弃时使用“舍弃片段”并填写原因;舍弃保留审核证据,不等于删除视频,也不移动相邻边界。 -任务 06 在专注视图的视频上方提供“放大左相机”“放大右相机”和“恢复双画面”。单路检查期间只改变呈现:两路视频节点保留,隐藏路继续同步;详细切片/描述时间轴临时收成画面之外的 Capture 进度条,把其余高度让给所选画面。切片阶段的当前播放头分割入口、播放与逐帧、当前编辑、保存、撤销/重做及阶段提交仍可达。恢复双画面或切回原布局保留播放帧、草稿、选择和历史。原布局继续使用原来的左右相机显示复选框并保留用户的显示选择;进入专注视图时则派生为双路有效可见,必要时由现有媒体传输重新接入被原布局隐藏的源并定位到当前帧,返回原布局后仍恢复原显示选择。 +## 描述:先保存,再送检 -真实 590×480 双视频在 1280×640 内容区的实测每路有效画面约 410.5×334,单路约 531×432;两种模式在五档内容区均随窗口扩大。16:9 与 9:16 的 12 秒、30fps 本地 testsrc2 文件只用于验证左右不同比例时的 `contain` 适配,不代表客户素材或真实工作流覆盖。窗口过小时暂停仍由后续任务交付;当前浏览器尺寸验证不代表已覆盖各种操作系统缩放设置。 +点击“新增动作描述”或按 `N` 标记起点;播放或逐帧定位后再按 `N` / `Enter` 确认结束点。进入文本框后填写描述,也可以从描述字典填入模板再修改。模板只是草稿,不会自动保存。 -## 源码恢复与业务数据恢复 +“确认保存描述”或 `Ctrl / ⌘ + Enter` 保存当前描述。“取消编辑”放弃当前未保存修改。切换切片可以保留各片草稿,但送检前必须处理所有未保存草稿。保存失败时先按提示核对版本、权限或网络,不要把仍显示的草稿当成已保存。 -原键盘工作流的源码恢复点为本地标签 `codex/annotation-keyboard-baseline-20260918`,指向提交 `54a35afad95d77b1f23c955f9c4671cae83a664d`。本地忽略目录中的完整备份为 `local-data/backups/annotation-keyboard-baseline-20260918.bundle`。任务 01 核验标签指向与 `git bundle verify` 均通过;备份包含完整历史。 +完成后点击“完成任务并提交质检”,检查切片、描述、留空和舍弃汇总,再点击“确认送检”。审核数据准备完成、任务进入待质检后才算送检成功。**送检成功不等于质检通过**;连续工作也不需要等质检员作出通过结论。 -工作中的“切回原布局”与 Git 源码恢复是两件事:前者保留当前编辑会话,后者恢复整版代码。Git 标签和 bundle 不恢复数据库、下载媒体、浏览器未保存草稿或撤销记录;业务数据需要独立备份与恢复。本次没有恢复源码、回滚业务数据、推送或部署。 +语义留空是合法的未描述范围,仍参与审核和媒体交付;“无效区间”是明确的语义判断;“舍弃切片”是不交付该切片并保留证据。这三种处理不能混用。删除动作描述会留下空白,不删除视频或合并相邻动作。 -本地浏览器回归脚本:`tests/browser/annotation-workspace-shell.mjs`。使用隔离本地项目和已有认证会话文件,覆盖导航回退、刷新偏好、实际媒体/帧与草稿保留、延迟保存 API 回读以及撤销/重做。传入第二个真实本地账号的会话文件可额外验证同一浏览器存储中的账号隔离。会话文件和原始测试证据仅存放在忽略的 `local-data/` 中。 +## 长列表、字典和长文本 -切片阶段的本地浏览器验收脚本为 `tests/browser/annotation-workspace-slice.mjs`,只允许本地隔离 fixture。`ANNOTATION_TASK_ID` 可选择仍处于切片阶段的隔离任务;默认运行几何与编辑检查,不保存草稿。`ANNOTATION_GENERATE=1` 才执行真实两步确认并等待生成,这会推进该 fixture 的阶段;不要为重跑检查而重置已完成任务。`ANNOTATION_VERIFY_GENERATED=1` 可只检查已生成的主 fixture 和公共 API 回读。原始截图、认证会话和日志仍仅存放在忽略目录。 +专注视图中的切片和描述时间轴每页最多显示 4 条。使用前后页、查找或“当前”定位;输入文字查找下一匹配项,输入 `#13` 可直接定位第 13 条。查找不会筛除数据。`Ctrl / ⌘ + 左右方向键` 仍按全部切片的时间顺序导航;撤销、重做与草稿恢复会显示目标所在页。 -描述阶段浏览器验收为 `tests/browser/annotation-workspace-annotation.mjs`:默认使用 annotate-primary 检查五档内容区、固定编辑、过期版本真实拒绝、保存/撤销/重做回读和草稿拦截。`ANNOTATION_SUBMIT=1` 仅允许 annotate-delayed 专用任务执行真实送检,推进后不应重跑或重置;`ANNOTATION_VERIFY_SUBMITTED=1` 配合该任务 ID 只回读已完成送检。shell 回归以 `ANNOTATION_SLICE_TASK_ID` 指定仍处于切片阶段的 pool fixture,默认 pool-01,避免误用已生成的 slice-primary。 +字典在右侧固定编辑区内打开,不挤压视频。每页 2 项,长词条可在内部阅读;返回编辑后可查看完整填入内容。文本输入、字典导航和中文组合输入拥有自己的按键,不应触发工作台操作。 -大量条目的浏览器验收为 `tests/browser/annotation-workspace-navigation.mjs`,使用独立的 many-annotate-04 与 many-slice-04 任务(后者传入 `NAVIGATION_PHASE=slice`)。两者均有 13 个切片,描述任务首片有 13 条描述。脚本检查五档尺寸、全局导航、草稿与布局切换、尾页删除、跨页历史、单帧描述查找及公共 API 回读;仅显式保存与历史恢复写入本地描述任务,不生成切片或送检。禁止通过重置已有任务重跑验收;任务 ID 可指定该命名前缀下的新增隔离任务。 +长描述可以在文本框内滚动。“展开描述编辑”暂时收起精确边界区域,让出更多文字空间;“收起描述编辑”恢复边界。保存与取消始终在文本滚动区外。展开、收起、翻页和切换布局都不会自动保存。 -分页边界拖动验收为 `tests/browser/annotation-workspace-boundaries.mjs`,默认检查切片,传入 `NAVIGATION_PHASE=annotate` 检查描述。它使用真实鼠标手势将页尾边界向两侧移动,并检查同一横坐标不会重复改变边界;描述模式通过现有编辑、确认结束点和保存建立相邻区间,再以公共 API 核对共享精确帧。历史验收还覆盖从另一切片重做已保存描述时,关闭编辑器并显示目标页。 +## 放大画面与快捷键 -字典与长文本验收为 `tests/browser/annotation-workspace-dictionaries.mjs`,使用 pool-01 与 annotate-primary。隔离项目需配置多页字典,以及“布局长名称验收”长名称与“布局长文本模板”长描述。脚本验证两类字典在五档内容区的固定入口、搜索分页、原布局回退、一次 Esc、原生剪切/撤销、草稿展开/收起/跨片保存及 API 撤销/重做回读。组合事件检查是浏览器派发的快捷键归属检查,不代表操作系统输入法验收;完整 OS 缩放与输入法矩阵仍需人工验证。 +默认完整、等比显示两路同步画面,不裁剪。点击“放大左相机”或“放大右相机”临时检查细节,详细时间轴会收成进度条,当前编辑、逐帧和保存仍可操作。点击“恢复双画面”回到详细时间轴,播放帧、草稿和选中项保持不变。 -单路检查与比例适配验收为 `tests/browser/annotation-workspace-camera-inspection.mjs`,使用 annotate-primary 与 pool-01 且不执行保存、生成、送检或领取。脚本以真实 590×480 双视频检查五档双路/单路有效画面、左右放大、播放逐帧、进度条指针、草稿与媒体节点、历史、布局回退和公共 API 版本不变;随后在独立无缓存浏览器上下文中仅把两路 `subject-content` 映射到忽略目录的 16:9 / 9:16 合成文件,验证完整等比显示。合成文件不参与真实帧/API 工作流结论。 +常用快捷键可从“快捷键帮助”查看:`Space` 播放/暂停,左右键逐帧,`B` 复查本片,`V` 返回工作点,`F` / `D` 打开字典。工作台内 `Ctrl / ⌘ + Z` 撤销、`Ctrl / ⌘ + Shift + Z` 重做;输入框内仍使用原生文本撤销。撤销/重做有一秒节流,只覆盖当前任务的当前编辑阶段;生成、重新切片、送检和换任务会截断历史。 + +## 小窗口、缩放和原布局 + +专注视图要求浏览器**内容区至少 1280×640 CSS 像素**。显示器标称分辨率不等于内容区:窗口边框、浏览器工具栏、系统缩放和浏览器缩放都会减少可用空间。 + +低于底线时,页面暂停播放与自动接续,保留当前任务、播放位置、草稿和历史。放大窗口或降低浏览器缩放后,必须点击“继续当前工作”;仅调整尺寸不会恢复工作,视频仍需手动播放。此前选择的“完成当前任务后停止”仍然有效。 + +已发出的保存、生成、送检或领取请求可能在暂停期间完成。系统会核对原请求,不能把暂停当作取消,也不会因窗口改变重复领取。提示结果未知时,使用“核对阶段结果”或“核对领取结果并开始连续工作”;领取核对沿用原请求编号。权限变化或活动页冲突须先处理,恢复窗口不会解除这些限制。 + +随时可点击“切回原布局”,返回旧版的滚动布局;“进入专注视图”再次收起导航。运行中切换保留任务、阶段、选中项、播放帧、各片草稿、撤销记录及连续工作选择,不会保存或重新领取。布局偏好按当前账号和当前浏览器保存,不会串到其他账号;浏览器禁止本地存储时,当前切换仍可用,但下次未必记住。 + +## 恢复范围与验收边界 + +工作中的布局切换是当前页面内的回退。源码恢复则使用本地标签 `codex/annotation-keyboard-baseline-20260918`,指向 `54a35afad95d77b1f23c955f9c4671cae83a664d`;完整备份位于忽略目录 `local-data/backups/annotation-keyboard-baseline-20260918.bundle`。标签指向及 bundle 完整历史已再次核验。恢复前应由维护人员保留当前改动并另建检出进行核对。 + +Git 标签和 bundle 只恢复代码,不能恢复数据库、下载的视频、浏览器未保存草稿或撤销记录。这些数据须分别备份与恢复。本次没有执行代码回退、数据库回滚、远端推送或公司环境部署。 + +本地验收包括真实 590×480 双视频、五档 CSS 内容区、四档窗口及真实浏览器缩放、实际保存和送检。16:9 / 9:16 使用合成素材验证比例适配;浏览器派发的组合输入检查不代表原生操作系统中文输入法验收。物理显示器、操作系统缩放、原生输入法及公司部署环境尚未全面实测。旧本地验收任务的文件产物不可用,因此该页仅核对了布局与面板隔离,未完成媒体加载验证。详细证据、已有测试债与运行方式见[整体验收报告](verification/annotation-workspace-layout/acceptance-results.md)及[全套检查结果](verification/annotation-workspace-layout/full-suite-results.md)。 diff --git a/docs/verification/annotation-workspace-layout/acceptance-results.md b/docs/verification/annotation-workspace-layout/acceptance-results.md new file mode 100644 index 00000000..eab32594 --- /dev/null +++ b/docs/verification/annotation-workspace-layout/acceptance-results.md @@ -0,0 +1,144 @@ +# 专注标注工作页整体验收 + +日期:2026-09-18。实施票 01–07 已经逐票独立审查通过;本报告为 08 的组合验收,最终审查尚待完成,不代替前置验收。产品范围以[父规格](../../../.scratch/annotation-workspace-layout/spec.md)为准,操作说明见[中文手册](../../annotation-workspace-layout.md)。 + +所有实际业务写入仅发生在本机 Vite 5173、API 3001、snapshot Mongo 27018 的隔离任务。使用 Microsoft Edge / Playwright,`--no-proxy-server`;没有公司集群、BOS 写入、部署、合并或推送。认证文件、视频、截图、原始日志与隔离浏览器配置均在忽略的 `local-data/` 内,不进入版本库。 + +## 证据如何阅读 + +“本轮”指 08 新跑的浏览器/API 或命令结果;“前置”指已经独立审核的 01–07 原始记录,不宣称重新执行。对应报告位于 `.superpowers/sdd/annotation-workspace-layout-plan/task-N-report.md`,最终归档由主任务处理。验收以可见交互、媒体几何、公共 API 回读和请求次数为边界,没有新增内部状态或源码字符串验收。 + +本轮补入长期错误状态命中测试时发现真实问题:无效切分提示在 1920×980 遮挡“上一帧”。固定 `bottom:128px` 与随视口变化的播放区不匹配。提示现置于专注切片编辑区内,原布局保持原来的提示位置;五档尺寸下提示可见、操作命中和无文档滚动均通过。重复描述操作 CSS 已按最终计算值合并,Layout.tsx 已格式化。 + +## L01–L16 覆盖矩阵 + +| 场景 | 证据与结果 | 限制 | +| --- | --- | --- | +| L01 进入/离开 | 本轮真实 Start Work 同标签页、本人任务优先且无 claim;前置 01 原任务入口、导航回退和离开保护通过 | 未部署公司环境 | +| L02 五档两阶段 | 前置 02/03 普通编辑、04 长列表、05 长文本、06 放大;本轮字典、错误控件、两阶段确认弹层及双路/单路尺寸通过 | CSS 内容区测试,不等于五台物理设备 | +| L03 窗口/缩放 | 本轮真实 Edge 四档窗口×三档缩放 12 组通过,见下表 | 非物理显示器/OS 缩放矩阵 | +| L04 双视频 | 真实 590×480 两路,最小每路 410.54×334;前置同步/帧操作与本轮媒体回归通过 | 使用本地真实媒体副本 | +| L05 不同比例 | 前置及本轮 16:9、9:16、左右不同比例完整 contain 显示通过 | 明确为 12 秒合成素材,不是客户覆盖 | +| L06 放大/恢复 | 本轮五档、左右放大、进度条零覆盖、逐帧、草稿、原布局隐藏路恢复通过;零业务写入 | 原布局保持自己的显示偏好 | +| L07 字典/焦点 | 本轮两阶段搜索/分页/长词条/键盘、Tab/外部点击后一次 Esc 与 Space、原字典点击和键盘通过 | 不以旧 portal 属性字符串作为证明 | +| L08 大量条目 | 前置 04:13 切片/13 描述、序号、极小区间、跨页历史、双向边界与 API 回读通过 | 本轮不重复消耗已保存历史 fixture | +| L09 长文本/名称 | 前置 05 五档长文本展开、固定保存/取消、原生 cut/undo、模板及提交草稿拦截通过;本轮长字典复验 | 中文组合事件是合成派发,原生系统 IME 未通过实测 | +| L10 布局切换 | 前置 01/03/05/06 已证实帧、选择、跨片草稿、历史及 API 保存;本轮闭环草稿切换和媒体回归通过 | 刷新不恢复草稿/撤销栈 | +| L11 延迟响应 | 前置 01 延迟保存、07 在途保存/生成/提交/领取与原布局切换通过 | 延迟/断开只发生在真实 API 完成后的交付侧 | +| L12 低于底线 | 本轮 viewport 回归和实际缩放暂停通过;草稿/停止选择保留,长大不自动恢复 | 完整专注编辑不支持底线以下 | +| L13 在途尺寸变化 | 前置 07 所有请求边界、同 ID 未知领取恢复、403、未知生成核对通过;972721e 补充本人列表/详情晚到保护 | 不重复领取已完成的 unknown fixture | +| L14 偏好/刷新 | 前置 01 同一浏览器两真实账号切换、账号偏好隔离、刷新显式恢复与零 claim 通过 | 本地存储不可用时偏好不保证持久化 | +| L15 连续闭环 | 本轮真实生成、保存、送检→下一条;停止、显式恢复和空池,详见下方流水 | 送检成功仅代表进入待质检 | +| L16 原布局/审核隔离 | 原入口和原字典本轮通过;原快捷键、布局、媒体偏好有 01/06 与本轮回归;审核页隔离见下方 | 不把审核壳页当成完整审核流程验收 | + +## 全部 30 条用户故事 + +| 故事 | 对应证据 | +| --- | --- | +| 1 当前标签页 | L01,真实 Start Work | +| 2 收起平台导航 | L01,01 浏览器 | +| 3 默认双画面 | L04,06 与本轮 | +| 4 等比完整显示 | L04/L05,真实及合成分开 | +| 5 大窗口增大画面 | L02/L04,五档测量 | +| 6 明确最小视口 | L03/L12,1280×640 边界 | +| 7 阶段共用骨架 | L02,02/03 与真实生成切换 | +| 8 固定播放/逐帧/标记 | L02,02/03/06,本轮错误命中 | +| 9 视频下方时间轴 | L02,双路/放大回归 | +| 10 视频旁编辑 | L02,03/05 | +| 11 固定编辑区字典 | L07,本轮两阶段 | +| 12 字典搜索/分页/键盘 | L07,本轮两阶段 | +| 13 长列表分页导航 | L08,04 | +| 14 选择/历史显示目标页 | L08,04 | +| 15 长文本有界/展开 | L09,05 | +| 16 保存/取消/提交可达 | L02/L09,03/05、本轮闭环 | +| 17 帮助与低频入口 | L02,02/03 | +| 18 任一路主动放大 | L06,06 与本轮 | +| 19 放大压缩时间轴 | L06,零画面覆盖 | +| 20 一键恢复双路 | L06,帧与草稿保持 | +| 21 尺寸改变保留编辑 | L12,07 与本轮 | +| 22 小窗口暂停/不接续 | L12/L13,07 与本轮 | +| 23 显式恢复 | L03/L12,12 组真实缩放 | +| 24 在途结果核对 | L13,07 | +| 25 原布局回退 | L10/L16,01 与本轮 | +| 26 回退保留草稿/历史 | L10,01/03/05/06 | +| 27 账号/浏览器偏好 | L14,01 | +| 28 快捷键与焦点 | L07/L09/L16,浏览器交互与定向测试;原生 OS IME 限制保留 | +| 29 领取与送检恢复 | L11/L13/L15,01/07 与本轮 | +| 30 可核验源码恢复 | 本轮标签与完整 bundle 只读核验 | + +## 五档 CSS 内容区与有效画面 + +真实素材为 590×480;测量的是等比适配后的有效图像,不包含留黑。数字来自 06 原始记录,本轮 camera runner 再次得到相同结果。双画面和单路放大均无文档横向/纵向滚动,主要操作可达。 + +| 内容区 | 每路双画面 | 单路画面 | +| --- | --- | --- | +| 1280×640 | 410.54×334 | 531×432 | +| 1366×680 | 459.71×374 | 580.17×472 | +| 1440×800 | 529×430.37 | 727.67×592 | +| 1920×980 | 769×625.63 | 948.92×772 | +| 2560×1320 | 1089×885.97 | 1366.83×1112 | + +最低双路要求 400×325、单路要求 490×398 均满足。文本框和字典长内容可内部滚动,不属于文档滚动。 + +## 真实浏览器缩放矩阵 + +使用隔离的 Edge persistent profile、`viewport:null` 和真实窗口 `--window-size`;在浏览器设置页通过 settingsPrivate 修改默认缩放,并读取缩放值、innerWidth/innerHeight 与 devicePixelRatio。没有 CSS zoom、模拟 viewport 或 deviceScaleFactor 替代。每组最后恢复 100%,配置目录不使用用户的个人 profile。 + +| 外部窗口 | 缩放 | 实际 CSS 内容区 | DPR | 行为 | +| --- | --- | --- | --- | --- | +| 1366×768 | 100% | 1358×684 | 1 | 正常 | +| 1366×768 | 125% | 1086×547 | 1.25 | 暂停 | +| 1366×768 | 150% | 905×456 | 1.5 | 暂停 | +| 1440×900 | 100% | 1432×816 | 1 | 正常 | +| 1440×900 | 125% | 1146×653 | 1.25 | 暂停 | +| 1440×900 | 150% | 955×544 | 1.5 | 暂停 | +| 1920×1080 | 100% | 1912×996 | 1 | 正常 | +| 1920×1080 | 125% | 1530×797 | 1.25 | 正常 | +| 1920×1080 | 150% | 1275×664 | 1.5 | 暂停 | +| 2560×1440 | 100% | 2552×1356 | 1 | 正常 | +| 2560×1440 | 125% | 2042×1085 | 1.25 | 正常 | +| 2560×1440 | 150% | 1701×904 | 1.5 | 正常 | + +正常组检查固定按钮命中和无文档滚动;暂停组检查提示、视频暂停及恢复按钮在不足尺寸时禁用。恢复尺寸后提示仍在,点击继续才恢复编辑,草稿保留。全部零写入。这是实际浏览器引擎窗口/缩放测试,**不是多物理显示器或 OS 缩放实测**。 + +## 连续流水与隔离数据 + +本轮使用三组唯一前缀 fixture,所有中间结果保留,未重置完成任务。最终完整证据链在 `project-workspace-full-workflow3`。Start Work 从原入口在当前标签页优先继续 owned slice-primary,没有随机领取。主任务 v1→5 完成真实 4 片生成(412 秒有效范围,连续覆盖,无间隙/重叠)→6 保存描述→8 审核数据准备完成并进入 quality_review,然后随机领取 pool-02 v2。 + +最初 `workspace-full-workflow` 主任务已生成和保存,但脚本误用确认弹层标题而超时;修正后从当前权威阶段恢复,送检至 v8。已领取 pool-02 完成原有 3 片生成至 v6;脚本在自动切换瞬间未等切片界面就绪,预期 4 片的断言失败。`workspace-full-workflow2` 主任务真实 4 片生成至 v5,期间开发服务器收到 Layout.tsx 格式整理而 HMR,工作会话按现有规则转为显式恢复。这些均是测试设置/开发环境中断,不是产品 RED,也未通过重置数据隐藏。 + +第三组主任务完整通过后,下一条 URL 已更新但旧描述控件尚未替换,计数断言过早采样。增加等待“确认全部切片”和实际删除切片按钮,再显式恢复已领取、仍为 v2 的 pool-02 接续;没有补发领取或重置。随后 pool-02 v2→6 生成→7 保存→9 quality_review;停止选择下等待 3.5 秒没有新 claim,显式恢复才随机领取 pool-01 v2,后者 v2→6→7→9 完成。最终一次空池 claim 后再等 2.5 秒没有循环请求。 + +最终链合计 3 次生成、3 次描述保存、3 次送检、2 次成功随机领取与 1 次空池请求。续跑部分的请求计数为 2/2/2、1 次成功领取与 1 次空池,各 requestId 不重复。两次送检后没有等待质检员审批。完整版本链与中断说明共同构成证据,不宣称脚本一次从头到尾无中断运行。 + +未知结果恢复采用前置 07 已审核的实际 API 证据:unknown3 的两个传输请求沿用同一 requestId,只领取同一任务 v2;真实成功生成的响应丢失后,显式核对阶段结果恢复至 annotate,未重复生成;403 权限失败保持版本不变并阻止自动恢复。详见 task-7-report.md,不重复消耗这些任务。 + +## 质检与最终验收布局隔离 + +本轮使用主任务新建的隔离 reviewer 账号和已有素材的独立任务副本。质检 `human-item-workspace-layout-review-qc` 在两个内容区(1280×640、1920×980)显示原平台导航、真实双视频及原审核按钮;没有专注切换、单路检查或小窗口暂停入口,允许原来的滚动访问。最终验收 `human-item-workspace-layout-review-acceptance` 同样保留原平台、验收内容与意见面板;两个 item 均保持 v1,浏览器观测零业务写入。没有领取或审核决定。 + +最终验收的加载媒体覆盖受本地 snapshot 限制:其既有 `prepackage_acceptance` 数据引用产物 `run-d635f13bd89fa9fd50c0665181d884ae-fanyu-v56-human-materialized-revision-000003`。实际 evidence members API 返回 HTTP 200、recognized=true、dataSource=FILESYSTEM,但 items=[]、total=0、contentAvailableCount=0。严格等待媒体就绪超时,因此只计入实际验收面板与样式隔离,不宣称视频、姿态或文件完整性通过;没有替换、合成或改写该 payload 来获得通过。测试脚本明确输出 COVERAGE LIMIT。 + +## 定向检查与全套已有问题 + +本轮 `npm run lint:web`、`npm run build:web` 通过。Vite 保留现有 module.register 废弃提示及大于 500 kB chunk 提示。54 项定向前端测试通过,其中 `capture-responsive-layout.test.mjs` 剩余 3 项通过。仅在真实浏览器验证旧 portal 和新 inline 字典后,删除已失效的源码字符串测试及未使用的 import,未改写正则去镜像实现。 + +全套检查由主任务只跑一次:前端初始 578 项,568 通过、10 失败,其中 9 项与基线一致,1 项为上述过时断言;本轮仅定向修正,不把结果说成第二次完整套件通过。Go、Python 等基线失败及环境限制详见[主任务维护的全套结果](full-suite-results.md)。Layout.tsx 的原有格式警告已修正,其余 52 个未触及文件的警告未批量处理。 + +源码恢复点再次核验为 `54a35afad95d77b1f23c955f9c4671cae83a664d`,`git bundle verify local-data/backups/annotation-keyboard-baseline-20260918.bundle` 返回 okay、完整历史。它不能恢复数据库、视频或浏览器草稿;本次未执行恢复。 + +## 运行入口 + +浏览器脚本使用 ignored auth.json;有状态生成/送检脚本需要新隔离 fixture,不得重置旧任务。精确命令及消耗版本见 task-8-report.md。 + +| 脚本(tests/browser/) | 作用与写入范围 | +| --- | --- | +| annotation-workspace-full-workflow.mjs | 单次真实连续作业;只允许 full-workflow 前缀,本地生成/保存/送检/领取 | +| annotation-workspace-zoom-matrix.mjs | 12 组真实缩放,零业务写入 | +| annotation-workspace-errors-and-legacy.mjs | 五档真实错误控件、两阶段确认弹层及旧字典操作,零业务写入 | +| annotation-workspace-review-isolation.mjs | 真实质检/验收工作台隔离与公共版本不变,零业务写入 | +| annotation-workspace-dictionaries.mjs | `ANNOTATION_DICTIONARY_READ_ONLY=1` 复验字典,跳过长文本保存;默认模式会保存/撤销/重做 | +| annotation-workspace-camera-inspection.mjs | 两阶段五档画面和合成比例,零业务写入 | +| annotation-workspace-viewport.mjs | 草稿、暂停恢复、原布局、确认层级和单活动页,零业务写入 | + +尚未宣称覆盖:原生操作系统中文输入法、所有物理显示器和系统缩放、所有浏览器/操作系统、客户全部素材、公司 HTTPS/部署就绪、数据库/媒体恢复、真实质检通过及最终验收通过。现有失败和这些限制不会被局部浏览器通过所覆盖。 diff --git a/src/components/CaptureAnnotationWorkbench.tsx b/src/components/CaptureAnnotationWorkbench.tsx index 97185534..11e467c9 100644 --- a/src/components/CaptureAnnotationWorkbench.tsx +++ b/src/components/CaptureAnnotationWorkbench.tsx @@ -2236,7 +2236,7 @@ export function CaptureAnnotationWorkbench({ )} - {phase === "slice" && error ? ( + {phase === "slice" && error && !focusedLayout ? (

{error}

@@ -2475,6 +2475,11 @@ export function CaptureAnnotationWorkbench({ ) : null} + {focusedLayout && error ? ( +

+ {error} +

+ ) : null} ) : null} diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 05716c46..31896add 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -51,9 +51,9 @@ export function Layout({ children }: LayoutProps) { const workspaceLayout = useAnnotationLayoutPreference(currentUser?.id || ""); const focusedWorkPage = Boolean( currentUser && - !isSuperAdmin && - /^\/plugins\/annotation-qa\/workflows\/[^/]+\/work\/?$/.test(pathname) && - workspaceLayout.layout === "focused", + !isSuperAdmin && + /^\/plugins\/annotation-qa\/workflows\/[^/]+\/work\/?$/.test(pathname) && + workspaceLayout.layout === "focused", ); useEffect(() => { @@ -191,104 +191,109 @@ export function Layout({ children }: LayoutProps) { aria-label="平台状态与主题" className="relative z-40 flex h-12 shrink-0 items-center justify-end gap-3 border-b border-[color:var(--app-border)] bg-[color:var(--app-canvas)] px-3" > - -
- - +
+
+
+

组件版本与就绪状态

+

+ 点击页头状态,随时核对本次发布的三组件组合。 +

+
+ + {versions.mismatch ? "版本不一致" : versionMetadataComplete ? "版本一致" : "元数据不完整"} + +
+
+ {componentRows.map((component) => ( +
+
+

{component.label}

+ + {component.readiness} + +
+
+ {[ + ["commit", component.commit], + ["image", component.image], + ["built", component.buildTime], + ].map(([label, value]) => ( +
+
{label}
+
+ {value} +
+
+ ))} +
+
+ ))} +
+
+
* { margin-bottom: 8px; } -/* Transient track errors use a bounded floating notice, never an extra grid row. */ -.annotation-operations-page[data-workspace-compact] .capture-timeline-editor > [role="alert"] { - position: absolute; - left: 8px; - bottom: 128px; - z-index: 20; - max-width: calc(100% - 380px); +/* Slice errors stay inside the fixed editor, clear of transport controls at every height. */ +.annotation-operations-page[data-workspace-compact] .capture-slice-error { max-height: 56px; overflow: auto; - background: var(--app-panel); - padding: 4px 8px; } .annotation-operations-page[data-workspace-compact] [data-testid="frame-timeline-status"] { position: absolute; @@ -882,11 +875,13 @@ .annotation-operations-page[data-workspace-compact] .capture-description-actions { flex: none; padding-top: 4px; - gap: 4px; + flex-wrap: nowrap; + gap: 3px; } .annotation-operations-page[data-workspace-compact] .capture-description-actions button { - padding: 4px 6px; - font-size: 11px; + padding: 4px 3px; + font-size: 10px; + white-space: nowrap; } .annotation-operations-page[data-workspace-compact][data-workspace-stage="annotate"] [data-testid="slice-disposition-panel"] { @@ -967,15 +962,6 @@ .annotation-operations-page[data-workspace-compact] .annotation-task-heading .text-white { color: var(--app-text); } -.annotation-operations-page[data-workspace-compact] .capture-description-actions { - flex-wrap: nowrap; - gap: 3px; -} -.annotation-operations-page[data-workspace-compact] .capture-description-actions button { - padding: 4px 3px; - font-size: 10px; - white-space: nowrap; -} /* Paging/search shares existing timeline headers, preserving the video budget. */ .timeline-page-navigation { diff --git a/tests/browser/annotation-workspace-dictionaries.mjs b/tests/browser/annotation-workspace-dictionaries.mjs index 671aac71..db310bbc 100644 --- a/tests/browser/annotation-workspace-dictionaries.mjs +++ b/tests/browser/annotation-workspace-dictionaries.mjs @@ -242,6 +242,7 @@ try { assert.equal((await read(task)).version, old.version); continue; } + if (process.env.ANNOTATION_DICTIONARY_READ_ONLY === "1") continue; const input = page.getByRole("textbox", { name: "动作描述", exact: true }); const original = old.subject.payload.annotationWorkspace.segments[0].description; const text = `Task05 长描述 ${Date.now()}\n` + "中文动作描述内容与完整阅读。".repeat(160); diff --git a/tests/browser/annotation-workspace-errors-and-legacy.mjs b/tests/browser/annotation-workspace-errors-and-legacy.mjs new file mode 100644 index 00000000..54e1b538 --- /dev/null +++ b/tests/browser/annotation-workspace-errors-and-legacy.mjs @@ -0,0 +1,181 @@ +// Visible error controls and original portal ownership replace the obsolete source-text assertion. +import assert from "node:assert/strict"; +import { chromium } from "playwright"; +const browser = await chromium.launch({ + executablePath: "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", + headless: true, + args: ["--no-proxy-server"], +}); +const context = await browser.newContext({ + storageState: "local-data/verification/annotation-workspace-layout/auth.json", + viewport: { width: 1280, height: 640 }, +}); +const page = await context.newPage(); +const button = (name) => page.getByRole("button", { name, exact: true }); +const task = "annotation-task-workspace-layout-acceptance-pool-01"; +const base = "http://127.0.0.1:5173"; +const read = async () => { + const r = await context.request.get(`${base}/api/human-items/${task.replace("annotation-task-", "human-item-")}`); + assert.ok(r.ok()); + return (await r.json()).item; +}; +const reachable = async (locator) => + assert.ok( + await locator.evaluate((e) => { + const r = e.getBoundingClientRect(); + return ( + r.width > 0 && + r.height > 0 && + r.x >= 0 && + r.y >= 0 && + r.right <= innerWidth && + r.bottom <= innerHeight && + e.contains(document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2)) + ); + }), + `control remains hit-test reachable: ${await locator.innerText()}`, + ); +const writes = []; +page.on("request", (r) => { + if (r.method() !== "GET" && /random-claims|\/tasks\//.test(r.url())) writes.push(r.url()); +}); +try { + const before = await read(); + await page.goto( + `${base}/plugins/annotation-qa/workflows/all/work?projectId=project-workspace-layout-acceptance&taskId=${task}`, + ); + await page.getByRole("button").filter({ hasText: task }).click(); + await button("继续工作").click(); + const bench = page.getByTestId("capture-annotation-workbench"); + await bench.waitFor(); + await page.waitForFunction( + () => + document.querySelectorAll("video").length === 2 && + [...document.querySelectorAll("video")].every((v) => v.readyState >= 2), + ); + await bench.focus(); + await page.keyboard.press("c"); + await bench.getByRole("alert").waitFor(); + for (const [width, height] of [ + [1280, 640], + [1366, 680], + [1440, 800], + [1920, 980], + [2560, 1320], + ]) { + await page.setViewportSize({ width, height }); + await page.waitForTimeout(200); + for (const name of [ + "播放", + "上一帧", + "下一帧", + "在播放头分割切片", + "从切片字典选择", + "确认全部切片", + "撤销", + "重做", + "切回原布局", + "开始连续工作", + ]) + await reachable(button(name)); + assert.ok( + await page.evaluate( + () => + document.documentElement.scrollWidth <= innerWidth && document.documentElement.scrollHeight <= innerHeight, + ), + ); + await reachable(bench.getByRole("alert")); + if (width === 1920) + await page.screenshot({ path: "local-data/verification/annotation-workspace-layout/task08-error-fixed.png" }); + console.log("PASS actual error-state controls", width, height); + } + await page.setViewportSize({ width: 1280, height: 640 }); + await button("切回原布局").click(); + await button("从切片字典选择").click(); + const dialog = page.getByRole("dialog", { name: "选择切片名称", exact: true }); + await dialog.waitFor(); + const search = dialog.getByRole("textbox", { name: "搜索切片字典", exact: true }); + await reachable(search); + await search.fill("布局验收切片 003"); + const option = dialog.getByRole("button", { name: "布局验收切片 003", exact: true }); + await reachable(option); + await option.click(); + assert.equal(await page.getByLabel("切片名称:").inputValue(), "布局验收切片 003"); + await bench.focus(); + await page.keyboard.press("f"); + await search.fill("布局验收切片 002"); + await search.press("ArrowDown"); + await page.keyboard.press("Enter"); + assert.equal(await page.getByLabel("切片名称:").inputValue(), "布局验收切片 002"); + await bench.focus(); + await page.keyboard.press("d"); + await dialog.waitFor(); + await page.keyboard.press("Escape"); + await dialog.waitFor({ state: "detached" }); + assert.ok(await bench.evaluate((e) => e === document.activeElement)); + await page.keyboard.press("Space"); + await page.waitForFunction(() => !document.querySelector("video").paused); + await page.keyboard.press("Space"); + assert.equal((await read()).version, before.version); + assert.equal(writes.length, 0); + console.log( + "PASS original dictionary visible portal, pointer/search/keyboard selection, one-Esc and Space ownership; no writes", + ); + await button("进入专注视图").click(); + await bench.focus(); + for (let i = 0; i < 3; i++) await page.keyboard.press("Control+ArrowLeft"); + do { + await button("从切片字典选择").click(); + const picker = page.getByRole("dialog", { name: "选择切片名称", exact: true }); + await picker.getByRole("textbox").fill("布局验收切片 001"); + await picker.getByRole("button", { name: "布局验收切片 001", exact: true }).click(); + if (await button("下一片").isDisabled()) break; + await button("下一片").click(); + } while (true); + for (const stage of ["slice", "annotate"]) { + if (stage === "annotate") { + const id = "annotation-task-workspace-layout-acceptance-annotate-primary"; + await page.goto( + `${base}/plugins/annotation-qa/workflows/all/work?projectId=project-workspace-layout-acceptance&taskId=${id}`, + ); + await page.getByRole("button").filter({ hasText: id }).click(); + await button("继续工作").click(); + await button("完成任务并提交质检").waitFor(); + } + await button(stage === "slice" ? "确认全部切片" : "完成任务并提交质检").click(); + const confirm = page.getByRole("dialog", { + name: stage === "slice" ? "确认生成切片" : "确认提交质检", + exact: true, + }); + await confirm.waitFor(); + for (const [width, height] of [ + [1280, 640], + [1366, 680], + [1440, 800], + [1920, 980], + [2560, 1320], + ]) { + await page.setViewportSize({ width, height }); + await page.waitForTimeout(100); + await reachable(confirm.getByRole("button", { name: stage === "slice" ? "确认生成" : "确认送检", exact: true })); + await reachable(confirm.getByRole("button", { name: "返回编辑", exact: true })); + assert.ok( + await page.evaluate( + () => + document.documentElement.scrollWidth <= innerWidth && document.documentElement.scrollHeight <= innerHeight, + ), + ); + } + await confirm.getByRole("button", { name: "返回编辑", exact: true }).click(); + console.log("PASS five-size stage confirmation actions without submission", stage); + } + assert.equal(writes.length, 0); +} catch (e) { + await page.screenshot({ + path: "local-data/verification/annotation-workspace-layout/task08-error-legacy-failure.png", + }); + throw e; +} finally { + await context.close(); + await browser.close(); +} diff --git a/tests/browser/annotation-workspace-full-workflow.mjs b/tests/browser/annotation-workspace-full-workflow.mjs new file mode 100644 index 00000000..ef19ea0a --- /dev/null +++ b/tests/browser/annotation-workspace-full-workflow.mjs @@ -0,0 +1,229 @@ +// One-shot local fixtures: never reset completed tasks to rerun this acceptance. +import assert from "node:assert/strict"; +import { chromium } from "playwright"; +const base = "http://127.0.0.1:5173"; +const prefix = process.env.WORKFLOW_PREFIX || "workspace-full-workflow"; +assert.match(prefix, /^workspace-full-workflow[0-9]*(?:-[a-z0-9]+)?$/); +const browser = await chromium.launch({ + executablePath: "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", + headless: true, + args: ["--no-proxy-server"], +}); +const context = await browser.newContext({ + storageState: "local-data/verification/annotation-workspace-layout/auth.json", + viewport: { width: 1280, height: 640 }, +}); +const page = await context.newPage(); +page.setDefaultTimeout(20000); +const button = (name) => page.getByRole("button", { name, exact: true }); +const writes = []; +page.on("request", (r) => { + if (r.method() === "POST") writes.push({ url: r.url(), body: r.postDataJSON() }); +}); +const startIndex = Number(process.env.WORKFLOW_START_INDEX || 0); +assert.ok(startIndex === 0 || startIndex === 1); +const claims = () => writes.filter((r) => r.url.endsWith("/random-claims")); +const read = async (task) => { + const r = await context.request.get(`${base}/api/human-items/${task.replace("annotation-task-", "human-item-")}`); + assert.ok(r.ok()); + return (await r.json()).item; +}; +const media = () => + page.waitForFunction( + () => + document.querySelectorAll("video").length === 2 && + [...document.querySelectorAll("video")].every((v) => v.readyState >= 2), + null, + { timeout: 60000 }, + ); +const post = (suffix) => + page.waitForResponse((r) => r.url().endsWith(suffix) && r.request().method() === "POST", { timeout: 60000 }); +const noScroll = async () => + assert.ok( + await page.evaluate( + () => document.documentElement.scrollWidth <= innerWidth && document.documentElement.scrollHeight <= innerHeight, + ), + ); +try { + const primary = `annotation-task-${prefix}-${startIndex ? process.env.WORKFLOW_OWNED_TASK : "slice-primary"}`; + assert.match(primary, new RegExp(`^annotation-task-${prefix}-(slice-primary|pool-0[12])$`)); + const initial = await read(primary); + assert.equal(initial.version, startIndex ? 2 : 1, "requires untouched owned task; never reset consumed evidence"); + if (startIndex) { + await page.goto(`${base}/plugins/annotation-qa/workflows/all/work?projectId=project-${prefix}&taskId=${primary}`); + await page.getByRole("button").filter({ hasText: primary }).click(); + await button("继续工作").click(); + await button("开始连续工作").click(); + } else { + await page.goto( + `${base}/plugins/annotation-qa/workflows/all/annotate?projectId=project-${prefix}&taskId=${primary}`, + ); + await page.getByTestId("capture-annotation-workbench").waitFor(); + assert.ok(await page.locator('header[aria-label="平台状态与主题"]').isVisible()); + await button("开始工作").click(); + await page.waitForURL(/\/work\?/); + } + await page.getByTestId("capture-annotation-workbench").waitFor(); + assert.equal(new URL(page.url()).searchParams.get("taskId"), primary); + assert.equal(context.pages().length, 1); + assert.equal(claims().length, 0); + console.log("PASS Start/explicit recovery same-tab owned-first without random claim"); + for (let index = startIndex; index < 3; index++) { + await button("确认全部切片").waitFor(); + await button("删除切片").first().waitFor(); + await media(); + const task = new URL(page.url()).searchParams.get("taskId"); + assert.match(task, new RegExp(`^annotation-task-${prefix}-(slice-primary|pool-0[12])$`)); + const before = await read(task); + assert.equal(before.subject.payload.sliceWorkflow.phase, "annotate"); + assert.ok( + before.subject.payload.annotationWorkspace.segments.some((s) => s.description === "整体验收已保存动作 1"), + ); + } + let generated = before, + saved = before; + if (!resuming) { + assert.equal(before.subject.payload.sliceWorkflow.phase, "slice"); + const bench = page.getByTestId("capture-annotation-workbench"); + await bench.focus(); + const cuts = await button("删除切片").count(); + for (let n = 0; n < 6; n++) { + await page.keyboard.press("ArrowRight"); + await page.waitForTimeout(100); + } + await page.waitForFunction( + () => document.querySelector("video").currentTime > 0 && !document.querySelector("video").seeking, + ); + await page.keyboard.press("c"); + assert.equal(await button("删除切片").count(), cuts + 1, "split must visibly exist before generation"); + // Rename every actual slice using the real project dictionary before generation. + await bench.focus(); + for (let n = 0; n < 4; n++) await page.keyboard.press("Control+ArrowLeft"); + do { + await button("从切片字典选择").click(); + const dictionary = page.getByRole("dialog", { name: "选择切片名称", exact: true }); + await dictionary.getByRole("textbox").fill(process.env.WORKFLOW_LABEL || "整体验收切片 001"); + await dictionary + .getByRole("button", { name: process.env.WORKFLOW_LABEL || "整体验收切片 001", exact: true }) + .click(); + if (await button("下一片").isDisabled()) break; + await button("下一片").click(); + } while (true); + await noScroll(); + await button("确认全部切片").click(); + let response = post("/slice-confirmations"); + await button("确认生成").click(); + const accepted = await response; + assert.ok(accepted.ok()); + assert.equal((await accepted.json()).sliceWorkflow.status, "processing"); + await button("新增动作描述").waitFor({ timeout: 180000 }); + const generated = await read(task); + const sw = generated.subject.payload.sliceWorkflow; + assert.equal(sw.status, "completed"); + assert.equal(sw.phase, "annotate"); + assert.equal(sw.materialization.status, "completed"); + assert.equal(sw.materialization.coverage.gapMicroseconds, 0); + assert.equal(sw.materialization.coverage.overlapMicroseconds, 0); + assert.equal(generated.subject.payload.annotationWorkspace.sliceSegments.length, 4); + await media(); + await button("新增动作描述").click(); + await bench.focus(); + for (let n = 0; n < 6; n++) { + await page.keyboard.press("ArrowRight"); + await page.waitForTimeout(100); + } + await button("确认结束点").click(); + const input = page.getByRole("textbox", { name: "动作描述", exact: true }); + const text = `整体验收已保存动作 ${index + 1}`; + await input.fill(text); + await button("切回原布局").click(); + assert.equal(await input.inputValue(), text); + await button("进入专注视图").click(); + assert.equal(await input.inputValue(), text); + response = post("/annotation-confirmations"); + await button("确认保存描述").click(); + assert.ok((await response).ok()); + const saved = await read(task); + assert.equal(saved.version, generated.version + 1); + assert.ok(saved.subject.payload.annotationWorkspace.segments.some((s) => s.description === text)); + console.log( + "PASS real generation and saved API readback", + JSON.stringify({ task, before: before.version, generated: generated.version, saved: saved.version }), + ); + if (index === 1) { + await button("完成当前任务后停止").click(); + await button("切回原布局").click(); + await button("进入专注视图").click(); + } + const count = claims().length; + await button("完成任务并提交质检").click(); + await page.getByRole("dialog", { name: "确认提交质检", exact: true }).waitFor(); + response = post("/combined-submissions"); + await button("确认送检").click(); + assert.ok((await response).ok()); + let completed; + for (let i = 0; i < 180; i++) { + completed = await read(task); + if (completed.currentStageId === "quality_review") break; + await page.waitForTimeout(1000); + } + assert.equal(completed.currentStageId, "quality_review"); + assert.ok(!completed.pendingCombinedSubmissionId); + assert.ok(completed.currentRevision > 0); + console.log( + "PASS real slice/generate/describe/save/sendQA", + JSON.stringify({ + task, + before: before.version, + generated: generated.version, + saved: saved.version, + completed: completed.version, + stage: completed.currentStageId, + }), + ); + if (index === 1) { + await page.waitForTimeout(3500); + assert.equal(claims().length, count, "stop after current suppresses next claim"); + assert.equal(new URL(page.url()).searchParams.get("taskId"), task); + await button("恢复连续工作").click(); + console.log("PASS stop after current and explicit resume"); + } + if (index < 2) { + await page.waitForURL((u) => u.searchParams.get("taskId") !== task, { timeout: 60000 }); + await page.getByTestId("capture-annotation-workbench").waitFor(); + assert.equal(claims().length, count + 1); + } else { + await page + .getByText(/本项目暂无您可领取的标注任务/) + .first() + .waitFor({ timeout: 60000 }); + assert.equal(claims().length, count + 1); + await page.waitForTimeout(2500); + assert.equal(claims().length, count + 1, "empty pool does not loop"); + console.log("PASS authoritative empty pool stops automatic continuation"); + } + } + assert.equal(writes.filter((w) => w.url.endsWith("/slice-confirmations")).length, 3 - startIndex); + assert.equal(writes.filter((w) => w.url.endsWith("/annotation-confirmations")).length, 3 - startIndex); + assert.equal(writes.filter((w) => w.url.endsWith("/combined-submissions")).length, 3 - startIndex); + assert.equal(claims().length, 3 - startIndex); + assert.equal(new Set(claims().map((w) => w.body.requestId)).size, 3 - startIndex); + console.log( + "PASS exact request totals", + JSON.stringify({ + generation: writes.filter((w) => w.url.endsWith("/slice-confirmations")).length, + save: writes.filter((w) => w.url.endsWith("/annotation-confirmations")).length, + handoff: 3 - startIndex, + successfulClaims: 2 - startIndex, + emptyClaims: 1, + }), + ); + await page.screenshot({ path: "local-data/verification/annotation-workspace-layout/task08-full-workflow.png" }); +} catch (e) { + await page.screenshot({ path: "local-data/verification/annotation-workspace-layout/task08-workflow-error.png" }); + console.log(await page.locator("body").innerText()); + throw e; +} finally { + await context.close(); + await browser.close(); +} diff --git a/tests/browser/annotation-workspace-review-isolation.mjs b/tests/browser/annotation-workspace-review-isolation.mjs new file mode 100644 index 00000000..a52dd111 --- /dev/null +++ b/tests/browser/annotation-workspace-review-isolation.mjs @@ -0,0 +1,94 @@ +// Read-only real reviewer workbenches; no claims, decisions or payload mutations. +import assert from "node:assert/strict"; +import { chromium } from "playwright"; +const base = "http://127.0.0.1:5173"; +const browser = await chromium.launch({ + executablePath: "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", + headless: true, + args: ["--no-proxy-server"], +}); +try { + for (const role of ["qc", "acceptance"]) { + const context = await browser.newContext({ + storageState: `local-data/verification/annotation-workspace-layout/${role}-reviewer-auth.json`, + viewport: { width: 1280, height: 640 }, + }); + const page = await context.newPage(); + const writes = []; + page.on("request", (r) => { + if (r.method() !== "GET" && /\/tasks\/|\/human-items\/|random-claims/.test(r.url())) writes.push(r.url()); + }); + const item = `human-item-workspace-layout-review-${role}`; + const read = async () => { + const r = await context.request.get(`${base}/api/human-items/${item}`); + assert.ok(r.ok()); + return (await r.json()).item; + }; + const before = await read(); + const project = role === "qc" ? "project-workspace-layout-acceptance" : "project-d84a938560a792c16c2d72e8468e7563"; + await page.goto( + `${base}/plugins/annotation-qa/workflows/all/${role === "qc" ? "quality" : "acceptance"}?projectId=${project}${role === "qc" ? "&taskId=annotation-task-workspace-layout-review-qc" : ""}`, + ); + await page.getByRole("button", { name: /我的任务 1/ }).click(); + if (role === "acceptance") await page.getByRole("button", { name: "继续处理", exact: true }).click(); + const workspace = page.getByTestId(role === "qc" ? "capture-annotation-workbench" : "final-acceptance-workspace"); + await workspace.waitFor(); + let mediaAvailable = true; + if (role === "acceptance") { + const artifact = before.subject.payload.items[0].materialization.artifactId; + const response = await context.request.get( + `${base}/api/human-items/${item}/evidence/${artifact}/members?limit=200`, + ); + assert.ok(response.ok()); + const members = await response.json(); + mediaAvailable = members.total > 0; + if (!mediaAvailable) + console.log( + "COVERAGE LIMIT acceptance media unavailable in existing local FILESYSTEM snapshot", + JSON.stringify({ + artifact, + total: members.total, + contentAvailableCount: members.summary.contentAvailableCount, + }), + ); + } + if (mediaAvailable) + await page.waitForFunction( + () => + document.querySelectorAll("video").length >= 2 && + [...document.querySelectorAll("video")].every((v) => v.readyState >= 2), + null, + { timeout: 60000 }, + ); + for (const [width, height] of [ + [1280, 640], + [1920, 980], + ]) { + await page.setViewportSize({ width, height }); + assert.ok(await page.locator('header[aria-label="平台状态与主题"]').isVisible()); + assert.equal(await page.getByRole("button", { name: "切回原布局", exact: true }).count(), 0); + assert.equal(await page.getByRole("button", { name: "放大左相机", exact: true }).count(), 0); + assert.equal(await page.getByRole("dialog", { name: "工作区已暂停", exact: true }).count(), 0); + assert.equal(await page.locator(".annotation-operations-page[data-workspace-compact]").count(), 0); + assert.ok(await workspace.isVisible()); + } + if (role === "qc") { + assert.ok(await page.getByText("质检审核模式", { exact: true }).isVisible()); + await page.getByRole("button", { name: "审核通过", exact: true }).scrollIntoViewIfNeeded(); + assert.ok(await page.getByRole("button", { name: "审核通过", exact: true }).isVisible()); + } else { + await page.getByRole("textbox", { name: "最终验收意见", exact: true }).scrollIntoViewIfNeeded(); + assert.ok(await page.getByRole("textbox", { name: "最终验收意见", exact: true }).isVisible()); + } + assert.equal((await read()).version, before.version); + assert.equal(writes.length, 0); + await page.screenshot({ path: `local-data/verification/annotation-workspace-layout/task08-${role}-isolation.png` }); + console.log( + "PASS actual reviewer workspace retains platform/original controls, scroll access and no focused layout", + JSON.stringify({ role, mediaAvailable, version: before.version, writes: writes.length }), + ); + await context.close(); + } +} finally { + await browser.close(); +} diff --git a/tests/browser/annotation-workspace-zoom-matrix.mjs b/tests/browser/annotation-workspace-zoom-matrix.mjs new file mode 100644 index 00000000..43c34152 --- /dev/null +++ b/tests/browser/annotation-workspace-zoom-matrix.mjs @@ -0,0 +1,115 @@ +// Actual Edge zoom, isolated persistent profiles. Window sizes are not physical monitor/OS-scale tests. +import assert from "node:assert/strict"; +import { readFileSync, mkdtempSync, writeFileSync } from "node:fs"; +import { chromium } from "playwright"; +const root = "local-data/verification/annotation-workspace-layout"; +const results = []; +for (const [width, height] of [ + [1366, 768], + [1440, 900], + [1920, 1080], + [2560, 1440], +]) { + const context = await chromium.launchPersistentContext(mkdtempSync(`${root}/task08-zoom-`), { + executablePath: "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", + headless: true, + viewport: null, + args: ["--no-proxy-server", `--window-size=${width},${height}`], + }); + await context.addCookies(JSON.parse(readFileSync(`${root}/auth.json`)).cookies); + const settings = await context.newPage(); + await settings.goto("edge://settings/appearance"); + const zoom = (f) => + settings.evaluate( + (f) => + new Promise((resolve, reject) => + chrome.settingsPrivate.setDefaultZoom(f, () => + chrome.runtime.lastError ? reject(new Error(chrome.runtime.lastError.message)) : resolve(), + ), + ), + f, + ); + const page = await context.newPage(); + const button = (name) => page.getByRole("button", { name, exact: true }); + const writes = []; + page.on("request", (r) => { + if (r.method() !== "GET" && /random-claims|\/tasks\//.test(r.url())) writes.push(r.url()); + }); + try { + await zoom(1); + const task = "annotation-task-workspace-layout-acceptance-annotate-primary"; + await page.goto( + `http://127.0.0.1:5173/plugins/annotation-qa/workflows/all/work?projectId=project-workspace-layout-acceptance&taskId=${task}`, + ); + await page.getByRole("button").filter({ hasText: task }).click(); + await button("继续工作").click(); + await page.getByTestId("capture-annotation-workbench").waitFor(); + await page.getByTestId("annotation-description-block").first().click(); + const input = page.getByRole("textbox", { name: "动作描述", exact: true }); + await input.fill("缩放验收未保存草稿"); + for (const factor of [1, 1.25, 1.5]) { + await zoom(factor); + await page.waitForTimeout(400); + const actual = await page.evaluate(() => ({ + innerWidth, + innerHeight, + outerWidth, + outerHeight, + dpr: devicePixelRatio, + })); + const configured = await settings.evaluate( + () => new Promise((resolve) => chrome.settingsPrivate.getDefaultZoom(resolve)), + ); + assert.equal(configured, factor); + const supported = actual.innerWidth >= 1280 && actual.innerHeight >= 640; + const prompt = page.getByRole("dialog", { name: "工作区已暂停", exact: true }); + if (supported) { + assert.equal(await prompt.count(), 0); + for (const name of ["确认保存描述", "取消编辑", "完成任务并提交质检", "切回原布局"]) + assert.ok( + await button(name).evaluate((e) => { + const r = e.getBoundingClientRect(); + return ( + r.x >= 0 && + r.y >= 0 && + r.right <= innerWidth && + r.bottom <= innerHeight && + e.contains(document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2)) + ); + }), + ); + assert.ok( + await page.evaluate( + () => + document.documentElement.scrollHeight <= innerHeight && + document.documentElement.scrollWidth <= innerWidth, + ), + ); + } else { + await prompt.waitFor(); + assert.ok(await page.locator("video").evaluateAll((vs) => vs.every((v) => v.paused))); + assert.ok(await button("继续当前工作").isDisabled()); + } + results.push({ + requestedWindow: [width, height], + zoom: factor, + ...actual, + behavior: supported ? "normal" : "paused", + }); + console.log("PASS", JSON.stringify(results.at(-1))); + } + const wasSmall = results.at(-1).behavior === "paused"; + await zoom(1); + await page.waitForTimeout(300); + if (wasSmall) { + assert.ok(await page.getByRole("dialog", { name: "工作区已暂停" }).isVisible()); + await button("继续当前工作").click(); + } + assert.equal(await input.inputValue(), "缩放验收未保存草稿"); + assert.equal(writes.length, 0); + } finally { + await zoom(1); + await context.close(); + } +} +writeFileSync(`${root}/task08-zoom-matrix.json`, JSON.stringify(results, null, 2)); diff --git a/tests/frontend/capture-responsive-layout.test.mjs b/tests/frontend/capture-responsive-layout.test.mjs index 1e4df1c5..1224303d 100644 --- a/tests/frontend/capture-responsive-layout.test.mjs +++ b/tests/frontend/capture-responsive-layout.test.mjs @@ -6,7 +6,6 @@ const read = (path) => fs.readFileSync(new URL(`../../${path}`, import.meta.url) const page = read("src/pages/AnnotationOperations.tsx"); const workbench = read("src/components/CaptureAnnotationWorkbench.tsx"); const css = read("src/styles/capture-workspace.css"); -const dictionary = read("src/components/SliceNameDictionaryPicker.tsx"); test("adaptive layout is opt-in for annotation slicing, not a global role redesign", () => { assert.match(page, /workspaceMode === "annotate" && tab === "queue" && combinedEditorPhase === "slice"/); @@ -35,14 +34,3 @@ test("responsive changes do not remount media or alter timeline calculations", ( assert.match(workbench, /stepFrameBoundary\(frameBoundaries, currentTime, direction\)/); assert.match(workbench, /onSliceBoundaryChange\?\.\(current.id, "end", next\)/); }); - -test("dictionary escapes the scroller without losing pointer or keyboard ownership", () => { - assert.match(workbench, /portal=\{adaptiveLayout && phase === "slice"\}/); - assert.match(dictionary, /createPortal\(popup, document.body\)/); - assert.match(dictionary, /!root.current\?\.contains[^\n]*!popupRef.current\?\.contains/); - assert.match(dictionary, /dictionaryKeyDown\(event, close\)/); - assert.match(dictionary, /data-dictionary-open=\{\(open && !disabled\) \|\| undefined\}/); - assert.match(workbench, /\[data-dictionary-open='true'\]/); - assert.match(dictionary, /window.removeEventListener\("resize", place\)/); - assert.match(dictionary, /window.removeEventListener\("scroll", place, true\)/); -});