forked from longtao.wu/droboticflow
✨ Show acceptance action durations and short intervals
This commit is contained in:
parent
86e9fac8c7
commit
0a60d8031c
21
.scratch/acceptance-action-navigation/work.md
Normal file
21
.scratch/acceptance-action-navigation/work.md
Normal file
@ -0,0 +1,21 @@
|
||||
# #18 验收动作时长与导航
|
||||
|
||||
基线:86e9fac8;授权:本地实现、回归、提交,不推送、不部署。
|
||||
|
||||
范围:FinalAcceptanceWorkspace、acceptance-workspace helper、review-workspace CSS;复用既有审查键位,不修改标注编辑、审核决定、权限或保存协议。截图确认缺口为当前切片内动作列表,非新增切片列表。小于 3 秒的非无效区间标记“短区间”,待标注仍保留其身份,不判作有效或错误。保护共享树内所有其他任务改动。
|
||||
|
||||
完成条件:左右列表/轨道/键盘定位一致,短区间不因比例压缩不可见;输入/弹层、只读、首尾、切片切换及窄屏回归。状态:本地实现与回归完成,待推送/部署授权。
|
||||
|
||||
|
||||
## 交付与验证
|
||||
|
||||
- #580/583 两张截图已下载到主仓 `local-data/diagnostics/issue18-{quality,acceptance}.png`;确认需求指切片内动作区间,不是新增切片轨道。
|
||||
- 验收普通/专注布局增加左侧动作列表,复用质检列表样式与既有 `seekAction` 控制器,逐条显示原状态、起止、三位小数秒数及原描述。小于 3 秒的非无效区间独立行显示并标记“短区间”,待标注仍为待标注。选中项自动滚动到可见位置;加载与失败不冒充零动作。
|
||||
- 范围建议:本次实现验收列表;质检、验收共用 ↑/↓ 切动作、Ctrl/⌘+←/→ 切片;标注描述阶段已有导航,切片阶段保持边界编辑,不新增冲突键位。不改变权限、决定、草稿保存和媒体坐标协议。
|
||||
- 通过:`npm run lint:web`(类型与架构检查)、62 项有关前端回归、Prettier、diff check、hooks 状态、Go 格式(提交钩子等价检查)。
|
||||
- 通过:真实 FinalAcceptanceWorkspace/CaptureAnnotationWorkbench 浏览器流程(native / movi / movi-fractional),每模式 15 次切片变化、倍速保留、0.5 秒有效动作夹在无效动作中、点击/上下键/首尾停止、帮助弹层/文字输入保护、只读导航、批注保存和刷新;无 pageerror。普通/专注、深色窄屏及加载/空/错误/舍弃状态有截图证据。
|
||||
- 通过:`node tests/browser/review-caption-recovery.mjs` 的加载、解码失败、恢复及卸载重挂。
|
||||
- 首次浏览器尝试有定位器名称错误(已改为现有 aria-label);扩展状态覆盖后 BrowserServer 收尾超时,已改用 Playwright 直接启动/关闭独占浏览器,最终完整运行 exit 0。历史失败日志保留,不当作通过。
|
||||
- 本任务验证使用 `scripts/verify-change.py` 既有 `plan_checks` 对本任务文件生成范围(`local-data/test-results/issue18/plan.json`),逐项执行并复用未变证据;不运行共享树其他任务的 Go/集群测试。未执行生产构建/发布门禁、真实客户数据写入或线上验收。
|
||||
- 日志:`local-data/test-results/issue18/`;浏览器最终日志:`local-data/test-results/acceptance-playback-rate/issue18-direct-browser-run.log`,结果 `report.json`;代表图 `native-short-action-list.png`、`normal-action-list.png`、`dark-narrow-action-list.png` 及 `{loading,empty,error}-action-list.png`。
|
||||
- 共享树已有其他任务改动;为避免 lint-staged 默认临时 stash 这些工作,显式运行 `npx lint-staged --no-stash`、lint:web、lint:go 等价检查,随后仅本次提交使用 HUSKY=0,不修改 hooks 配置。
|
||||
@ -76,3 +76,9 @@ Shift + Delete(Mac:Shift + Backspace)删除列表中选中的本轮问题
|
||||
最终验收连续审查跟随页面的项目筛选:“全部项目”跨项目继续,选定项目只处理该项目。两种范围都优先本人最早领取任务,再领取最早创建的可用任务;首条成功决定后才接续。连续验收运行中切换项目时,旧范围停止并自动接续新范围;已暂停时切换项目仍保持暂停。刷新、手动暂停、窗口过小、页面被接管及提交异常的暂停规则不变。质检保持原来的项目范围。
|
||||
|
||||
接口:`POST /api/review-continuation`,`stage=acceptance` 且明确指定 `scope=all`(不传 projectId)或 `scope=project, projectId=...`。原 `/api/projects/{id}/review-continuation` 保留兼容。领取互斥、编辑权、版本校验及正式决定去重沿用原协议。
|
||||
|
||||
## 验收动作时长与短区间
|
||||
|
||||
最终验收的视频左侧与质检一致,按时间顺序显示当前切片的动作区间:状态、片内起止时间、时长及原动作描述。每条使用独立列表行,小于 3 秒的非无效区间显示“短区间”;这是查看标记,不会判为错误,也不会将待标注区间变成有效判断。舍弃切片保留舍弃状态,不将其列为有效动作。
|
||||
|
||||
点击动作行会暂停在该动作起始帧。质检、验收继续共用 `↑ / ↓` 切换动作、`Ctrl / ⌘ + ← / →` 切换切片,首尾停止;标注描述阶段已有同类导航,不新增键位。标注切片阶段的边界编辑键位保持原有规则。文字输入与弹层内不执行动作导航。
|
||||
|
||||
@ -22,6 +22,7 @@ import { apiFetch } from "../services/api/client";
|
||||
import { buildAPIURL } from "../services/api/base-url.js";
|
||||
import {
|
||||
acceptanceActions,
|
||||
acceptanceActionStatus,
|
||||
acceptanceTimestampOpinions,
|
||||
acceptanceViewStatus,
|
||||
acceptanceSliceCountLabel,
|
||||
@ -384,6 +385,14 @@ export function FinalAcceptanceWorkspace({
|
||||
return [...new Set([0, ...values, duration])].sort((a, b) => a - b);
|
||||
}, [currentMetadata?.frames, duration]);
|
||||
const actions = currentMetadata?.actions || [];
|
||||
const actionListRef = useRef<HTMLDivElement>(null);
|
||||
const highlightedActionId =
|
||||
selectedActionId || actions.find((action) => currentTime >= action.start && currentTime < action.end)?.id;
|
||||
useEffect(() => {
|
||||
const list = actionListRef.current;
|
||||
const row = list?.querySelector<HTMLElement>("[aria-selected='true']");
|
||||
if (list && row) list.scrollTo({ top: Math.max(0, row.offsetTop - list.clientHeight * 0.4) });
|
||||
}, [activeKey, highlightedActionId]);
|
||||
const reviewCaption = reviewCaptionAtTime({
|
||||
time: currentTime,
|
||||
slice: active
|
||||
@ -746,82 +755,135 @@ export function FinalAcceptanceWorkspace({
|
||||
{left &&
|
||||
right &&
|
||||
(!active.sourceIndex || (currentMetadata && !currentMetadata.loading && !currentMetadata.error)) ? (
|
||||
<CaptureAnnotationWorkbench
|
||||
key={`media:${mediaKey}`}
|
||||
playbackRate={playbackRate}
|
||||
onPlaybackRateChange={setPlaybackRate}
|
||||
taskId={mediaKey}
|
||||
mediaOnly
|
||||
focusedLayout={focusedLayout}
|
||||
cameraPreferenceKey={cameraPreferenceKey}
|
||||
viewportSuspended={viewportSuspended}
|
||||
browserReadyMedia={!active.sourceIndex}
|
||||
reviewCaption={reviewCaption}
|
||||
reviewTimestampOpinions={acceptanceTimestampOpinions(groups, active.id, reviewTimestampOpinions)}
|
||||
totalProgress={
|
||||
fullVideoWindow
|
||||
? {
|
||||
offset: fullVideoWindow.offset,
|
||||
duration: fullVideoWindow.total,
|
||||
onSeekTotal: seekTotalVideoTime,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
reviewNavigation={{
|
||||
actions: active.deliveryDisposition === "discard" ? [] : actions,
|
||||
selectedActionId,
|
||||
onSelectAction: chooseAction,
|
||||
sliceIndex: groups.findIndex((group) => group.id === active.id),
|
||||
sliceCount: groups.length,
|
||||
onNavigateSlice: navigateSlice,
|
||||
}}
|
||||
onReviewController={attachMediaController}
|
||||
onReviewNavigate={onReviewNavigate}
|
||||
onReviewPositionChange={mappedPosition}
|
||||
onReviewProblem={(position) => onReviewProblem?.(mapReviewPosition(position))}
|
||||
onReviewSave={onReviewSave}
|
||||
onReviewTargetSwitch={onReviewTargetSwitch}
|
||||
onReviewTimestampJump={onReviewTimestampJump}
|
||||
onReviewProblemEdit={onReviewProblemEdit}
|
||||
onReviewProblemDelete={onReviewProblemDelete}
|
||||
onReviewEscape={onReviewEscape}
|
||||
frameTimelineStatus={
|
||||
currentMetadata?.error
|
||||
? "error"
|
||||
: currentMetadata?.loading || !currentMetadata
|
||||
? "loading"
|
||||
: "ready"
|
||||
}
|
||||
reviewWriteLocked={!canAct || saving || navigating}
|
||||
videoSource={mediaURL("left.mp4")}
|
||||
rightVideoSource={mediaURL("right.mp4")}
|
||||
clipStart={0}
|
||||
clipEnd={duration}
|
||||
sourceIsFullVideo
|
||||
mediaSourceOffsets={active.sourceIndex ? currentMetadata?.sync?.sourceMediaOffsets : undefined}
|
||||
slices={[
|
||||
{
|
||||
id: active.id,
|
||||
name: active.name,
|
||||
start: 0,
|
||||
end: duration,
|
||||
deliveryDisposition: active.deliveryDisposition === "discard" ? "discard" : "keep",
|
||||
},
|
||||
]}
|
||||
segments={[]}
|
||||
labels={[]}
|
||||
statuses={{}}
|
||||
phase="annotate"
|
||||
frameBoundaries={frames}
|
||||
rightMediaBoundaries={currentMetadata?.sync?.rightBoundarySeconds}
|
||||
unifiedBoundaries={currentMetadata?.sync?.boundaryContract === "hardware-frame-v1"}
|
||||
onChange={noChange}
|
||||
onPlayheadChange={setCurrentTime}
|
||||
onMediaDuration={(value) => setMediaDuration({ key: activeKey, value })}
|
||||
initialCameraVisibility={cameras}
|
||||
onCameraVisibilityChange={setCameras}
|
||||
seekRequest={seekRequest}
|
||||
/>
|
||||
<div className="acceptance-player-with-actions">
|
||||
<aside className="capture-action-list acceptance-action-list" aria-label="当前切片动作列表">
|
||||
<strong>
|
||||
动作
|
||||
{currentMetadata &&
|
||||
!currentMetadata.loading &&
|
||||
!currentMetadata.error &&
|
||||
` · ${active.deliveryDisposition === "discard" ? 0 : actions.length}`}
|
||||
</strong>
|
||||
<div
|
||||
ref={actionListRef}
|
||||
role="listbox"
|
||||
aria-label="动作区间"
|
||||
className="capture-action-list-scroll"
|
||||
>
|
||||
{currentMetadata?.error ? (
|
||||
<p role="alert">{userErrorMessage(currentMetadata.error)}</p>
|
||||
) : !currentMetadata || currentMetadata.loading ? (
|
||||
<p role="status">加载中…</p>
|
||||
) : active.deliveryDisposition === "discard" ? (
|
||||
<p>已舍弃</p>
|
||||
) : !actions.length ? (
|
||||
<p>暂无动作区间</p>
|
||||
) : (
|
||||
actions.map((action, index) => {
|
||||
const status = acceptanceActionStatus(action);
|
||||
return (
|
||||
<button
|
||||
key={action.id}
|
||||
type="button"
|
||||
role="option"
|
||||
aria-selected={highlightedActionId === action.id}
|
||||
disabled={saving || navigating}
|
||||
data-short-action={status.short || undefined}
|
||||
onClick={() => mediaControllerRef.current?.seekAction(action.id)}
|
||||
>
|
||||
<span>
|
||||
#{index + 1} · {status.label}
|
||||
</span>
|
||||
<small>
|
||||
{time(action.start)}–{time(action.end)}
|
||||
</small>
|
||||
<span className="acceptance-action-duration">
|
||||
{status.duration.toFixed(3)} 秒{status.short && <b> · 短区间</b>}
|
||||
</span>
|
||||
<span title={action.description}>{action.description}</span>
|
||||
</button>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</aside>
|
||||
<CaptureAnnotationWorkbench
|
||||
key={`media:${mediaKey}`}
|
||||
playbackRate={playbackRate}
|
||||
onPlaybackRateChange={setPlaybackRate}
|
||||
taskId={mediaKey}
|
||||
mediaOnly
|
||||
focusedLayout={focusedLayout}
|
||||
cameraPreferenceKey={cameraPreferenceKey}
|
||||
viewportSuspended={viewportSuspended}
|
||||
browserReadyMedia={!active.sourceIndex}
|
||||
reviewCaption={reviewCaption}
|
||||
reviewTimestampOpinions={acceptanceTimestampOpinions(groups, active.id, reviewTimestampOpinions)}
|
||||
totalProgress={
|
||||
fullVideoWindow
|
||||
? {
|
||||
offset: fullVideoWindow.offset,
|
||||
duration: fullVideoWindow.total,
|
||||
onSeekTotal: seekTotalVideoTime,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
reviewNavigation={{
|
||||
actions: active.deliveryDisposition === "discard" ? [] : actions,
|
||||
selectedActionId,
|
||||
onSelectAction: chooseAction,
|
||||
sliceIndex: groups.findIndex((group) => group.id === active.id),
|
||||
sliceCount: groups.length,
|
||||
onNavigateSlice: navigateSlice,
|
||||
}}
|
||||
onReviewController={attachMediaController}
|
||||
onReviewNavigate={onReviewNavigate}
|
||||
onReviewPositionChange={mappedPosition}
|
||||
onReviewProblem={(position) => onReviewProblem?.(mapReviewPosition(position))}
|
||||
onReviewSave={onReviewSave}
|
||||
onReviewTargetSwitch={onReviewTargetSwitch}
|
||||
onReviewTimestampJump={onReviewTimestampJump}
|
||||
onReviewProblemEdit={onReviewProblemEdit}
|
||||
onReviewProblemDelete={onReviewProblemDelete}
|
||||
onReviewEscape={onReviewEscape}
|
||||
frameTimelineStatus={
|
||||
currentMetadata?.error
|
||||
? "error"
|
||||
: currentMetadata?.loading || !currentMetadata
|
||||
? "loading"
|
||||
: "ready"
|
||||
}
|
||||
reviewWriteLocked={!canAct || saving || navigating}
|
||||
videoSource={mediaURL("left.mp4")}
|
||||
rightVideoSource={mediaURL("right.mp4")}
|
||||
clipStart={0}
|
||||
clipEnd={duration}
|
||||
sourceIsFullVideo
|
||||
mediaSourceOffsets={active.sourceIndex ? currentMetadata?.sync?.sourceMediaOffsets : undefined}
|
||||
slices={[
|
||||
{
|
||||
id: active.id,
|
||||
name: active.name,
|
||||
start: 0,
|
||||
end: duration,
|
||||
deliveryDisposition: active.deliveryDisposition === "discard" ? "discard" : "keep",
|
||||
},
|
||||
]}
|
||||
segments={[]}
|
||||
labels={[]}
|
||||
statuses={{}}
|
||||
phase="annotate"
|
||||
frameBoundaries={frames}
|
||||
rightMediaBoundaries={currentMetadata?.sync?.rightBoundarySeconds}
|
||||
unifiedBoundaries={currentMetadata?.sync?.boundaryContract === "hardware-frame-v1"}
|
||||
onChange={noChange}
|
||||
onPlayheadChange={setCurrentTime}
|
||||
onMediaDuration={(value) => setMediaDuration({ key: activeKey, value })}
|
||||
initialCameraVisibility={cameras}
|
||||
onCameraVisibilityChange={setCameras}
|
||||
seekRequest={seekRequest}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<p role="alert" className="rounded border border-amber-300 p-4 text-sm text-amber-700">
|
||||
{active.sourceIndex && (!currentMetadata || currentMetadata.loading)
|
||||
|
||||
@ -217,3 +217,15 @@ export function acceptanceTimestampOpinions(groups, activeId, opinions = []) {
|
||||
return [{ ...opinion, atSeconds: at, timeBasis: "slice-seconds" }];
|
||||
});
|
||||
}
|
||||
|
||||
// Duration is slice-relative; a short interval is a viewing aid, not an error
|
||||
// or a judgment that a pending (semantically blank) action is valid.
|
||||
export function acceptanceActionStatus(action) {
|
||||
const duration = Number(action.end) - Number(action.start);
|
||||
const invalid = action.isInvalid || action.status === "invalid" || action.description === "无效片段";
|
||||
return {
|
||||
duration,
|
||||
label: invalid ? "无效" : action.status === "pending" ? "待标注" : "已描述",
|
||||
short: !invalid && Number.isFinite(duration) && duration > 0 && duration < 3,
|
||||
};
|
||||
}
|
||||
|
||||
@ -274,9 +274,14 @@ html.dark .review-focus-heading > button:hover:not(:disabled) {
|
||||
margin: 0;
|
||||
flex: none;
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] .acceptance-review-media > .capture-workbench {
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] .acceptance-review-media > .capture-workbench,
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused]
|
||||
.acceptance-review-media
|
||||
> .acceptance-player-with-actions {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] .acceptance-review-media > .capture-workbench {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
@ -521,3 +526,61 @@ html.dark .review-focus-heading > button:hover:not(:disabled) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fixed-height rows keep very short actions visible independently of timeline scale. */
|
||||
.acceptance-player-with-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 160px minmax(0, 1fr);
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.acceptance-player-with-actions > .capture-workbench {
|
||||
min-width: 0;
|
||||
}
|
||||
.acceptance-player-with-actions .acceptance-action-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 6px;
|
||||
}
|
||||
.acceptance-action-list .capture-action-list-scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.acceptance-action-list p {
|
||||
padding: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.acceptance-action-list button {
|
||||
min-height: 82px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.acceptance-action-list button[data-short-action] {
|
||||
border-left: 3px solid #d97706;
|
||||
}
|
||||
.acceptance-action-list .acceptance-action-duration {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.acceptance-action-duration b {
|
||||
color: #b45309;
|
||||
}
|
||||
.dark .acceptance-action-duration b {
|
||||
color: #fbbf24;
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] .acceptance-player-with-actions {
|
||||
display: grid;
|
||||
grid-template-columns: 150px minmax(0, 1fr);
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] .acceptance-player-with-actions > .capture-workbench {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] .acceptance-action-list .capture-action-list-scroll {
|
||||
max-height: none;
|
||||
}
|
||||
@media (max-width: 700px) {
|
||||
.acceptance-player-with-actions {
|
||||
grid-template-columns: 120px minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,11 +54,9 @@ execFileSync("ffmpeg", [
|
||||
`${out}/source.mp4`,
|
||||
]);
|
||||
const sourceMedia = await fs.readFile(`${out}/source.mp4`);
|
||||
let browser, owner, server, diagnosticPage;
|
||||
const launchBrowser = async () => {
|
||||
owner = await chromium.launchServer({ ...browserExecutableOptions(), headless: true, args: ["--no-proxy-server"] });
|
||||
return chromium.connect(owner.wsEndpoint());
|
||||
};
|
||||
let browser, server, diagnosticPage;
|
||||
const launchBrowser = () =>
|
||||
chromium.launch({ ...browserExecutableOptions(), headless: true, args: ["--no-proxy-server"] });
|
||||
const cases = [];
|
||||
try {
|
||||
if (!base) {
|
||||
@ -109,7 +107,8 @@ try {
|
||||
updatedAt: "",
|
||||
};
|
||||
let draftError = false;
|
||||
await page.route("**/api/**", (route) => {
|
||||
let actionMode = "ready";
|
||||
await page.route("**/api/**", async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (!url.pathname.startsWith("/api/")) return route.continue();
|
||||
if (url.pathname.endsWith("/review-draft")) {
|
||||
@ -165,7 +164,23 @@ try {
|
||||
},
|
||||
});
|
||||
}
|
||||
if (url.pathname.includes("annotation.json")) return route.fulfill({ json: { actions: [] } });
|
||||
if (url.pathname.includes("annotation.json") && actionMode === "loading")
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||
if (url.pathname.includes("annotation.json") && actionMode === "error")
|
||||
return route.fulfill({ status: 503, json: { error: "合成动作读取失败" } });
|
||||
if (url.pathname.includes("annotation.json") && actionMode === "empty")
|
||||
return route.fulfill({ json: { descriptions: [] } });
|
||||
if (url.pathname.includes("annotation.json"))
|
||||
return route.fulfill({
|
||||
json: {
|
||||
descriptions: [
|
||||
{ id: "invalid-before", clipStartMs: 0, clipEndMs: 2000, isInvalid: true, description: "无效片段" },
|
||||
{ id: "brief", clipStartMs: 2000, clipEndMs: 2500, description: "短暂有效动作" },
|
||||
{ id: "invalid-after", clipStartMs: 2500, clipEndMs: 7000, isInvalid: true, description: "无效片段" },
|
||||
{ id: "blank", clipStartMs: 7000, clipEndMs: 8000 },
|
||||
],
|
||||
},
|
||||
});
|
||||
if (url.pathname.includes("synchronized-slice.json")) {
|
||||
const index = Number(/slice-(\d+)/.exec(url.pathname)?.[1] || 1) - 1;
|
||||
return route.fulfill({
|
||||
@ -201,6 +216,51 @@ try {
|
||||
);
|
||||
await page.goto(`${base}/__acceptance_playback_rate`);
|
||||
await page.getByLabel("播放速度").waitFor();
|
||||
const actionList = page.getByRole("listbox", { name: "动作区间", exact: true });
|
||||
await actionList.getByRole("option").nth(3).waitFor();
|
||||
const brief = actionList.getByRole("option").nth(1);
|
||||
assert.match(await brief.innerText(), /0.500 秒.*短区间/s);
|
||||
assert.match(await actionList.getByRole("option").nth(3).innerText(), /待标注/);
|
||||
assert((await brief.boundingBox()).height >= 82, "brief actions must have a full-sized row");
|
||||
await brief.click();
|
||||
await page.waitForFunction(() =>
|
||||
document.querySelector('.acceptance-action-list [aria-selected="true"]')?.textContent.includes("短暂有效动作"),
|
||||
);
|
||||
const assertActionTime = async (value) => {
|
||||
await page.waitForFunction(
|
||||
({ value, offset }) => {
|
||||
const player = document.querySelector('[data-camera="left"]');
|
||||
return player?.paused && !player.seeking && Math.abs(player.currentTime - offset - value) < 0.06;
|
||||
},
|
||||
{ value, offset: sourceIndex ? fractionalOffset : 0 },
|
||||
);
|
||||
};
|
||||
await assertActionTime(2);
|
||||
// Navigation follows the selected row and never skips a sub-three-second action.
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await assertActionTime(2.5);
|
||||
await page.keyboard.press("ArrowUp");
|
||||
await assertActionTime(2);
|
||||
await page.keyboard.press("ArrowUp");
|
||||
await assertActionTime(0);
|
||||
await page.keyboard.press("ArrowUp");
|
||||
await assertActionTime(0);
|
||||
await actionList.getByRole("option").last().click();
|
||||
await assertActionTime(7);
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await assertActionTime(7);
|
||||
await brief.click();
|
||||
await assertActionTime(2);
|
||||
await page.screenshot({ path: `${out}/${engine}-short-action-list.png`, fullPage: true });
|
||||
const listBox = await actionList.boundingBox();
|
||||
const videoBox = await page.locator('[data-testid="capture-video-panel"]').boundingBox();
|
||||
assert(listBox.x + listBox.width <= videoBox.x, "action list stays left of the video");
|
||||
await page.getByRole("button", { name: "快捷键帮助", exact: true }).click();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("Escape");
|
||||
await assertActionTime(2);
|
||||
// Read-only viewing still permits list navigation; IME/text entry is tested
|
||||
// below using the actual review problem editor.
|
||||
// Keep the same single-camera source player across keep -> discard -> keep.
|
||||
// Caption DOM must recover without toggling captions or resizing the window.
|
||||
const sliceChoices = page.locator('[aria-label="验收切片选择"]');
|
||||
@ -337,7 +397,13 @@ try {
|
||||
firstAnchor,
|
||||
"typing target must not drift with playback",
|
||||
);
|
||||
await page.getByRole("textbox", { name: "审查问题说明" }).fill("时间点固定在当前画面");
|
||||
const noteInput = page.getByRole("textbox", { name: "审查问题说明" });
|
||||
await noteInput.fill("时间点固定在当前画面");
|
||||
const frozenSelection = await actionList.locator('[aria-selected="true"]').textContent();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("Control+ArrowRight");
|
||||
assert.equal(await actionList.locator('[aria-selected="true"]').textContent(), frozenSelection);
|
||||
assert.equal(await noteInput.inputValue(), "时间点固定在当前画面");
|
||||
await page.getByRole("button", { name: "保存批注", exact: true }).click();
|
||||
await page.getByRole("button", { name: "保存批注", exact: true }).waitFor({ state: "hidden" });
|
||||
assert.equal(draft.problems.length, 1);
|
||||
@ -401,23 +467,59 @@ try {
|
||||
await page.goto(`${base}/__acceptance_playback_rate?readonly=1`);
|
||||
await sliceCard.waitFor();
|
||||
assert(await sliceCard.isDisabled(), "read-only viewers cannot enter edit mode");
|
||||
await brief.click();
|
||||
await assertActionTime(2);
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await assertActionTime(2.5);
|
||||
await page.screenshot({ path: `${out}/${engine}-readonly.png`, fullPage: true });
|
||||
draftError = true;
|
||||
await page.reload();
|
||||
await page.getByRole("alert").first().waitFor();
|
||||
assert(await sliceCard.isDisabled(), "failed draft loading keeps edit locked");
|
||||
await page.screenshot({ path: `${out}/${engine}-draft-error.png`, fullPage: true });
|
||||
if (engine === "native") {
|
||||
draftError = false;
|
||||
await page.goto(`${base}/__acceptance_playback_rate?normal=1`);
|
||||
await brief.waitFor();
|
||||
await brief.click();
|
||||
await assertActionTime(2);
|
||||
await page.screenshot({ path: `${out}/normal-action-list.png`, fullPage: true });
|
||||
await page.setViewportSize({ width: 1000, height: 800 });
|
||||
await page.evaluate(() => document.documentElement.classList.add("dark"));
|
||||
await page.screenshot({ path: `${out}/dark-narrow-action-list.png`, fullPage: true });
|
||||
assert(await brief.isVisible());
|
||||
assert(
|
||||
await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth),
|
||||
"list must not widen the page",
|
||||
);
|
||||
await page.setViewportSize({ width: 1500, height: 1000 });
|
||||
actionMode = "empty";
|
||||
await page.reload();
|
||||
await actionList.getByText("暂无动作区间", { exact: true }).waitFor();
|
||||
assert.equal(await actionList.getByRole("option").count(), 0);
|
||||
await page.screenshot({ path: `${out}/empty-action-list.png`, fullPage: true });
|
||||
actionMode = "error";
|
||||
await page.reload();
|
||||
await actionList.getByRole("alert").waitFor();
|
||||
assert.equal(await actionList.getByRole("option").count(), 0);
|
||||
await page.screenshot({ path: `${out}/error-action-list.png`, fullPage: true });
|
||||
actionMode = "loading";
|
||||
await page.reload();
|
||||
await actionList.getByRole("status").waitFor();
|
||||
await page.screenshot({ path: `${out}/loading-action-list.png`, fullPage: true });
|
||||
await brief.waitFor();
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
await page.screenshot({ path: `${out}/${engine}.png`, fullPage: true });
|
||||
cases.push({ engine, sliceChanges: 3 + shortcutChanges, retainedRates: [2, 1.5, 1.5], errors });
|
||||
await context.close();
|
||||
await closeBrowserFixture({ browser, owner });
|
||||
await closeBrowserFixture({ browser });
|
||||
browser = undefined;
|
||||
owner = undefined;
|
||||
}
|
||||
await fs.writeFile(`${out}/report.json`, JSON.stringify({ passed: true, cases }, null, 2));
|
||||
console.log(JSON.stringify({ passed: true, cases }));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
if (diagnosticPage) {
|
||||
await diagnosticPage.screenshot({ path: `${out}/failure.png`, fullPage: true }).catch(() => {});
|
||||
console.log(
|
||||
@ -440,5 +542,5 @@ try {
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
await closeBrowserFixture({ browser, owner, vite: server });
|
||||
await closeBrowserFixture({ browser, vite: server });
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ function App() {
|
||||
item={item}
|
||||
mine
|
||||
saving={false}
|
||||
focusedLayout
|
||||
focusedLayout={!new URLSearchParams(location.search).has("normal")}
|
||||
draft={{ headpose: "include", handpose: "include", exclusionReason: "" }}
|
||||
comment=""
|
||||
onDraftChange={() => {}}
|
||||
|
||||
@ -2,6 +2,7 @@ import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
acceptanceActions,
|
||||
acceptanceActionStatus,
|
||||
acceptanceTimestampOpinions,
|
||||
acceptanceSliceName,
|
||||
acceptanceChecks,
|
||||
@ -246,3 +247,22 @@ test("acceptance markers retain source identity and map only the active slice cl
|
||||
assert.deepEqual(acceptanceTimestampOpinions(groups, "missing", opinions), []);
|
||||
assert.equal(acceptanceTimestampOpinions([groups[0]], "A", [opinions[3]])[0].id, "ambiguous");
|
||||
});
|
||||
|
||||
test("short non-invalid actions remain distinct without judging blank actions as valid", () => {
|
||||
const actions = acceptanceActions({
|
||||
descriptions: [
|
||||
{ id: "invalid-before", clipStartMs: 0, clipEndMs: 2000, isInvalid: true },
|
||||
{ id: "brief", clipStartMs: 2000, clipEndMs: 2500, description: "短暂有效动作" },
|
||||
{ id: "invalid-after", clipStartMs: 2500, clipEndMs: 5000, status: "invalid" },
|
||||
{ id: "blank", clipStartMs: 5000, clipEndMs: 5500 },
|
||||
{ id: "exact-three", clipStartMs: 5500, clipEndMs: 8500, description: "三秒动作" },
|
||||
],
|
||||
});
|
||||
assert.deepEqual(actions.map(acceptanceActionStatus), [
|
||||
{ duration: 2, label: "无效", short: false },
|
||||
{ duration: 0.5, label: "已描述", short: true },
|
||||
{ duration: 2.5, label: "无效", short: false },
|
||||
{ duration: 0.5, label: "待标注", short: true },
|
||||
{ duration: 3, label: "已描述", short: false },
|
||||
]);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user