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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio tests: chat width driver picks the presets by position, not by their copy (#16431)
Daniel Han681111a2e2a0
diff --git a/tests/studio/playwright_chat_width.py b/tests/studio/playwright_chat_width.pyindex f9bd4b64406..0e4dbe9226f 100644--- a/tests/studio/playwright_chat_width.py+++ b/tests/studio/playwright_chat_width.py@@ -140,17 +140,23 @@ def seed_thread(page, token):return thread_id+# The order appearance-custom-controls.tsx lists the chat width values in (standard, wide, full);+# test_chat_width_driver_presets.py keeps the two in step. The names are only this driver's labels.+CHAT_WIDTH_PRESETS = ("Standard", "Wide", "Full width")++def check_widths(page):"""Full must preserve the space available in Wide, including narrow panes."""thread_url = page.urlmeasurements = {}- for preset in ("Standard", "Wide", "Full width"):+ for index, preset in enumerate(CHAT_WIDTH_PRESETS):step(f"measure the {preset!r} preset across 7 viewports")page.set_viewport_size({"width": 1440, "height": 900})page.keyboard.press("Control+,")page.get_by_role("dialog").get_by_role("button", name = "Appearance", exact = True).click()page.get_by_role("combobox", name = "Chat width").click()- page.get_by_role("option", name = preset, exact = True).click()+ # By position, not label: the option text is copy (#16408 renamed Standard to Default).+ page.get_by_role("listbox").get_by_role("option").nth(index).click()page.keyboard.press("Escape")measurements[preset] = {}for width in (390, 768, 900, 1280, 1536, 1920, 2560):diff --git a/tests/studio/test_chat_width_driver_presets.py b/tests/studio/test_chat_width_driver_presets.pynew file mode 100644index 00000000000..d2fb9a038c2--- /dev/null+++ b/tests/studio/test_chat_width_driver_presets.py@@ -0,0 +1,48 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.++"""playwright_chat_width.py picks the chat width options by position, so the component's value order is its contract."""++from __future__ import annotations++import ast+import re+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+COMPONENT = (+ ROOT+ / "studio"+ / "frontend"+ / "src"+ / "features"+ / "settings"+ / "components"+ / "appearance-custom-controls.tsx"+)+DRIVER = Path(__file__).resolve().parent / "playwright_chat_width.py"+++def _component_order():+ source = COMPONENT.read_text(encoding = "utf-8")+ found = re.findall(r"\(\[([^\]]*)\] as const\)\.map\(\(width\)", source)+ assert (+ len(found) == 1+ ), "the chat width options are no longer one `[...] as const` map over `width`"+ return tuple(part.strip().strip("\"'") for part in found[0].split(","))+++def _driver_presets():+ tree = ast.parse(DRIVER.read_text(encoding = "utf-8"))+ for node in tree.body:+ if isinstance(node, ast.Assign) and any(+ isinstance(target, ast.Name) and target.id == "CHAT_WIDTH_PRESETS"+ for target in node.targets+ ):+ return ast.literal_eval(node.value)+ raise AssertionError("CHAT_WIDTH_PRESETS is gone from playwright_chat_width.py")+++def test_the_driver_presets_follow_the_component_order():+ assert _component_order() == ("standard", "wide", "full")+ assert len(_driver_presets()) == len(_component_order())