Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

fix(tests): add proper assertions to e2e tests

Furkan Köykıran5f20c5970e89
diff --git a/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py b/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py
index bedce8c80..137108f5d 100644
--- a/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py
+++ b/browser/agent-harness/cli_anything/browser/tests/test_full_e2e.py
@@ -102,12 +102,8 @@ class TestDaemonMode:
# May fail if daemon can't start, but should return JSON
assert result.exit_code == 0
import json
- try:
- data = json.loads(result.output)
- assert "daemon" in data or "error" in data
- except json.JSONDecodeError:
- # Fallback: check if error message is present
- pass
+ data = json.loads(result.output)
+ assert "daemon" in data or "error" in data
class TestErrorHandling:
@@ -117,8 +113,9 @@ class TestErrorHandling:
"""Invalid path should give clear error."""
# Note: This test's behavior depends on DOMShell's error handling
result = runner.invoke(cli, ["fs", "cd", "/invalid/path/that/does/not/exist"])
- # Should not crash, exit code may be 0 or 1 depending on error
- assert True # If we get here, no crash
+ # Should not crash; exit code may be 0 or 1 depending on error handling
+ assert result.exception is None
+ assert result.exit_code in (0, 1)
def test_empty_page_info(self, runner):
"""Page info with no page loaded shows empty state."""