Files
VoiceStudio/tests/test_electron_only_ui.py
Palash Debnath 4aa2cd27b6 Polish desktop setup, settings and studio workspaces (#4527)
* Polish desktop setup, settings and studio workspaces

* Add desktop refresh changelog entry

* Check home creation destinations in the desktop guard

* Align desktop workflow checks with the redesigned controls and restore paired consent choices

* Stabilize native window and titlebar checks during navigation

* Restore a continuous workspace background across desktop chrome

* Verify workspace and settings panel corners in the theme smoke

* Give Support a full-width donation panel and stack sponsor, Pro and contact sections

* Give sponsor marks room and simplify Support actions

* Organize Support contact actions in a responsive grid

* Fix desktop take navigation, drawer visibility and shortcut capture

* Recover desktop setup choices when local settings cannot be read or saved

* Welcome users with the studio cat and credit the open-source community

* Compare exact filesystem identities before claiming an existing terminal command

* Check visible setup controls and model headings and isolate Home credits
2026-11-29 08:57:06 +05:30

85 lines
3.4 KiB
Python

import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_tauri_shell_and_legacy_ui_entrypoints_are_removed():
assert not (ROOT / "frontend/src-tauri").exists()
assert not (ROOT / "frontend/src").exists()
assert not (ROOT / ".github/workflows/release.yml").exists()
for path in (
"frontend/index.html",
"electron/src/shared/main.jsx",
"electron/src/shared/main-app.jsx",
"electron/src/shared/App.jsx",
"scripts/desktop-dev.mjs",
"scripts/desktop-dev-launch.mjs",
"scripts/desktop-prod.sh",
"scripts/desktop-prod.mjs",
"scripts/desktop-fresh.mjs",
"scripts/capture-screenshots.cjs",
"scripts/package_for_friend.sh",
):
assert not (ROOT / path).exists(), f"retired Tauri entrypoint remains: {path}"
def test_supported_ui_commands_target_electron_only():
root_package = json.loads((ROOT / "package.json").read_text(encoding="utf-8"))
assert root_package["workspaces"] == ["electron"]
for command in ("dev", "desktop", "build", "build:web", "start", "test", "typecheck"):
assert "electron" in root_package["scripts"][command]
assert not (ROOT / "frontend/package.json").exists()
manifests = [ROOT / "package.json", ROOT / "electron/package.json"]
assert all("@tauri-apps/" not in path.read_text(encoding="utf-8") for path in manifests)
electron_package = json.loads((ROOT / "electron/package.json").read_text(encoding="utf-8"))
assert "vite.shared.config.ts" in electron_package["scripts"]["test"]
def test_docker_builds_the_electron_renderer():
dockerfile = (ROOT / "deploy/Dockerfile").read_text(encoding="utf-8")
assert "--cwd electron build:web" in dockerfile
assert "frontend/index.html" not in dockerfile
def test_macos_dev_launcher_uses_maintained_electron_paths():
launcher = (ROOT / "electron/scripts/dev.mjs").read_text(encoding="utf-8")
assert "join(repoRoot, 'package.json')" in launcher
assert "join(electronRoot, 'build', 'icons', 'icon.icns')" in launcher
assert "'frontend'" not in launcher
def test_home_keeps_creation_actions_with_open_source_heading():
home = (ROOT / "electron/src/renderer/src/features/home/home-page.tsx").read_text(
encoding="utf-8"
)
about = (ROOT / "electron/src/renderer/src/features/home/home-about.tsx").read_text(
encoding="utf-8"
)
assert "t('nav.home')" in home
assert "<HomeAbout" in home
assert "t('homeUi.title')" in about
assert "t('homeUi.subtitle')" in about
assert "<HomeContributors" in about
for route in ("/clone", "/design", "/dub"):
assert f"to: '{route}'" in home
assert "browser.open('https://voicestudio.sh')" in about
assert "PanelLeftOpenIcon" not in home
def test_install_smokes_build_the_pull_request_checkout_on_every_os():
workflow = (ROOT / ".github/workflows/install-smoke.yml").read_text(encoding="utf-8")
unix_step = workflow.split("- name: Build and install main (macOS/Linux)", 1)[1].split(
"- name: Verify and uninstall Electron (macOS/Linux)", 1
)[0]
assert 'if [ "$GITHUB_EVENT_NAME" = pull_request ]' in unix_step
assert '"$RUNNER_OS" = Linux' not in unix_step
windows_step = workflow.split("- name: Build and install main (Windows)", 1)[1]
assert "GITHUB_EVENT_NAME -eq 'pull_request'" in windows_step
assert "git push $bare HEAD:refs/heads/main" in windows_step
assert "url.file:///" in windows_step