diff --git a/nanobot/channels/feishu/tests/test_feishu_reaction.py b/nanobot/channels/feishu/tests/test_feishu_reaction.py index 7b5b21135..ba81c2e25 100644 --- a/nanobot/channels/feishu/tests/test_feishu_reaction.py +++ b/nanobot/channels/feishu/tests/test_feishu_reaction.py @@ -143,24 +143,6 @@ class TestRemoveReactionAsync: ch._remove_reaction_sync.assert_not_called() - @pytest.mark.asyncio - async def test_noop_when_reaction_id_is_empty(self): - ch = _make_channel() - ch._remove_reaction_sync = MagicMock() - - await ch._remove_reaction("om_001", "") - - ch._remove_reaction_sync.assert_not_called() - - @pytest.mark.asyncio - async def test_noop_when_reaction_id_is_none(self): - ch = _make_channel() - ch._remove_reaction_sync = MagicMock() - - await ch._remove_reaction("om_001", None) - - ch._remove_reaction_sync.assert_not_called() - # ── send_delta stream end: reaction auto-cleanup ──────────────────────────── diff --git a/tests/agent/test_autocompact_unit.py b/tests/agent/test_autocompact_unit.py index 947cb2527..f2d926023 100644 --- a/tests/agent/test_autocompact_unit.py +++ b/tests/agent/test_autocompact_unit.py @@ -340,26 +340,6 @@ class TestCheckExpired: await ac.check_expired(scheduler, _resolve_runtime) scheduler.assert_not_called() - async def test_session_with_no_key_skips(self): - """Session info with empty/missing key should be skipped.""" - ac = _make_autocompact(ttl=15) - mock_sm = _mock_sessions() - mock_sm.list_sessions.return_value = [{"key": "", "updated_at": "old"}] - ac.sessions = mock_sm - scheduler = MagicMock() - await ac.check_expired(scheduler, _resolve_runtime) - scheduler.assert_not_called() - - async def test_session_with_missing_key_field_skips(self): - """Session info dict without 'key' field should be skipped.""" - ac = _make_autocompact(ttl=15) - mock_sm = _mock_sessions() - mock_sm.list_sessions.return_value = [{"updated_at": "old"}] - ac.sessions = mock_sm - scheduler = MagicMock() - await ac.check_expired(scheduler, _resolve_runtime) - scheduler.assert_not_called() - async def test_dream_session_skips(self): """Internal Dream sessions should not be scheduled for idle compact.""" ac = _make_autocompact(ttl=15) diff --git a/tests/agent/test_onboard_logic.py b/tests/agent/test_onboard_logic.py index 7dceb801b..71476f611 100644 --- a/tests/agent/test_onboard_logic.py +++ b/tests/agent/test_onboard_logic.py @@ -313,16 +313,6 @@ class TestFormatValue: class TestSyncWorkspaceTemplates: """Tests for sync_workspace_templates file synchronization.""" - def test_creates_missing_files(self, tmp_path): - """Should create template files that don't exist.""" - workspace = tmp_path / "workspace" - - added = sync_workspace_templates(workspace, silent=True) - - # Check that some files were created - assert isinstance(added, list) - # The actual files depend on the templates directory - def test_does_not_overwrite_existing_files(self, tmp_path): """Should not overwrite files that already exist.""" workspace = tmp_path / "workspace" @@ -398,13 +388,16 @@ class TestProviderChannelInfo: assert "openai_codex" not in names assert "github_copilot" not in names - def test_get_channel_names_returns_dict(self): - from nanobot.cli.onboard import _get_channel_names + def test_get_channel_names_maps_display_names(self, monkeypatch): + monkeypatch.setattr(onboard_wizard, "_get_channel_info", lambda: { + "first": ("First channel", Config), + "second": ("Second channel", Config), + }) - names = _get_channel_names() - assert isinstance(names, dict) - # Should include at least some channels - assert len(names) >= 0 + assert onboard_wizard._get_channel_names() == { + "first": "First channel", + "second": "Second channel", + } def test_get_provider_info_returns_valid_structure(self): from nanobot.cli.onboard import _get_provider_info @@ -1780,26 +1773,6 @@ class TestMainMenuInteraction: assert loginchat["enabled"] is True assert calls == {"force": False} - def test_main_menu_dispatch_includes_channel_common(self): - """Advanced menu dispatch should route [H] to Channel Common.""" - - # We verify by checking the dispatch table is set up correctly - # The menu items are defined inline in run_onboard, so we test - # that _configure_general_settings handles the new sections. - from nanobot.cli.onboard import _SETTINGS_GETTER, _SETTINGS_SECTIONS, _SETTINGS_SETTER - - assert "Channel Common" in _SETTINGS_SECTIONS - assert "Channel Common" in _SETTINGS_GETTER - assert "Channel Common" in _SETTINGS_SETTER - - def test_main_menu_dispatch_includes_api_server(self): - """Advanced menu dispatch should route [I] to API Server.""" - from nanobot.cli.onboard import _SETTINGS_GETTER, _SETTINGS_SECTIONS, _SETTINGS_SETTER - - assert "API Server" in _SETTINGS_SECTIONS - assert "API Server" in _SETTINGS_GETTER - assert "API Server" in _SETTINGS_SETTER - def test_run_onboard_channel_common_edit(self, monkeypatch): """run_onboard should handle [H] Channel Common through Advanced Settings.""" initial_config = Config() @@ -2168,12 +2141,6 @@ class TestModelPresetWizard: assert defaults.model_preset is None _MODEL_PRESET_CACHE.clear() - def test_main_menu_dispatch_includes_model_presets(self): - """_configure_model_presets should be importable and callable.""" - from nanobot.cli.onboard import _configure_model_presets - - assert callable(_configure_model_presets) - def test_run_onboard_model_presets_edit(self, monkeypatch): """run_onboard should handle [M] Model Presets through Advanced Settings.""" from nanobot.config.schema import ModelPresetConfig diff --git a/tests/agent/test_subagent_lifecycle.py b/tests/agent/test_subagent_lifecycle.py index c5776b5a2..0b2a00256 100644 --- a/tests/agent/test_subagent_lifecycle.py +++ b/tests/agent/test_subagent_lifecycle.py @@ -612,17 +612,6 @@ class TestRunningCounts: class TestSubagentHook: - @pytest.mark.asyncio - async def test_before_execute_tools_without_status_preserves_calls(self): - hook = _SubagentHook() - tool_call = MagicMock() - tool_call.name = "read_file" - tool_call.arguments = {"path": "/tmp/test"} - ctx = _make_hook_context(tool_calls=[tool_call]) - result = await hook.before_execute_tools(ctx) - assert result is None - assert ctx.tool_calls == [tool_call] - @pytest.mark.asyncio async def test_after_iteration_updates_status(self): status = SubagentStatus( @@ -639,14 +628,6 @@ class TestSubagentHook: assert len(status.tool_events) == 1 assert status.usage == LLMUsage.reported(input_tokens=100, output_tokens=0) - @pytest.mark.asyncio - async def test_after_iteration_no_status_noop(self): - hook = _SubagentHook() - ctx = _make_hook_context(iteration=5) - result = await hook.after_iteration(ctx) - assert result is None - assert ctx.iteration == 5 - @pytest.mark.asyncio async def test_after_iteration_sets_error(self): status = SubagentStatus( diff --git a/tests/agent/tools/test_self_tool.py b/tests/agent/tools/test_self_tool.py index f563f25b1..c20e87295 100644 --- a/tests/agent/tools/test_self_tool.py +++ b/tests/agent/tools/test_self_tool.py @@ -628,19 +628,6 @@ class TestSubagentHookStatus: assert status.error == "something went wrong" - @pytest.mark.asyncio - async def test_after_iteration_no_status_is_noop(self): - """after_iteration with no status should be a no-op.""" - from nanobot.agent.hook import AgentHookContext - from nanobot.agent.subagent import _SubagentHook - - hook = _SubagentHook() - context = AgentHookContext(iteration=1, messages=[]) - result = await hook.after_iteration(context) - - assert result is None - assert context.iteration == 1 - # --------------------------------------------------------------------------- # read-only mode (tools.my.allow_set=False) diff --git a/tests/command/test_skill_command.py b/tests/command/test_skill_command.py index 587ad5cff..b820ce2ed 100644 --- a/tests/command/test_skill_command.py +++ b/tests/command/test_skill_command.py @@ -126,14 +126,6 @@ async def test_skill_command_no_render_as_text(tmp_path: Path) -> None: assert out.metadata.get("render_as") != "text" -@pytest.mark.asyncio -async def test_skill_command_does_not_list_goal_runtime_protocol(tmp_path: Path) -> None: - loop = _make_loop(tmp_path) - out = await cmd_skill(_ctx(loop)) - - assert "long-goal" not in out.content - - @pytest.mark.asyncio async def test_skill_command_registered_on_router(tmp_path: Path) -> None: router = CommandRouter() diff --git a/tests/config/test_config_atomic_save.py b/tests/config/test_config_atomic_save.py index 4ebde1ea8..86f3cee93 100644 --- a/tests/config/test_config_atomic_save.py +++ b/tests/config/test_config_atomic_save.py @@ -15,9 +15,11 @@ from nanobot.config.schema import Config def test_save_config_round_trips(tmp_path: Path) -> None: path = tmp_path / "config.json" - save_config(Config(), path) + config = Config() + config.agents.defaults.model = "saved-model" + save_config(config, path) loaded = load_config(path) - assert loaded.agents.defaults.model + assert loaded.agents.defaults.model == "saved-model" @pytest.mark.skipif(os.name == "nt", reason="Windows does not expose POSIX file modes") diff --git a/tests/providers/test_proxy_env.py b/tests/providers/test_proxy_env.py index 340d1bc5d..ae342a68f 100644 --- a/tests/providers/test_proxy_env.py +++ b/tests/providers/test_proxy_env.py @@ -3,6 +3,7 @@ from unittest.mock import MagicMock import httpx +import pytest import nanobot.providers.openai_compat_provider as openai_compat_provider from nanobot.providers.openai_compat_provider import OpenAICompatProvider @@ -17,28 +18,22 @@ def _make_spec(is_local: bool = False) -> MagicMock: class TestLocalEndpointProxyDisabled: """Local endpoints must bypass proxy to avoid routing LAN traffic through it.""" - async def test_local_disables_proxy(self): - spec = _make_spec(is_local=True) + @pytest.mark.parametrize("api_base,is_local", [ + ("http://localhost:11434/v1", True), + ("http://192.168.8.188:1234/v1", False), + ]) + async def test_local_endpoint_bypasses_environment_proxy(self, monkeypatch, api_base, is_local): + for name in ("HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY"): + monkeypatch.delenv(name, raising=False) + monkeypatch.delenv(name.lower(), raising=False) + monkeypatch.setenv("ALL_PROXY", "http://proxy.example:8123") + spec = _make_spec(is_local=is_local) spec.env_key = "" - spec.default_api_base = "http://localhost:11434/v1" - provider = OpenAICompatProvider( - api_key="test", api_base="http://localhost:11434/v1", spec=spec, - ) - await provider._ensure_client() - transport = provider._client._client._transport - # The transport should be an AsyncHTTPTransport with proxy=None - assert isinstance(transport, httpx.AsyncHTTPTransport) - - async def test_lan_ip_disables_proxy(self): - spec = _make_spec(is_local=False) - spec.env_key = "" - spec.default_api_base = None - provider = OpenAICompatProvider( - api_key="test", api_base="http://192.168.8.188:1234/v1", spec=spec, - ) - await provider._ensure_client() - transport = provider._client._client._transport - assert isinstance(transport, httpx.AsyncHTTPTransport) + spec.default_api_base = api_base + provider = OpenAICompatProvider(api_key="test", api_base=api_base, spec=spec) + async with await provider._ensure_client() as sdk: + client = sdk._client + assert client._transport_for_url(httpx.URL(api_base)) is client._transport class TestCloudEndpointProxyEnabled: diff --git a/tests/providers/test_responses_circuit_breaker.py b/tests/providers/test_responses_circuit_breaker.py index 3c07d0a5a..506c3e46b 100644 --- a/tests/providers/test_responses_circuit_breaker.py +++ b/tests/providers/test_responses_circuit_breaker.py @@ -131,15 +131,6 @@ def test_responses_declaration_routes_other_models(provider): assert provider._should_use_responses_api("gpt-4o", None) is True -def test_responses_only_declaration_ignores_circuit_breaker(provider): - provider.default_model = "gpt-4o" - provider._preset_model_api = ModelAPICapabilities(("responses",), "responses") - provider._responses_failures = {"gpt-4o|gpt-4o|": _RESPONSES_FAILURE_THRESHOLD} - provider._responses_tripped_at = {"gpt-4o|gpt-4o|": 0.0} - - assert provider._should_use_responses_api("gpt-4o", None) is True - - def test_circuit_opens_after_threshold(provider): for _ in range(_RESPONSES_FAILURE_THRESHOLD): provider._record_responses_failure("gpt-5", None) diff --git a/tests/tools/test_read_enhancements.py b/tests/tools/test_read_enhancements.py index bb809ad0d..6e61c58ae 100644 --- a/tests/tools/test_read_enhancements.py +++ b/tests/tools/test_read_enhancements.py @@ -1,5 +1,6 @@ """Tests for ReadFileTool enhancements: description fix, read dedup, PDF support, device blacklist, office docs.""" +import base64 import os import sys from unittest.mock import patch @@ -95,14 +96,18 @@ class TestReadDedup: assert "unchanged" not in read_result.lower() @pytest.mark.asyncio - async def test_dedup_does_not_apply_to_images(self, tool, tmp_path): + async def test_repeated_image_reads_return_full_content(self, tool, tmp_path): f = tmp_path / "img.png" f.write_bytes(b"\x89PNG\r\n\x1a\nfake-png-data") first = await tool.execute(path=str(f)) - assert isinstance(first, list) second = await tool.execute(path=str(f)) - # Images should always return full content blocks, not a stub - assert isinstance(second, list) + + assert second == first + assert second[0]["type"] == "image_url" + encoded = base64.b64encode(f.read_bytes()).decode("ascii") + assert second[0]["image_url"]["url"] == f"data:image/png;base64,{encoded}" + assert second[0]["_meta"]["path"] == str(f) + assert second[1] == {"type": "text", "text": f"(Image file: {f})"} @pytest.mark.asyncio async def test_known_text_extension_falls_back_to_latin1(self, tool, tmp_path): diff --git a/tui/src/app/composer.test.ts b/tui/src/app/composer.test.ts index 848ededac..22eef2232 100644 --- a/tui/src/app/composer.test.ts +++ b/tui/src/app/composer.test.ts @@ -528,7 +528,7 @@ describe("NanobotTui composer", () => { ui.composer.setText("ask @github next") ui.composer.submit() await waitUntil(() => sent.length === 2) - expect(ui.status.plainText).not.toContain("Steering") + expect(ui.status.plainText).toMatch(/^Thinking\s+\d+s/u) expect(ui.composer.placeholder).toBe("Enter send now Tab send next") expect(sentOptions[1]).toEqual({ cliApps: [{ name: "github" }], diff --git a/tui/src/app/layout.test.ts b/tui/src/app/layout.test.ts index 3a0dc00a9..66acd94ff 100644 --- a/tui/src/app/layout.test.ts +++ b/tui/src/app/layout.test.ts @@ -188,8 +188,6 @@ describe("NanobotTui layout and themes", () => { expect(setup.renderer.width).toBe(width) expect(setup.renderer.height).toBe(height) expect(frame).not.toContain("undefined") - expect(frame).not.toContain("Steer this turn…") - expect(frame).not.toContain("Ask a follow-up…") if (width >= 40 && height >= 9) { expect(occurrences(frame, "Enter send now Tab send next")).toBe(1) } else if (width >= 28 && height >= 9) { diff --git a/tui/src/app/sessions.test.ts b/tui/src/app/sessions.test.ts index 6f342355f..df4dac9f6 100644 --- a/tui/src/app/sessions.test.ts +++ b/tui/src/app/sessions.test.ts @@ -553,14 +553,11 @@ describe("NanobotTui session navigation", () => { const ui = app as unknown as { composer: TextareaRenderable sessionMenu: { visible: boolean; root: { getChildren(): unknown[] } } - title: { getChildren(): unknown[] } } try { await waitUntil(() => (app as unknown as { ready: boolean }).ready) await setup.renderOnce() - const titleItems = ui.title.getChildren() as TextRenderable[] - expect(titleItems.some((item) => item.id === "nanobot-tui-title-text")).toBe(false) expect(ui.sessionMenu.visible).toBe(false) ui.composer.setText("/sessions") @@ -849,7 +846,7 @@ describe("NanobotTui session navigation", () => { } }) - test("shows compact session context without exposing private reasoning", async () => { + test("shows compact session context and preserves the composer on resize", async () => { setup = await createRenderer({ width: 96, height: 26, screenMode: "alternate-screen" }) const original = globalThis.fetch globalThis.fetch = ((input: string | URL | Request) => { @@ -888,14 +885,11 @@ describe("NanobotTui session navigation", () => { expect(frame).toContain("~2.2k tokens 10 replay 16 archived") expect(frame).toContain("The earlier turns agreed on a release plan.") - expect(frame).not.toContain("Agent context") - expect(frame).not.toContain("summary active") - expect(frame).not.toContain("memory, instructions, and skills are added separately") setup.resize(40, 10) await setup.renderOnce() const compact = setup.captureCharFrame() - expect(occurrences(compact, "Agent context")).toBe(0) + expect(compact).not.toContain("The earlier turns agreed") expect(occurrences(compact, "Ask nanobot anything")).toBe(1) setup.mockInput.pressEscape() diff --git a/tui/src/app/transcript.test.ts b/tui/src/app/transcript.test.ts index 3ea442279..9cf7d2f15 100644 --- a/tui/src/app/transcript.test.ts +++ b/tui/src/app/transcript.test.ts @@ -292,7 +292,7 @@ describe("NanobotTui transcript", () => { max_attempts: 4, error_kind: "connection", }) - expect(ui.status.plainText).not.toContain("retrying") + expect(ui.status.plainText).toMatch(/^Working\s+\d+s/u) app.accept({ event: "turn_end", @@ -312,7 +312,6 @@ describe("NanobotTui transcript", () => { expect(frame).toContain("Could not connect to the model provider.") expect(frame.replace(/\s+/gu, " ")).toContain(terminalFailure) expect(frame).not.toContain("Unlocalized server failure") - expect(frame).not.toContain("Last turn failed") expect(ui.status.plainText).toBe("Ready") }) diff --git a/tui/src/platform/host.test.ts b/tui/src/platform/host.test.ts index bff1cefd7..71a27b51b 100644 --- a/tui/src/platform/host.test.ts +++ b/tui/src/platform/host.test.ts @@ -84,8 +84,5 @@ describe("TUI host integration", () => { "--source", "nanobot:tui:metadata", "--seq", "3", "--clear-title", ], ]) - expect(commands.flat()).not.toContain("report-agent") - expect(commands.flat()).not.toContain("report-agent-session") - expect(commands.flat()).not.toContain("--token") }) }) diff --git a/tui/src/views/context-panel.test.ts b/tui/src/views/context-panel.test.ts index 313b8c772..5d80ffe43 100644 --- a/tui/src/views/context-panel.test.ts +++ b/tui/src/views/context-panel.test.ts @@ -24,7 +24,7 @@ describe("ContextPanel", () => { setup = undefined }) - test("omits explanatory copy when no compacted summary exists", async () => { + test("renders replay statistics when no compacted summary exists", async () => { setup = await createTestRenderer({ width: 80, height: 18, screenMode: "alternate-screen" }) const panel = new ContextPanel(setup.renderer, { text: "#FFFFFF", @@ -37,7 +37,5 @@ describe("ContextPanel", () => { const frame = setup.captureCharFrame() expect(frame).toContain("~950 tokens 8 replay 0 archived") - expect(frame).not.toContain("Agent context") - expect(frame).not.toContain("no compacted summary") }) }) diff --git a/webui/src/tests/agent-activity-cluster.test.tsx b/webui/src/tests/agent-activity-cluster.test.tsx index 2f057a160..01d8bf101 100644 --- a/webui/src/tests/agent-activity-cluster.test.tsx +++ b/webui/src/tests/agent-activity-cluster.test.tsx @@ -284,8 +284,6 @@ describe("AgentActivityCluster", () => { expect(content).toHaveClass("ps-6"); expect(content).not.toHaveClass("max-h-[180px]"); expect(content).not.toHaveClass("overflow-y-auto"); - expect(screen.queryByTestId("activity-scroll-fade-top")).not.toBeInTheDocument(); - expect(screen.queryByTestId("activity-scroll-fade-bottom")).not.toBeInTheDocument(); view.rerender( { const fileRef = screen.getByTestId("activity-file-reference"); expect(fileRef).toHaveTextContent("src/app.tsx"); expect(fileRef).toHaveAttribute("aria-label", "/Users/renxubin/project/src/app.tsx"); - expect(screen.queryByTestId("activity-header-file-reference")).not.toBeInTheDocument(); expect(screen.queryByTestId("file-edit-diff")).not.toBeInTheDocument(); for (const diffPair of screen.getAllByTestId("activity-diff-pair")) { expect(diffPair).toHaveClass("items-baseline"); @@ -1050,7 +1047,6 @@ describe("AgentActivityCluster", () => { expect(screen.queryByRole("button", { name: /edited app\.tsx/i })).not.toBeInTheDocument(); expect(screen.queryByTestId("agent-activity-content")).not.toBeInTheDocument(); expect(screen.getByRole("img", { name: "Edited" })).toBeInTheDocument(); - expect(screen.queryByTestId("activity-header-file-reference")).not.toBeInTheDocument(); const marker = screen.getByRole("img", { name: "Edited" }); expect(marker.querySelector("svg")).toHaveClass("lucide-file-code2"); expect(marker.closest('[data-testid="activity-step"]')?.querySelectorAll("svg")).toHaveLength(1); @@ -2105,7 +2101,6 @@ describe("AgentActivityCluster", () => { expect(screen.queryByText("Web")).not.toBeInTheDocument(); const row = screen.getByText("example.com").closest('[data-testid="activity-step"]'); expect(row).toHaveTextContent("Read"); - expect(screen.queryByTestId("activity-evidence-preview")).not.toBeInTheDocument(); expect(screen.queryByText(/Found image/i)).not.toBeInTheDocument(); expect(screen.queryByRole("img", { name: "Homepage screenshot" })).not.toBeInTheDocument(); }); @@ -2212,7 +2207,6 @@ describe("AgentActivityCluster", () => { expect(screen.queryByText("Vision")).not.toBeInTheDocument(); expect(screen.getByText("Captured screenshot")).toBeInTheDocument(); - expect(screen.queryByTestId("activity-evidence-preview")).not.toBeInTheDocument(); expect(screen.queryByText("missing.png")).not.toBeInTheDocument(); }); @@ -2259,7 +2253,6 @@ describe("AgentActivityCluster", () => { expect(line).toHaveClass("overflow-hidden"); expect(line).toHaveClass("whitespace-nowrap"); expect(step.querySelector("br")).not.toBeInTheDocument(); - expect(step.querySelector('[data-testid="activity-evidence-preview"]')).not.toBeInTheDocument(); } expect(document.querySelector("details")).not.toBeInTheDocument(); expect(document.querySelector("ul, li, section")).not.toBeInTheDocument(); diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx index ada93de4a..9faf9a634 100644 --- a/webui/src/tests/app-layout.test.tsx +++ b/webui/src/tests/app-layout.test.tsx @@ -1442,9 +1442,6 @@ describe("App layout", () => { expect(screen.getByText("cron")).toBeInTheDocument(); expect(screen.getByText("github")).toBeInTheDocument(); expect(screen.getByText("Needs setup")).toBeInTheDocument(); - expect( - screen.queryByText("Review the instruction skills this agent can load during a conversation."), - ).not.toBeInTheDocument(); expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeInTheDocument(); expect(screen.queryByRole("navigation", { name: "Settings sections" })).not.toBeInTheDocument(); expect(within(sidebar).getByRole("button", { name: "Skills" })).toHaveAttribute( @@ -1470,14 +1467,7 @@ describe("App layout", () => { "true", ); expect(screen.getByText("Setup required")).toBeInTheDocument(); - expect( - screen.queryByText( - "Allow the agent to load this skill when its requirements are ready.", - ), - ).not.toBeInTheDocument(); expect(screen.getByText("brew install gh")).toBeInTheDocument(); - expect(screen.queryByText("Unavailable reason")).not.toBeInTheDocument(); - expect(screen.queryByText("Missing CLI")).not.toBeInTheDocument(); expect(screen.getByRole("button", { name: "Check again" })).toBeInTheDocument(); fireEvent.click(screen.getByText("Skill instructions")); expect(screen.getByText(/Use GitHub CLI/)).toBeInTheDocument(); @@ -1675,9 +1665,6 @@ describe("App layout", () => { expect( await screen.findByRole("heading", { name: "Popular skills" }), ).toBeInTheDocument(); - expect( - screen.queryByText("Each marketplace keeps its own ranking and install metrics."), - ).not.toBeInTheDocument(); expect(screen.getByText("find-skills")).toBeInTheDocument(); expect(screen.getByText("ima-skills")).toBeInTheDocument(); expect(screen.getByRole("link", { name: "Open ima-skills on SkillHub" })).toHaveAttribute( diff --git a/webui/src/tests/automations-settings.test.tsx b/webui/src/tests/automations-settings.test.tsx index e690beb4e..a21676dc4 100644 --- a/webui/src/tests/automations-settings.test.tsx +++ b/webui/src/tests/automations-settings.test.tsx @@ -609,50 +609,12 @@ describe("Automation task list and detail sheet", () => { expect(screen.queryByText("No next run")).not.toBeInTheDocument(); }); - it.each(["heartbeat", "dream", "other-system-job"])("shows only actual task data for %s", (id) => { - renderDetail({ ...systemTask, id, name: id, state: { next_run_at_ms: now + 540_000 } }); - const dialog = screen.getByRole("dialog", { name: id }); - expect(dialog).toHaveClass("max-w-[440px]"); - expect(dialog).not.toHaveAttribute("aria-describedby"); - expect(dialog.querySelector("p")).toBeNull(); - expect(within(dialog).queryByText("Task instructions")).not.toBeInTheDocument(); - expect(within(dialog).queryByText("System-managed automation")).not.toBeInTheDocument(); - expect(within(dialog).queryByText("Schedule")).not.toBeInTheDocument(); - expect(within(dialog).getAllByRole("button")).toHaveLength(2); - expect(within(dialog).getByRole("button", { name: "Close" })).toHaveClass("rounded-full", "h-7", "w-7"); - const toggle = within(dialog).getByRole("button", { name: "Task information" }); - expect(screen.queryByRole("dialog", { name: "Task information" })).not.toBeInTheDocument(); - fireEvent.click(toggle); - const metadata = screen.getByRole("dialog", { name: "Task information" }); - for (const label of ["Schedule", "Next run", "Last run"]) { - expect(within(metadata).getByText(label).closest("dt")).not.toBeNull(); - } - expect(within(metadata).getByText("Every 30 minutes")).toBeVisible(); - expect(within(metadata).getByText("Not run yet")).toBeVisible(); - expect(within(metadata).getByText("ID")).toBeVisible(); - fireEvent.click(toggle); - expect(screen.queryByRole("dialog", { name: "Task information" })).not.toBeInTheDocument(); - }); - - it("keeps the shared protected detail read-only and does not infer purpose from a task name", () => { - renderDetail({ ...systemTask, id: "other-system-job", name: "heartbeat", - state: { last_run_at_ms: now - 60_000, last_status: "error", last_error: "Background check failed", next_run_at_ms: null }, - }); - const dialog = screen.getByRole("dialog", { name: "heartbeat" }); - expect(within(dialog).queryByText("System-managed automation")).not.toBeInTheDocument(); - expect(within(dialog).getByRole("alert")).toHaveTextContent("Background check failed"); - fireEvent.click(within(dialog).getByRole("button", { name: "Task information" })); - expect(within(dialog).getByText("Failed")).toBeVisible(); - expect(within(dialog).getByText("No next run")).toBeVisible(); - expect(dialog).not.toHaveAttribute("aria-describedby"); - }); - - it.each([task, systemTask])("uses shared dialog styling and quiet detail rows for $name", (job) => { - renderDetail(job); - const dialog = screen.getByRole("dialog", { name: job.name }); + it("uses shared dialog styling and quiet detail rows", () => { + renderDetail(task); + const dialog = screen.getByRole("dialog", { name: task.name }); expect(dialog).toHaveClass("rounded-modal"); expect(dialog).not.toHaveClass("rounded-[20px]"); - const title = within(dialog).getByRole("heading", { name: job.name }); + const title = within(dialog).getByRole("heading", { name: task.name }); expect(title).toHaveClass("text-lg", "font-medium", "leading-snug"); expect(dialog).toHaveClass("text-sm", "font-normal"); expect(title).not.toHaveClass("text-[22px]"); @@ -662,16 +624,14 @@ describe("Automation task list and detail sheet", () => { const details = within(dialog).getByRole("button", { name: "Task information" }); expect(details.parentElement).not.toHaveClass("border-t"); expect(details).toHaveAttribute("aria-expanded", "false"); - if (!job.protected) { - expect(within(dialog).queryByRole("switch")).not.toBeInTheDocument(); - const taskActions = within(dialog).getByRole("button", { name: "Run now" }).parentElement; - const edit = within(dialog).getByRole("button", { name: "Edit" }); - expect(edit.parentElement).toBe(taskActions); - expect(edit.parentElement).toHaveClass("ml-auto"); - expect(taskMenuItem("Disable")).toBeVisible(); - expect(taskMenuItem("Delete")).toBeVisible(); - expect(taskMenuItem("Open a chat")).toHaveAttribute("href", "#/chat/websocket%3Ademo"); - } + expect(within(dialog).queryByRole("switch")).not.toBeInTheDocument(); + const taskActions = within(dialog).getByRole("button", { name: "Run now" }).parentElement; + const edit = within(dialog).getByRole("button", { name: "Edit" }); + expect(edit.parentElement).toBe(taskActions); + expect(edit.parentElement).toHaveClass("ml-auto"); + expect(taskMenuItem("Disable")).toBeVisible(); + expect(taskMenuItem("Delete")).toBeVisible(); + expect(taskMenuItem("Open a chat")).toHaveAttribute("href", "#/chat/websocket%3Ademo"); }); it("keeps schedule and run metadata in task information", async () => { diff --git a/webui/src/tests/file-preview-panel.test.tsx b/webui/src/tests/file-preview-panel.test.tsx index 3170fa4f1..9761bbf74 100644 --- a/webui/src/tests/file-preview-panel.test.tsx +++ b/webui/src/tests/file-preview-panel.test.tsx @@ -163,7 +163,6 @@ describe("FilePreviewPanel", () => { expect(codeBlock).toHaveTextContent("print('ok')"); expect(codeBlock).toHaveAttribute("data-language", "python"); expect(codeBlock).toHaveAttribute("data-highlight", "true"); - expect(screen.queryByTestId("file-preview-breadcrumb")).not.toBeInTheDocument(); expect(screen.queryByText("quicksort.py")).not.toBeInTheDocument(); }); diff --git a/webui/src/tests/mcp-management-dialog.test.tsx b/webui/src/tests/mcp-management-dialog.test.tsx index 1a17d6056..58abccf4e 100644 --- a/webui/src/tests/mcp-management-dialog.test.tsx +++ b/webui/src/tests/mcp-management-dialog.test.tsx @@ -87,8 +87,6 @@ describe("McpManagementDialog", () => { expect(within(dialog).getByText("Streamable HTTP")).toBeInTheDocument(); expect(within(dialog).getByRole("link", { name: "Open docs" })).toBeInTheDocument(); expect(within(dialog).getByRole("button", { name: "Remove connection" })).toBeInTheDocument(); - expect(within(dialog).queryByText("Last checked")).not.toBeInTheDocument(); - expect(within(dialog).queryByText("Connection actions apply immediately.")).not.toBeInTheDocument(); fireEvent.click(within(dialog).getByRole("button", { name: "Reconnect" })); expect(onAction).toHaveBeenCalledWith("reconnect", "docs", {}); }); @@ -138,7 +136,7 @@ describe("McpManagementDialog", () => { expect(screen.queryByRole("switch", { name: "Use proxy" })).not.toBeInTheDocument(); }); - it("loads tools on entry and replaces passive inspection copy with recovery", async () => { + it("loads tools on entry and supports refreshing the empty inventory", async () => { const onAction = vi.fn(); renderDialog({ initialTab: "tools", @@ -148,7 +146,6 @@ describe("McpManagementDialog", () => { const dialog = screen.getByRole("dialog", { name: "Docs MCP" }); await waitFor(() => expect(onAction).toHaveBeenCalledWith("test", "docs")); - expect(within(dialog).queryByText("Not inspected")).not.toBeInTheDocument(); expect(within(dialog).getByText("No tools available")).toBeInTheDocument(); fireEvent.click(within(dialog).getByRole("button", { name: "Refresh tools" })); expect(onAction).toHaveBeenCalledTimes(2); diff --git a/webui/src/tests/settings-runtime-config.test.tsx b/webui/src/tests/settings-runtime-config.test.tsx index acb771192..739462c4e 100644 --- a/webui/src/tests/settings-runtime-config.test.tsx +++ b/webui/src/tests/settings-runtime-config.test.tsx @@ -44,7 +44,7 @@ describe("Runtime configuration settings", () => { expect([...paths, visibilityOnly].sort()).toEqual([...runtimeConfigKeys].sort()); }); - it("keeps local service controls available when tool families are disabled", () => { + it("keeps chat permissions and local services available when tool families are disabled", () => { const payload = runtimeSettings(); renderSettingsView({ initialSection: "advanced", initialSettings: { ...payload, runtime_config: { @@ -53,11 +53,9 @@ describe("Runtime configuration settings", () => { }, } }); expect(screen.getByRole("switch", { name: "Local services" })).toBeVisible(); - }); - - it("keeps chat permission settings discoverable within the advanced page", () => { - renderSettingsView({ initialSection: "advanced", initialSettings: runtimeSettings() }); - expect(screen.getByRole("switch", { name: "Local services" })).toBeInTheDocument(); + expect(screen.getByText("Default access")).toBeVisible(); + expect(screen.getByRole("button", { name: "Default Permission" })).toBeVisible(); + expect(screen.getByRole("button", { name: "Full Access" })).toBeVisible(); }); it("places common settings in their feature pages and reserves advanced for low-frequency controls", () => { diff --git a/webui/src/tests/thinking-reasoning-shell.test.tsx b/webui/src/tests/thinking-reasoning-shell.test.tsx index 16c91ba24..b8f129b57 100644 --- a/webui/src/tests/thinking-reasoning-shell.test.tsx +++ b/webui/src/tests/thinking-reasoning-shell.test.tsx @@ -18,7 +18,7 @@ function renderShell(expanded: boolean) { } describe("ThinkingReasoningShell", () => { - it.each([false, true])("shows activity without clipping or edge fades (active: %s)", (active) => { + it.each([false, true])("renders the full activity list (active: %s)", (active) => { render( { const content = screen.getByTestId("agent-activity-content"); expect(content).not.toHaveClass("max-h-[180px]"); expect(content).not.toHaveClass("overflow-y-auto"); - expect(screen.queryByTestId("activity-scroll-fade-top")).not.toBeInTheDocument(); - expect(screen.queryByTestId("activity-scroll-fade-bottom")).not.toBeInTheDocument(); expect(screen.getByText("Activity 1")).toBeVisible(); expect(screen.getByText("Activity 16")).toBeVisible(); }); diff --git a/webui/src/tests/thread-composer.test.tsx b/webui/src/tests/thread-composer.test.tsx index b109a1c0a..b441d7cdd 100644 --- a/webui/src/tests/thread-composer.test.tsx +++ b/webui/src/tests/thread-composer.test.tsx @@ -4078,6 +4078,7 @@ describe("ThreadComposer", () => { }); it("keeps temporary chat guidance in memory only", async () => { + const setItem = vi.spyOn(window.localStorage, "setItem"); const onSend = vi.fn(); const view = render( { fireEvent.keyDown(input, { key: "Enter" }); expect(await screen.findByText("do not persist this")).toBeInTheDocument(); - expect( - window.localStorage.getItem( - "nanobot.webui.composerQueuedGuidance.v1:temporary-private", - ), - ).toBeNull(); + expect(setItem).not.toHaveBeenCalled(); view.unmount(); render( @@ -4114,11 +4111,7 @@ describe("ThreadComposer", () => { await waitFor(() => { expect(screen.queryByText("do not persist this")).not.toBeInTheDocument(); }); - expect( - window.localStorage.getItem( - "nanobot.webui.composerQueuedGuidance.v1:temporary-private", - ), - ).toBeNull(); + expect(setItem).not.toHaveBeenCalled(); }); }); diff --git a/webui/src/tests/thread-shell.test.tsx b/webui/src/tests/thread-shell.test.tsx index afa382bd0..bb1de416e 100644 --- a/webui/src/tests/thread-shell.test.tsx +++ b/webui/src/tests/thread-shell.test.tsx @@ -5221,37 +5221,6 @@ describe("ThreadShell", () => { expect(screen.getByRole("option", { name: /\/history/i })).toBeInTheDocument(); }); - it("does not bring back welcome cards when image mode is enabled", async () => { - const client = makeClient(); - const settings = modelSettings("deepseek-v4-pro", "deepseek"); - render( - wrap( - client, - {}} - onNewChat={() => {}} - settingsSnapshot={{ - ...settings, - image_generation: { - ...settings.image_generation, - enabled: true, - provider_configured: true, - }, - }} - />, - ), - ); - await act(async () => {}); - - expect(screen.queryByText("Design an icon")).not.toBeInTheDocument(); - expect(screen.queryByText("Write code")).not.toBeInTheDocument(); - - expect(screen.queryByText("Design an icon")).not.toBeInTheDocument(); - expect(screen.queryByText("Write code")).not.toBeInTheDocument(); - }); - it("surfaces a dismissible banner for an uncorrelated message_too_big error", async () => { const client = makeClient(); const onNewChat = vi.fn().mockResolvedValue("chat-a");