Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/development/lessons.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u

- **Shared model catalog follow-up:** [Nightly run 45309310680](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/45309310680/job/138160760923) reached the empty-video-selector test after an earlier script saved a video model. A new page still reads the shared server's catalog. For a UI test of an empty category, scope that catalog response to the test page and verify the flow with a model already present on the shared server.

## Canvas media readiness depends on the viewport

- Browser checks that inspect a canvas image or video after reopening a project or placing a result should bring the target node into view first.
- The subject-library and video-review checks in Nightly run 45572808123 reached their persisted-state assertions before the lazy previews were ready. After fitting the canvas, wait for the target image to load or the video to load metadata, then verify the dimensions or duration. [Nightly run 45572808123](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/45572808123/job/139063347523)

## Browser clock pauses must precede short-lived observations

- **Trigger:** Freezing browser time to inspect a short-lived response in both languages.
Expand Down
16 changes: 11 additions & 5 deletions tests/browser/default_entry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,18 @@ try {
}
await page.getByRole("button", { name: "切换项目", exact: true }).click();
await page.getByText(/使用旧格式/).waitFor();
// The current project's check shares the trailing slot with its row actions
// button, which covers it while the row is hovered.
// On hover the new-tab shortcut takes the checkmark's trailing slot.
const currentRow = page
.locator(".cw-project-row:has(.cw-project-check)")
.first();
const checkBox = await currentRow.locator(".cw-project-check").boundingBox();
const moreBox = await currentRow.locator(".cw-project-more").boundingBox();
assert.ok(checkBox && moreBox);
assert.equal(Math.round(checkBox.x), Math.round(moreBox.x));
assert.equal(Math.round(checkBox.width), Math.round(moreBox.width));
const openTab = currentRow.locator(".cw-project-open-tab");
const openTabBox = await openTab.boundingBox();
assert.ok(checkBox && moreBox && openTabBox);
assert.equal(Math.round(checkBox.x), Math.round(openTabBox.x));
assert.equal(Math.round(checkBox.width), Math.round(openTabBox.width));
assert.ok(Math.round(moreBox.x + moreBox.width) <= Math.round(openTabBox.x));
await currentRow.hover();
await page.waitForTimeout(250);
assert.equal(
Expand All @@ -129,6 +131,10 @@ try {
.evaluate((element) => getComputedStyle(element).opacity),
"1",
);
assert.equal(
await openTab.evaluate((element) => getComputedStyle(element).opacity),
"1",
);
assert.equal(
await page.getByRole("menuitem", { name: old.name, exact: true }).count(),
0,
Expand Down
12 changes: 11 additions & 1 deletion tests/browser/generation_feedback.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,24 @@ try {
dark,
light,
enabled: [...element.querySelectorAll("button:enabled")]
.filter((button) => button.getClientRects().length)
.filter(
(button) =>
button.getClientRects().length &&
button.getAttribute("aria-disabled") !== "true",
)
.map((button) => button.getAttribute("aria-label")),
};
});
assert.equal(locked.editable, "false");
assert.equal(locked.dark, "rgb(125, 130, 145)");
assert.equal(locked.light, "rgb(123, 130, 144)");
assert.deepEqual(locked.enabled, ["取消生成"]);
assert.equal(
await dock
.getByRole("button", { name: "提示词优化", exact: true })
.isDisabled(),
true,
);
assert.equal((await state()).jobs.length, 0);
hold.release();
await until(async () => (await state()).jobs.length === 1);
Expand Down
14 changes: 8 additions & 6 deletions tests/browser/subject_library.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -615,12 +615,14 @@ try {
.durationSeconds,
15,
);
assert.equal(
await node(fixture.blank)
.locator(".cw-subject-main img")
.evaluate((img) => img.complete && img.naturalWidth > 0),
true,
);
await page.locator(".cw-workspace").focus();
await page.keyboard.press("Shift+1");
await page.waitForFunction((id) => {
const img = document.querySelector(
`.react-flow__node[data-id="${id}"] .cw-subject-main img`,
);
return img?.complete && img.naturalWidth > 0;
}, fixture.blank);
console.log(
JSON.stringify({
mode: "unified",
Expand Down
7 changes: 5 additions & 2 deletions tests/browser/video_review_regressions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@ try {
);
assert.ok(task.outputs[0].durationMs > 0);
assert.equal(task.modelConfigIds["video.first_frame"], config.id);
await page
.locator(`.react-flow__node[data-id="${task.canvas.targetNodeId}"]`)
.waitFor();
await page.locator(".cw-workspace").focus();
await page.keyboard.press("Shift+1");
await page.waitForFunction((id) => {
const video = document.querySelector(
`.react-flow__node[data-id="${id}"] video.cw-video-preview`,
Expand All @@ -459,8 +464,6 @@ try {
video.duration > 0
);
}, task.canvas.targetNodeId);
await page.locator(".cw-workspace").focus();
await page.keyboard.press("Shift+1");
assert.deepEqual(errors, []);
if (process.env.CREATION_SCREENSHOTS) {
await mkdir(process.env.CREATION_SCREENSHOTS, { recursive: true });
Expand Down
Loading