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
Wait for the Unsloth-managed folder label in the project folders browser smoke (#14542)
Daniel Hanee98841ad19d
diff --git a/tests/studio/playwright_project_folders.py b/tests/studio/playwright_project_folders.pyindex f03b3ffcbbe..f4139354bc3 100644--- a/tests/studio/playwright_project_folders.py+++ b/tests/studio/playwright_project_folders.py@@ -25,6 +25,7 @@ parser.add_argument("--before-url")parser.add_argument("--out", type = Path, default = Path("work/project-folders-review"))ARGS = parser.parse_args()OUT = ARGS.out.resolve()+MANAGED_FOLDER = "Unsloth-managed folder" # working-folder-picker.tsx with no folder setasync def scene(@@ -171,17 +172,13 @@ async def scene(await page.wait_for_function("typeof window.__resolvePick === 'function'")await page.evaluate("window.__resolvePick(null)")if cancel or pending:- await expect(- dialog.get_by_text("Studio-managed folder", exact = True)- ).to_be_visible()+ await expect(dialog.get_by_text(MANAGED_FOLDER, exact = True)).to_be_visible()await expect(choose).to_be_enabled()else:await expect(dialog.get_by_text("Existing project", exact = True)).to_be_visible()if reset:await dialog.get_by_role("button", name = "Use managed folder", exact = True).click()- await expect(- dialog.get_by_text("Studio-managed folder", exact = True)- ).to_be_visible()+ await expect(dialog.get_by_text(MANAGED_FOLDER, exact = True)).to_be_visible()if narrow:assert await page.evaluate("document.documentElement.scrollWidth <= innerWidth")await page.screenshot(path = str(OUT / f"{label}-selected.png"), animations = "disabled")@@ -269,14 +266,10 @@ async def scene(dialog.get_by_text("/review/alternate-project", exact = True)).to_be_visible()await dialog.get_by_role("button", name = "Use managed folder", exact = True).click()- await expect(- dialog.get_by_text("Studio-managed folder", exact = True)- ).to_be_visible()+ await expect(dialog.get_by_text(MANAGED_FOLDER, exact = True)).to_be_visible()await dialog.get_by_role("button", name = "Cancel", exact = True).click()await page.get_by_role("button", name = "Edit project", exact = True).click()- await expect(- dialog.get_by_text("Studio-managed folder", exact = True)- ).to_be_visible()+ await expect(dialog.get_by_text(MANAGED_FOLDER, exact = True)).to_be_visible()assert [r["method"] for r in folder_requests] == ["PUT", "PUT", "DELETE"]else:if mode in ("unsupported", "guest"):diff --git a/tests/studio/test_playwright_brand_labels.py b/tests/studio/test_playwright_brand_labels.pynew file mode 100644index 00000000000..29071ad40fe--- /dev/null+++ b/tests/studio/test_playwright_brand_labels.py@@ -0,0 +1,96 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++"""Branded labels the Playwright drivers wait for still exist in the app.++#14473 renamed "Studio-managed folder" to "Unsloth-managed folder" in the working folder picker, and+playwright_project_folders.py kept waiting for the old text, so the browser smoke failed on every PR+that ran it. A rename is caught here, in seconds, instead of in a browser job.+"""++import ast+import functools+import subprocess+from pathlib import Path++import pytest++REPO = Path(__file__).resolve().parents[2]+DRIVERS = sorted((REPO / "tests" / "studio").glob("playwright_*.py"))+BRANDS = ("Unsloth", "Studio")+LOCATORS = {"get_by_text", "get_by_label", "get_by_placeholder", "get_by_title"}+++def _app_text():+ out = subprocess.run(+ [+ "git",+ "grep",+ "-h",+ "-I",+ "-e",+ "Unsloth",+ "-e",+ "Studio",+ "--",+ "studio/frontend/src",+ "studio/backend",+ ],+ cwd = REPO,+ capture_output = True,+ text = True,+ check = True,+ )+ return out.stdout+++def _constants(tree):+ names = {}+ for node in tree.body:+ if isinstance(node, ast.Assign) and isinstance(node.value, ast.Constant):+ for target in node.targets:+ if isinstance(target, ast.Name) and isinstance(node.value.value, str):+ names[target.id] = node.value.value+ return names+++def _branded_labels(path):+ tree = ast.parse(path.read_text(encoding = "utf-8"))+ names = _constants(tree)++ def literal(node):+ if isinstance(node, ast.Constant) and isinstance(node.value, str):+ return node.value+ if isinstance(node, ast.Name):+ return names.get(node.id)+ return None++ for node in ast.walk(tree):+ if not isinstance(node, ast.Call) or not isinstance(node.func, ast.Attribute):+ continue+ values = []+ if node.func.attr in LOCATORS and node.args:+ values.append(literal(node.args[0]))+ if node.func.attr == "get_by_role":+ values += [literal(k.value) for k in node.keywords if k.arg == "name"]+ for value in values:+ if value and any(brand in value for brand in BRANDS):+ yield node.lineno, value+++def test_the_scan_sees_the_drivers():+ assert DRIVERS, "no tests/studio/playwright_*.py drivers found; update this guard"+ found = [label for path in DRIVERS for _, label in _branded_labels(path)]+ assert "Unsloth-managed folder" in found++[email protected]("driver", DRIVERS, ids = lambda p: p.name)+def test_branded_labels_exist_in_the_app(driver):+ app = _app_text()+ missing = [+ f"{driver.name}:{line} {label!r}"+ for line, label in _branded_labels(driver)+ if label not in app+ ]+ assert not missing, "Playwright waits for text the app no longer renders: " + ", ".join(missing)