unsloth/tests/studio
Daniel Han bbe53c68ef
studio/tests: make Playwright model-selector probe best-effort (#5371)
* studio/tests: make Playwright model-selector probe best-effort

The Mac Studio UI CI run 25664825320 / job 75334476211 failed at
playwright_chat_ui.py:483 with:

    playwright._impl._errors.TimeoutError:
      Locator.text_content: Timeout 60000ms exceeded.

Timeline from that job's log:
    11:40:51  [ui] OK default_models[0] = unsloth/gemma-4-E2B-it-GGUF
    11:41:51  TimeoutError (exactly 60 s later)

Root cause: count() and text_content() are two independent queries
against the live DOM. The chat surface re-mounts the model selector
while /api/models/list resolves the default-model badge, so the
button matches the OR-selector at count() time but is briefly
detached when text_content() re-queries. The page-wide default
action timeout was bumped to 60 s on line 177, so the informational
probe blocked for a full minute and then hard-failed.

The block is clearly best-effort: it is gated on if count() > 0 and
the only side effects are info(...) and shoot(...). Replace the
count-then-text dance with a single text_content(timeout=2_000)
inside a try/except, matching the pattern the rest of this file
already uses for networkidle, screenshot capture, and composer
wait. Happy path still prints the button text and snaps
03b-default-model-button; a miss now logs WARN and continues to the
/api/inference/load step.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-05-11 05:25:57 -07:00
..
install tests/studio/install: parallel UNSLOTH_STUDIO_HOME smoke test (#5306) 2026-05-07 02:26:58 -07:00
_playwright_robust.py CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
playwright_chat_ui.py studio/tests: make Playwright model-selector probe best-effort (#5371) 2026-05-11 05:25:57 -07:00
playwright_extra_ui.py CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
run_real_mlx_smoke.py CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
studio_api_smoke.py CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
test_cancel_atomicity.py Studio: make stop button actually stop generation (#5069) 2026-04-24 10:09:25 -07:00
test_cancel_id_wiring.py Studio: make stop button actually stop generation (#5069) 2026-04-24 10:09:25 -07:00
test_chat_preset_builtin_invariants.py Studio: Dark theme refactor, right sidebar redesign, and chat UI polish (#5150) 2026-05-07 14:33:31 +04:00
test_cli_repo_variant.py Studio: forward llama-server args from unsloth studio run , activate unsloth run , and allow passing model:quant to load models (#5271) 2026-05-04 17:08:04 +04:00
test_cli_run_alias.py Studio: forward llama-server args from unsloth studio run , activate unsloth run , and allow passing model:quant to load models (#5271) 2026-05-04 17:08:04 +04:00
test_cli_studio_defaults.py Default Studio host to 127.0.0.1 and prompt before auto-start (#5267) 2026-05-04 13:03:16 +04:00
test_export_output_path_contract.py feat(studio): MLX training tab on Apple Silicon (LoRA / full FT, VLM, export) (#5265) 2026-05-05 23:54:58 -07:00
test_hardware_dispatch_matrix.py CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
test_is_mlx_dispatch_gate.py feat(studio): MLX training tab on Apple Silicon (LoRA / full FT, VLM, export) (#5265) 2026-05-05 23:54:58 -07:00
test_llama_cpp_wall_clock_cap.py Studio: make stop button actually stop generation (#5069) 2026-04-24 10:09:25 -07:00
test_mlx_training_worker_behaviors.py feat(studio): MLX training tab on Apple Silicon (LoRA / full FT, VLM, export) (#5265) 2026-05-05 23:54:58 -07:00
test_stream_cancel_registration_timing.py Studio: make stop button actually stop generation (#5069) 2026-04-24 10:09:25 -07:00
test_studio_gguf_export_script_pin.py Pin Studio GGUF export to llama.cpp's local convert script (#5275) 2026-05-05 04:03:28 -07:00
test_studio_text_descender_clipping.py Studio: Fix clipped model selector text descenders (#5210) 2026-04-29 02:51:25 -07:00