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.

Studio UI test: drive the sandbox level picker that replaced the menu switch (#12866)

Daniel Han3a8c92af6cbc
diff --git a/tests/studio/playwright_chat_ui.py b/tests/studio/playwright_chat_ui.py
index 5363890ec3c..0debbfe7151 100644
--- a/tests/studio/playwright_chat_ui.py
+++ b/tests/studio/playwright_chat_ui.py
@@ -274,6 +274,15 @@ def exercise_permission_mode_controls(page, shoot):
expect(item).to_be_visible()
item.click()
+ def pick_sandbox_level(menu, current, target):
+ # The "Sandbox <level>" chip in the permission menu opens a level picker beside the menu.
+ chip = menu.get_by_role("menuitem", name = re.compile(r"^Sandbox"))
+ expect(chip).to_contain_text(current)
+ chip.click()
+ picker = page.get_by_role("menu").filter(has_text = "How should code be sandboxed?")
+ expect(picker).to_be_visible()
+ picker.get_by_role("menuitem", name = re.compile(rf"^{target}")).click()
+
# Every caller reloads straight after this, and the page being left can still write the level
# back in between: a hydrating GET of its own lands after the clear and caches the installation's
# level locally. On WebKit that page stayed alive about a second after the clear and its GET came
@@ -545,8 +554,8 @@ def exercise_permission_mode_controls(page, shoot):
reload_and_wait_for_pill()
expect_mode("Run automatically")
- # Without a sandbox: Run automatically applies at once, the Sandbox switch reads Low, and sliding it
- # to High opens the install popup, whose "Use Low sandbox" keeps Low.
+ # Without a sandbox: Run automatically applies at once, the Sandbox chip reads Low, and picking
+ # High in its level picker opens the install popup, whose "Use Low sandbox" keeps Low.
choose("Approve for me")
expect_mode("Approve for me")
# Landed on the install first, or the reload hydrates the previous "off" back.
@@ -567,10 +576,7 @@ def exercise_permission_mode_controls(page, shoot):
expect(menu.get_by_text("Permissions", exact = True)).to_be_visible()
if menu.get_by_text("OS sandbox not available").count() != 0:
fail("the Run automatically row still carries the 'OS sandbox not available' hint")
- switch = menu.get_by_role("menuitemcheckbox")
- expect(switch).to_have_attribute("aria-checked", "false")
- expect(switch).to_contain_text("Low")
- switch.click()
+ pick_sandbox_level(menu, current = "Low", target = "High")
setup = page.get_by_role("alertdialog")
expect(setup.get_by_role("heading", name = "OS sandbox is not available")).to_be_visible()
# The command rides on Copy command (and Settings > Sandbox), not as a block of text in the popup.
@@ -591,10 +597,10 @@ def exercise_permission_mode_controls(page, shoot):
expect_server_mode("low", key = "sandboxLevel")
sandbox_answer["ready"] = True
reload_and_wait_for_pill()
- # With a working sandbox the switch turns High again, and stays High for the next browser's run.
- switch = open_menu().get_by_role("menuitemcheckbox")
- expect(switch).to_contain_text("Low")
- switch.click()
+ # With a working sandbox picking High applies it at once, and it stays High for the next browser's run.
+ pick_sandbox_level(open_menu(), current = "Low", target = "High")
+ if page.get_by_role("alertdialog").count() != 0:
+ fail("picking High with a working sandbox opened the setup popup")
page.wait_for_function("() => localStorage.getItem('unsloth_chat_sandbox_level') === 'high'")
page.keyboard.press("Escape")
expect_server_mode("high", key = "sandboxLevel")