forked from longtao.wu/droboticflow
98 lines
5.2 KiB
JavaScript
98 lines
5.2 KiB
JavaScript
// Isolated local fixture: use this CUA driver for manual acceptance, or a
|
|
// Playwright adapter in CI. No API calls or customer task writes are involved.
|
|
import assert from "node:assert/strict";
|
|
export async function runFeedback1016Regression(tab, origin, media = "") {
|
|
assert.ok(["localhost", "127.0.0.1", "[::1]"].includes(new URL(origin).hostname));
|
|
const results = [];
|
|
for (const focused of [false, true]) {
|
|
await tab.goto(
|
|
`${origin}/tests/browser/fixtures/feedback-1016.html?${focused ? "focused&" : ""}media=${encodeURIComponent(media)}`,
|
|
);
|
|
const p = tab.playwright;
|
|
await p.getByTestId("capture-annotation-workbench").waitFor({ state: "visible" });
|
|
const assertOutsideVideo = async (selector) => {
|
|
const outside = await p.evaluate((selector) => {
|
|
const video = document.querySelector(".capture-video-surface").getBoundingClientRect();
|
|
const other = document.querySelector(selector).getBoundingClientRect();
|
|
return (
|
|
other.width > 0 &&
|
|
other.height > 0 &&
|
|
(other.left >= video.right ||
|
|
other.top >= video.bottom ||
|
|
other.right <= video.left ||
|
|
other.bottom <= video.top)
|
|
);
|
|
}, selector);
|
|
assert.equal(outside, true, `${selector} must not cover either camera`);
|
|
};
|
|
await assertOutsideVideo('[data-testid="workbench-caption-strip"]');
|
|
await p.getByRole("combobox", { name: "切片列表", exact: true }).selectOption("s1");
|
|
assert.match(
|
|
await p.getByRole("combobox", { name: "切片列表", exact: true }).innerText(),
|
|
/只有一帧的短切片仍须看清名称/,
|
|
);
|
|
await p.getByRole("button", { name: "放大当前片", exact: true }).click();
|
|
assert.equal(await p.getByRole("button", { name: "全段概览", exact: true }).getAttribute("aria-pressed"), "true");
|
|
await p.getByRole("button", { name: "隐藏字幕", exact: true }).click();
|
|
assert.equal(await p.getByTestId("workbench-caption-strip").isVisible(), false);
|
|
await p.getByRole("button", { name: "显示字幕", exact: true }).click();
|
|
await p.getByRole("combobox", { name: "切片列表", exact: true }).selectOption("s2");
|
|
await p.getByRole("button", { name: "下一帧", exact: true }).click();
|
|
await p.getByRole("listbox", { name: "动作区间", exact: true }).getByRole("option").first().click();
|
|
assert.equal(await p.getByTestId("feedback-position").innerText(), "0.100");
|
|
assert.equal(await p.getByRole("button", { name: "播放", exact: true }).isVisible(), true);
|
|
await p.getByRole("textbox", { name: "动作描述", exact: true }).fill("手部取放商品,已修正描述");
|
|
await p.getByRole("button", { name: "确认保存描述", exact: true }).click();
|
|
assert.equal(await p.getByTestId("feedback-saves").innerText(), "1");
|
|
const changes = p.getByTestId("rework-changes-panel");
|
|
await changes.locator("summary").click();
|
|
const text = await changes.innerText();
|
|
assert.match(text, /2 个切片/);
|
|
assert.match(text, /003/);
|
|
assert.match(text, /原动作3/);
|
|
assert.match(text, /原来无退回意见,此处也有改动/);
|
|
if (focused) {
|
|
assert.ok(
|
|
await p.locator(".capture-rework-rail-scroll").evaluate((element) => element.clientHeight >= 40),
|
|
"opening changes must leave the opinion list readable",
|
|
);
|
|
}
|
|
await changes.locator("summary").click();
|
|
const action = () => p.getByRole("listbox", { name: "动作区间", exact: true }).getByRole("option").first();
|
|
await action().click();
|
|
await p.getByRole("button", { name: "标为无效动作", exact: true }).click();
|
|
await action().click();
|
|
await p.getByRole("button", { name: "改为动作描述", exact: true }).click();
|
|
await p.getByRole("textbox", { name: "动作描述", exact: true }).fill("恢复后重新描述手部动作");
|
|
await p.getByRole("button", { name: "确认保存描述", exact: true }).click();
|
|
assert.equal(await p.getByTestId("feedback-saves").innerText(), "3");
|
|
await tab.pressKey(null, "e");
|
|
await p.getByTestId("slice-edit-panel").waitFor({ state: "visible" });
|
|
await assertOutsideVideo('[data-testid="slice-edit-panel"]');
|
|
await p.getByRole("button", { name: "尾帧后移1帧", exact: true }).click();
|
|
assert.equal(
|
|
await p.getByRole("spinbutton", { name: "尾帧帧号", exact: true }).evaluate((element) => element.value),
|
|
"101",
|
|
);
|
|
await p.getByRole("button", { name: "Enter 应用", exact: true }).click();
|
|
await p.getByTestId("slice-edit-conflict-list").waitFor({ state: "visible" });
|
|
await assertOutsideVideo('[data-testid="slice-edit-conflict-list"]');
|
|
await tab.pressKey(null, "Escape");
|
|
await p.getByTestId("slice-edit-panel").waitFor({ state: "hidden" });
|
|
assert.equal(await p.getByTestId("feedback-saves").innerText(), "3", "cancel never applies preview changes");
|
|
results.push({
|
|
focused,
|
|
outsidePictureText: "passed",
|
|
readableShortSlice: "passed",
|
|
zoomAndHide: "passed",
|
|
clickSeeksStartAndPauses: "passed",
|
|
allChanges: "passed",
|
|
invalidActionCanBeEditedAgain: "passed",
|
|
frameStep: "passed",
|
|
panelAndConflictDock: "passed",
|
|
cancelPreservesSavedContent: "passed",
|
|
});
|
|
}
|
|
return results;
|
|
}
|