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.

Tests: follow the localized update banners from #16069 (#16090)

Daniel Han754bd217dcb1
diff --git a/tests/studio/playwright_update_banner_layout.py b/tests/studio/playwright_update_banner_layout.py
index f19dfafda51..ec515a8737e 100644
--- a/tests/studio/playwright_update_banner_layout.py
+++ b/tests/studio/playwright_update_banner_layout.py
@@ -7,6 +7,7 @@ from __future__ import annotations
import json
import os
+import re
import sys
import time
import urllib.error
@@ -1272,7 +1273,8 @@ def main() -> int:
check(
f"{width}x{height}: three pending runtimes share the one card",
page.locator('[data-testid="llama-update-banner"]').count() == 1
- and "llama.cpp, whisper.cpp and audio.cpp" in summary,
+ # Intl.ListFormat joins the names, so English carries a serial comma.
+ and re.search(r"llama\.cpp, whisper\.cpp,? and audio\.cpp", summary) is not None,
f"summary={summary!r}",
)
exercise_llama_changelog(page, f"{width}x{height} bundle")
diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.py
index e4d10cd62dd..970ca50cee6 100644
--- a/tests/studio/test_desktop_reliability_frontend_contract.py
+++ b/tests/studio/test_desktop_reliability_frontend_contract.py
@@ -6,6 +6,7 @@
import functools
import re
from pathlib import Path
+from tests.studio._en_catalog import en_string
from tests.studio._js_source import (
attribute_expressions,
binding_joining,
@@ -696,6 +697,24 @@ def _new_chat_button_class_tokens(chat_page: str) -> list[str]:
return match.group(1).split()
+def _aria_label_count(source: str, label: str) -> int:
+ """aria-labels reading `label`, written literally or as a t("key") call en.ts maps to it."""
+ count = source.count(f'aria-label="{label}"')
+ for call in re.finditer(r"""aria-label=\{t\(\s*["']([\w.]+)["']\s*\)\}""", source):
+ try:
+ count += en_string(call.group(1)) == label
+ except (KeyError, ValueError):
+ continue
+ return count
+
+
+def test_aria_labels_are_counted_literally_and_through_the_catalog():
+ both = 'aria-label="Go back" aria-label={t("desktopShell.goBack")} aria-label={t("desktopShell.goForward")}'
+ assert _aria_label_count(both, "Go back") == 2
+ assert _aria_label_count(both, "Go forward") == 1
+ assert _aria_label_count('aria-label={t("no.such.key")}', "Go back") == 0
+
+
def test_collapsed_tauri_keeps_history_arrows_and_adds_new_chat_by_model_picker():
titlebar = _ui_source(TITLEBAR)
chat_page = _ui_source(CHAT_PAGE)
@@ -704,8 +723,8 @@ def test_collapsed_tauri_keeps_history_arrows_and_adds_new_chat_by_model_picker(
)[0]
assert "{expanded && (" not in navigation
- assert navigation.count('aria-label="Go back"') == 1
- assert navigation.count('aria-label="Go forward"') == 1
+ assert _aria_label_count(navigation, "Go back") == 1
+ assert _aria_label_count(navigation, "Go forward") == 1
assert "inline-flex size-[30px] shrink-0" in navigation
diff --git a/tests/studio/test_update_release_notes.py b/tests/studio/test_update_release_notes.py
index 04da52569a4..93f84a5f3bc 100644
--- a/tests/studio/test_update_release_notes.py
+++ b/tests/studio/test_update_release_notes.py
@@ -17,6 +17,7 @@ from dataclasses import dataclass
from pathlib import Path
import pytest
+from _en_catalog import en_string
from growth import assert_linear # tests/_shared, on sys.path via tests/conftest.py
REPO = Path(__file__).resolve().parents[2]
@@ -937,11 +938,33 @@ def test_update_popups_share_the_notes_width(banner):
assert "400px" not in _max_widths(llama)
+def _shown_at(src: str, label: str) -> int:
+ """Where a banner renders `label`: as literal English, or as a t("key") call en.ts maps to it."""
+ if label in src:
+ return src.index(label)
+ for call in re.finditer(r"""\bt\(\s*["']([\w.]+)["']\s*\)""", src):
+ try:
+ if en_string(call.group(1)) == label:
+ return call.start()
+ except (KeyError, ValueError):
+ continue
+ raise ValueError(f"the banner renders {label!r} neither literally nor through t()")
+
+
+def test_a_label_is_found_literally_or_through_the_catalog():
+ assert _shown_at("<b>Show release notes</b>", "Show release notes") == 3
+ key = 'x {t("desktopUpdate.banner.showNotes")}'
+ assert _shown_at(key, "Show release notes") == key.index("t(")
+ with pytest.raises(ValueError):
+ _shown_at('{t("desktopUpdate.banner.later")}', "Remind me later")
+
+
@pytest.mark.parametrize("banner", [WEB_BANNER, TAURI_BANNER])
def test_banners_toggle_inline_release_notes(banner):
src = banner.read_text(encoding = "utf-8")
assert "ReleaseNotesPanel" in src
- assert "Show release notes" in src and "Hide release notes" in src
+ _shown_at(src, "Show release notes")
+ _shown_at(src, "Hide release notes")
assert "notesVersion" in src
@@ -956,7 +979,7 @@ def test_notes_toggle_shares_the_action_row(banner, toggle, action):
"""The toggle sits in the same row as the actions, not on its own line."""
src = banner.read_text(encoding = "utf-8")
row = src.index("mt-4 flex")
- assert row < src.index(toggle) < src.index(action)
+ assert row < src.index(toggle) < _shown_at(src, action)
toggle_line = next(line for line in src.splitlines() if toggle in line)
toggle_block = src[src.index("Button", row) : src.index(toggle_line)]
assert "text-ui-13" in toggle_block and "whitespace-nowrap" in toggle_block