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. 提示词导演

同步背景状态与重渲染后再验收

MigenAI6581d9670d2f
diff --git a/test/library_132_e2e.py b/test/library_132_e2e.py
index d70dc50..2aef486 100644
--- a/test/library_132_e2e.py
+++ b/test/library_132_e2e.py
@@ -20,6 +20,18 @@ def wait_for_initial_gallery_batch(page, total: int) -> int:
return count
+def save_pending_classification(page) -> None:
+ page.locator(".pending-classification-inline select").select_option("content:image-case")
+ page.evaluate(
+ """() => new Promise(resolve => requestAnimationFrame(
+ () => requestAnimationFrame(resolve)
+ ))"""
+ )
+ button = page.locator(".pending-classification-inline button")
+ expect(button).to_be_enabled()
+ button.click()
+
+
def make_entries() -> list[dict]:
entries = []
for index in range(100):
@@ -303,8 +315,7 @@ def main() -> None:
library.evaluate("scrollTo(0, 0)")
library.locator(".case-card[data-entry-id='pending-2']").click()
- library.locator(".pending-classification-inline select").select_option("content:image-case")
- library.locator(".pending-classification-inline button").click()
+ save_pending_classification(library)
expect(library.locator("#detail-drawer")).to_have_attribute("data-entry-id", "pending-2")
expect(library.locator("#detail-drawer")).to_have_class("detail-drawer open")
library.locator("#detail-close").click()
@@ -314,12 +325,10 @@ def main() -> None:
expect(library.locator(".pending-classification-inline")).to_be_visible()
library.screenshot(path="/tmp/prompt-director-132-pending-inline.png")
first_id = library.locator("#detail-drawer").get_attribute("data-entry-id")
- library.locator(".pending-classification-inline select").select_option("content:image-case")
- library.locator(".pending-classification-inline button").click()
+ save_pending_classification(library)
expect(library.locator("#detail-drawer")).not_to_have_attribute("data-entry-id", first_id)
expect(library.locator(".pending-classification-inline")).to_be_visible()
- library.locator(".pending-classification-inline select").select_option("content:image-case")
- library.locator(".pending-classification-inline button").click()
+ save_pending_classification(library)
expect(library.locator("#detail-drawer")).not_to_have_class("open")
expect(library.locator("#feedback")).to_contain_text("待确认已处理完")
diff --git a/test/manual_sync_e2e.py b/test/manual_sync_e2e.py
index 8dbd41c..ae21a5f 100644
--- a/test/manual_sync_e2e.py
+++ b/test/manual_sync_e2e.py
@@ -46,6 +46,10 @@ def main() -> None:
});
}"""
)
+ setup.wait_for_function(
+ """() => chrome.runtime.sendMessage({type: 'GET_STATE'})
+ .then(state => state.entries?.some(entry => entry.id === 'sync-case'))"""
+ )
first = setup.evaluate("async () => chrome.runtime.sendMessage({type: 'SYNC_NOW'})")
assert first["ok"] is True and first["upToDate"] is False, first