Skip to content

Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演

test(release): align capture assertions with the approved compact sidebar

MigenAI4957fef2fb40
diff --git a/test/creative_feedback_e2e.py b/test/creative_feedback_e2e.py
index 015ef50..d5970c4 100644
--- a/test/creative_feedback_e2e.py
+++ b/test/creative_feedback_e2e.py
@@ -73,29 +73,31 @@ def main() -> None:
expect(collector.locator("#result-start")).to_be_hidden()
expect(collector.locator("#normal-start")).to_be_visible()
expect(collector.locator("#normal-start .start-copy")).to_have_count(0)
- expect(collector.locator("#start-smart-visuals")).to_have_text("智能选图")
- expect(collector.locator("#start-selection")).to_have_text("提取文字/图片")
- expect(collector.locator("#start-screenshot")).to_have_text("框选截图")
+ expect(collector.locator("#start-smart-visuals")).to_have_text("选图")
+ expect(collector.locator("#start-selection")).to_have_text("选区")
+ expect(collector.locator("#start-screenshot")).to_have_text("截图")
+ expect(collector.locator("#start-clipboard")).to_have_text("剪贴板")
normal_geometry = collector.evaluate(
- """() => {
- const smart = document.querySelector('#start-smart-visuals').getBoundingClientRect();
- const text = document.querySelector('#start-selection').getBoundingClientRect();
- const backup = document.querySelector('#start-screenshot').getBoundingClientRect();
- return {
- pageWidth: document.documentElement.scrollWidth,
- smart: {height: smart.height, top: smart.top, right: smart.right},
- text: {height: text.height, top: text.top, right: text.right},
- backup: {height: backup.height, top: backup.top, right: backup.right},
- };
- }"""
+ """() => ({
+ pageWidth: document.documentElement.scrollWidth,
+ actions: ['start-smart-visuals', 'start-selection', 'start-clipboard', 'start-screenshot'].map(id => {
+ const button = document.getElementById(id);
+ const rect = button.getBoundingClientRect();
+ const label = button.querySelector('strong');
+ return {id, height: rect.height, width: rect.width, top: rect.top, right: rect.right,
+ labelHeight: label.getBoundingClientRect().height,
+ lineHeight: parseFloat(getComputedStyle(label).lineHeight)};
+ })
+ })"""
)
assert normal_geometry["pageWidth"] == 390
- assert normal_geometry["smart"]["height"] == 58
- assert normal_geometry["text"]["height"] == 58
- assert normal_geometry["text"]["top"] >= normal_geometry["smart"]["top"] + normal_geometry["smart"]["height"]
- assert normal_geometry["backup"]["height"] == 30, normal_geometry
- assert normal_geometry["backup"]["top"] >= normal_geometry["text"]["top"] + normal_geometry["text"]["height"]
- assert max(normal_geometry[key]["right"] for key in ("smart", "text", "backup")) <= 390
+ first = normal_geometry["actions"][0]
+ for action in normal_geometry["actions"]:
+ assert action["height"] == first["height"] > 0, normal_geometry
+ assert abs(action["width"] - first["width"]) < 1, normal_geometry
+ assert action["top"] == first["top"], normal_geometry
+ assert action["right"] <= 390, normal_geometry
+ assert action["labelHeight"] <= action["lineHeight"] + 1, normal_geometry
collector.screenshot(path=str(screenshots / "promptdirector-step5-collector-normal.png"), full_page=True)
add_result_button = composer.locator(".composer-message.prompt").get_by_role("button", name="添加生成图片")
diff --git a/test/higgsfield_capture_e2e.py b/test/higgsfield_capture_e2e.py
index 233aefa..c0b1461 100644
--- a/test/higgsfield_capture_e2e.py
+++ b/test/higgsfield_capture_e2e.py
@@ -153,7 +153,7 @@ def main():
source.goto(PROJECT, wait_until='networkidle')
source.bring_to_front()
collector.evaluate("() => document.querySelector('#start-page-capture').click()")
- collector.wait_for_function("() => document.querySelector('#page-capture-title').textContent.includes('正在读取')")
+ collector.wait_for_function("() => document.querySelector('#page-capture-cancel').textContent === '停止扫描' && !document.querySelector('#page-capture-cancel').disabled")
assert collector.locator('#page-capture-list-setup').is_hidden()
collector.evaluate("() => document.querySelector('#page-capture-cancel').click()")
collector.wait_for_function("() => !document.querySelector('#page-capture-help').textContent.includes('正在扫描')", timeout=3000)
diff --git a/test/material_management_regressions_e2e.py b/test/material_management_regressions_e2e.py
index 7818028..8fa07bf 100644
--- a/test/material_management_regressions_e2e.py
+++ b/test/material_management_regressions_e2e.py
@@ -21,7 +21,7 @@ def main() -> None:
collector.reload(wait_until="networkidle")
collector.locator("#organize-toggle").click()
expect(collector.locator("#capture-metadata")).to_be_visible()
- expect(collector.locator("#capture-metadata")).to_contain_text("添加标签")
+ expect(collector.locator("#capture-metadata")).to_contain_text("标签")
expect(collector.locator("#capture-metadata")).not_to_contain_text("自由标签")
tag_input = collector.locator("#custom-labels .tag-editor input")