main
py 74 lines 2.85 KB
Raw
1 from pathlib import Path
2
3
4 PROJECT_ROOT = Path(__file__).resolve().parents[1]
5 WHATS_NEW_PLUGIN = PROJECT_ROOT / "plugins/_whats_new"
6
7
8 def test_whats_new_modal_handles_empty_showcase_state():
9 html = (WHATS_NEW_PLUGIN / "webui/main.html").read_text(encoding="utf-8")
10 store = (WHATS_NEW_PLUGIN / "webui/whats-new-store.js").read_text(encoding="utf-8")
11 slide_data = (WHATS_NEW_PLUGIN / "webui/whats-new-slides.js").read_text(
12 encoding="utf-8"
13 )
14
15 assert "What's New in Agent Zero" in html
16 assert "data-modal-footer" in html
17 assert "btn btn-ok" in html
18 assert "btn btn-field" in html
19 assert "type=\"checkbox\"" in html
20 assert "Don't show automatically again" in html
21 assert "/plugins/_whats_new/webui/whats-new-store.js" in html
22 assert "/plugins/_whats_new/webui/whats-new-slides.js" in store
23 assert "a0_whats_new_never_show" in store
24 assert "No new updates right now" in store
25 assert "hasSlides()" in html + store
26 assert "export const slides = [];" in slide_data
27
28 old_cards = html + store + slide_data
29 assert "Parallel tool calls and subagents" not in old_cards
30 assert "Redesigned MCP configuration UI" not in old_cards
31 assert "Skills Scanner powered by Snyk Agent Scan" not in old_cards
32 assert "parallel-subs.webm" not in old_cards
33 assert "mcp-servers.png" not in old_cards
34 assert "skills-scanner.png" not in old_cards
35
36
37 def test_whats_new_legacy_modal_path_redirects_to_main_screen():
38 html = (WHATS_NEW_PLUGIN / "webui/whats-new.html").read_text(encoding="utf-8")
39
40 assert "/plugins/_whats_new/webui/main.html" in html
41 assert "openModal(mainPath)" in html
42 assert "What's New in Agent Zero" in html
43
44
45 def test_whats_new_startup_trigger_is_version_gated_with_opt_out():
46 content = (
47 WHATS_NEW_PLUGIN / "extensions/webui/initFw_end/whats-new.js"
48 ).read_text(encoding="utf-8")
49
50 assert "globalThis.gitinfo?.version" in content
51 assert "a0_whats_new_seen_version" in content
52 assert "a0_whats_new_never_show" in content
53 assert "/plugins/_whats_new/webui/whats-new-slides.js" in content
54 assert "slides.length" in content
55 assert "/plugins/_whats_new/webui/main.html" in content
56 assert "/plugins/_whats_new/webui/whats-new.html" in content
57 assert "compareVersions" in content
58 assert "storedSeenVersion" in content
59 assert "shouldShowWhatsNew" in content
60 assert "shouldNeverShow" in content
61 assert "modal-closed" in content
62 assert "markVersionSeen" in content
63
64
65 def test_whats_new_exposes_builtin_plugin_open_screen():
66 assert (WHATS_NEW_PLUGIN / "webui/main.html").exists()
67
68
69 def test_whats_new_plugin_manifest_is_always_enabled():
70 manifest = (WHATS_NEW_PLUGIN / "plugin.yaml").read_text(encoding="utf-8")
71
72 assert "name: _whats_new" in manifest
73 assert "always_enabled: true" in manifest
74 assert "settings_sections: []" in manifest