Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Tool activity gate: wait for each card to open before reading it, not a fixed sleep (#17234)

Daniel Han43f8a886abc9
diff --git a/tests/studio/playwright_tool_activity.py b/tests/studio/playwright_tool_activity.py
index 386ec8a0f92..69cdc475f5e 100644
--- a/tests/studio/playwright_tool_activity.py
+++ b/tests/studio/playwright_tool_activity.py
@@ -78,6 +78,29 @@ def settle(page, ms: int = SETTLE_MS) -> None:
page.wait_for_timeout(ms)
+def click_open(
+ page,
+ name: str,
+ timeout_ms: int = 5_000,
+) -> None:
+ """Click a trigger and wait, bounded, until it reports open.
+
+ A fixed sleep after two back-to-back clicks lost the second one on a loaded runner: the first
+ card's 200ms expansion was still moving the second trigger. A card that never opens still fails,
+ because the caller reads aria-expanded afterwards.
+ """
+ selector = f'[data-probe="{name}-trigger"]'
+ page.click(selector)
+ try:
+ page.wait_for_function(
+ "(sel) => document.querySelector(sel)?.getAttribute('aria-expanded') === 'true'",
+ arg = selector,
+ timeout = timeout_ms,
+ )
+ except Exception: # noqa: BLE001 - the probe below records the failure
+ pass
+
+
def open_page(
page,
base_url: str,
@@ -143,8 +166,8 @@ def run(base_url: str, pw) -> dict:
p.append("2: the answer did not move up when activity collapsed")
# --- 3 manual expansion ----------------------------------------------
- page.click('[data-probe="controlled-trigger"]')
- page.click('[data-probe="uncontrolled-trigger"]')
+ click_open(page, "controlled")
+ click_open(page, "uncontrolled")
settle(page)
after_expand = probe(page)
page.evaluate("() => window.__setHasText(true)")