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

统一跨平台浏览器验收合同

MigenAI4da204d3eaf4
diff --git a/test/ai_provider_registry_e2e.py b/test/ai_provider_registry_e2e.py
index 571a517..f28e78e 100644
--- a/test/ai_provider_registry_e2e.py
+++ b/test/ai_provider_registry_e2e.py
@@ -174,7 +174,8 @@ def assert_deepseek_dynamic_image_analysis() -> None:
"pageErrors": run.page_errors,
"loadingText": library.locator("#library-loading").text_content(),
}
- library.locator("#open-settings").click()
+ if not library.locator("#settings-dialog").is_visible():
+ library.locator("#open-settings").click()
library.locator('[data-settings-tab="ai"]').click()
library.locator('[data-ai-routing-tab="providers"]').click()
deepseek_row = library.locator('[data-provider-id="deepseek"]')
diff --git a/test/creative_feedback_e2e.py b/test/creative_feedback_e2e.py
index 9e8716c..015ef50 100644
--- a/test/creative_feedback_e2e.py
+++ b/test/creative_feedback_e2e.py
@@ -5,6 +5,8 @@ from pathlib import Path
from playwright.sync_api import expect, sync_playwright
+from e2e_support import launch_context
+
EXTENSION_DIR = Path(__file__).resolve().parents[1]
@@ -13,16 +15,11 @@ def main() -> None:
screenshots = Path(tempfile.gettempdir())
with tempfile.TemporaryDirectory(prefix="prompt-director-feedback-") as profile_dir:
with sync_playwright() as playwright:
- context = playwright.chromium.launch_persistent_context(
- profile_dir,
- headless=True,
- channel="chromium",
+ context = launch_context(
+ playwright, profile_dir,
viewport={"width": 390, "height": 844},
- permissions=["clipboard-read", "clipboard-write"],
- args=[
- f"--disable-extensions-except={EXTENSION_DIR}",
- f"--load-extension={EXTENSION_DIR}",
- ],
+ accept_downloads=True,
+ extension_dir=EXTENSION_DIR,
)
try:
worker = context.service_workers[0] if context.service_workers else context.wait_for_event("serviceworker")
diff --git a/test/large_library_e2e.py b/test/large_library_e2e.py
index ff14334..7efa64d 100644
--- a/test/large_library_e2e.py
+++ b/test/large_library_e2e.py
@@ -7,6 +7,8 @@ from pathlib import Path
from playwright.sync_api import TimeoutError as PlaywrightTimeoutError, sync_playwright
+from e2e_support import launch_context
+
EXTENSION_DIR = Path(__file__).resolve().parents[1]
@@ -14,15 +16,11 @@ EXTENSION_DIR = Path(__file__).resolve().parents[1]
def main() -> None:
with tempfile.TemporaryDirectory(prefix="prompt-director-large-") as profile_dir:
with sync_playwright() as playwright:
- context = playwright.chromium.launch_persistent_context(
- profile_dir,
- headless=True,
- channel="chromium",
+ context = launch_context(
+ playwright, profile_dir,
viewport={"width": 1666, "height": 900},
- args=[
- f"--disable-extensions-except={EXTENSION_DIR}",
- f"--load-extension={EXTENSION_DIR}",
- ],
+ accept_downloads=True,
+ extension_dir=EXTENSION_DIR,
)
try:
worker = context.service_workers[0] if context.service_workers else context.wait_for_event("serviceworker")
@@ -179,9 +177,19 @@ def main() -> None:
style_facet = library.locator('.facet-filter[data-facet-id="style"]')
style_facet.locator("summary").click()
style_category = style_facet.locator('[data-facet-node-id="style.render"]')
- started = time.perf_counter()
- style_category.click()
- tag_filter_ms = round((time.perf_counter() - started) * 1000)
+ style_category.wait_for(state="visible")
+ tag_filter_ms = round(library.evaluate(
+ """async () => {
+ const button = document.querySelector('[data-facet-node-id="style.render"]');
+ const result = document.querySelector('#result-count');
+ const started = performance.now();
+ button.click();
+ while (button.getAttribute('aria-pressed') !== 'true' || !result.textContent.includes('6500')) {
+ await new Promise(resolve => requestAnimationFrame(resolve));
+ }
+ return performance.now() - started;
+ }"""
+ ))
assert style_category.get_attribute("aria-pressed") == "true"
assert "6500" in library.locator("#result-count").inner_text()
assert tag_filter_ms < 250, f"6500-case tag category switch took {tag_filter_ms}ms"
diff --git a/test/library-thumbnail-rebind-e2e.py b/test/library-thumbnail-rebind-e2e.py
index 1dfb748..0c06967 100644
--- a/test/library-thumbnail-rebind-e2e.py
+++ b/test/library-thumbnail-rebind-e2e.py
@@ -6,6 +6,8 @@ from pathlib import Path
from playwright.sync_api import sync_playwright
+from e2e_support import launch_context
+
EXTENSION_DIR = Path(__file__).resolve().parents[1]
TINY_PNG = base64.b64decode(
@@ -53,9 +55,11 @@ def scroll_through_gallery(page) -> None:
def main() -> None:
with tempfile.TemporaryDirectory(prefix="promptdirector-thumbnail-rebind-") as profile:
with sync_playwright() as playwright:
- context = playwright.chromium.launch_persistent_context(
- profile, headless=True, channel="chromium", viewport={"width": 1440, "height": 900},
- args=[f"--disable-extensions-except={EXTENSION_DIR}", f"--load-extension={EXTENSION_DIR}"]
+ context = launch_context(
+ playwright, profile,
+ viewport={"width": 1440, "height": 900},
+ accept_downloads=True,
+ extension_dir=EXTENSION_DIR,
)
try:
worker = context.service_workers[0] if context.service_workers else context.wait_for_event("serviceworker")
diff --git a/test/library_132_e2e.py b/test/library_132_e2e.py
index a2f0245..d70dc50 100644
--- a/test/library_132_e2e.py
+++ b/test/library_132_e2e.py
@@ -5,6 +5,8 @@ from pathlib import Path
from playwright.sync_api import TimeoutError as PlaywrightTimeoutError, expect, sync_playwright
+from e2e_support import launch_context
+
EXTENSION_DIR = Path(__file__).resolve().parents[1]
INITIAL_BATCH_SIZE = 24
@@ -58,15 +60,11 @@ def make_entries() -> list[dict]:
def main() -> None:
with tempfile.TemporaryDirectory(prefix="prompt-director-132-") as profile_dir:
with sync_playwright() as playwright:
- context = playwright.chromium.launch_persistent_context(
- profile_dir,
- headless=True,
- channel="chromium",
+ context = launch_context(
+ playwright, profile_dir,
viewport={"width": 1280, "height": 900},
- args=[
- f"--disable-extensions-except={EXTENSION_DIR}",
- f"--load-extension={EXTENSION_DIR}",
- ],
+ accept_downloads=True,
+ extension_dir=EXTENSION_DIR,
)
try:
worker = context.service_workers[0] if context.service_workers else context.wait_for_event("serviceworker")
diff --git a/test/manager_regression_e2e.py b/test/manager_regression_e2e.py
index fc688b6..36ee98e 100644
--- a/test/manager_regression_e2e.py
+++ b/test/manager_regression_e2e.py
@@ -6,6 +6,8 @@ from pathlib import Path
from playwright.sync_api import expect, sync_playwright
+from e2e_support import launch_context
+
EXTENSION_DIR = Path(__file__).resolve().parents[1]
NODE_COUNT = int(os.environ.get("MANAGER_NODE_COUNT", "275"))
@@ -14,15 +16,11 @@ NODE_COUNT = int(os.environ.get("MANAGER_NODE_COUNT", "275"))
def main() -> None:
with tempfile.TemporaryDirectory(prefix="prompt-manager-regression-") as profile_dir:
with sync_playwright() as playwright:
- context = playwright.chromium.launch_persistent_context(
- profile_dir,
- headless=True,
- channel="chromium",
+ context = launch_context(
+ playwright, profile_dir,
viewport={"width": 1280, "height": 800},
- args=[
- f"--disable-extensions-except={EXTENSION_DIR}",
- f"--load-extension={EXTENSION_DIR}",
- ],
+ accept_downloads=True,
+ extension_dir=EXTENSION_DIR,
)
try:
worker = context.service_workers[0] if context.service_workers else context.wait_for_event("serviceworker")
diff --git a/test/projects_and_categories_e2e.py b/test/projects_and_categories_e2e.py
index 4784549..06bbb16 100644
--- a/test/projects_and_categories_e2e.py
+++ b/test/projects_and_categories_e2e.py
@@ -38,6 +38,7 @@ def main() -> None:
},
)
library = session.open_page("library.html", wait_until="networkidle")
+ expect(library.locator("body")).to_have_attribute("data-library-state", "ready")
expect(library.locator(".project-row.project-ordering")).to_have_count(0)
long_name = library.locator(".project-filter-name", has_text="完整长项目名称")
expect(long_name).to_be_visible()
diff --git a/test/ui_regressions_e2e.py b/test/ui_regressions_e2e.py
index 570985d..1a8608f 100644
--- a/test/ui_regressions_e2e.py
+++ b/test/ui_regressions_e2e.py
@@ -69,6 +69,7 @@ def main() -> None:
)
library = session.open_page("library.html", wait_until="networkidle")
+ expect(library.locator("body")).to_have_attribute("data-library-state", "ready")
expect(library.locator("#case-list > .case-card")).to_have_count(2)
assert library.locator("#import-candidates").count() == 0
assert library.get_by_text("高级工具", exact=True).count() == 0