remove the --profile flag on windows open and add opening a new window with a url

This commit is contained in:
2026-04-10 13:06:53 +02:00
parent 61b774a7a4
commit 362b53a384
8 changed files with 40 additions and 14 deletions
+16
View File
@@ -471,6 +471,22 @@ class TestWindows:
{"id": 2, "tabCount": 3, "state": "maximized", "browser": "work"},
]
def test_windows_open_without_url(self, b, mock_send):
mock_send.return_value = {"id": 5}
result = b.windows_open()
assert result == {"id": 5}
mock_send.assert_called_once_with("windows.open", {"url": None}, profile=None)
def test_windows_open_with_url(self, b, mock_send):
mock_send.return_value = {"id": 9}
result = b.windows_open("https://example.com")
assert result == {"id": 9}
mock_send.assert_called_once_with("windows.open", {"url": "https://example.com"}, profile=None)
# ── Tab model ─────────────────────────────────────────────────────────────────
+9
View File
@@ -203,6 +203,15 @@ def test_windows_list_multi_browser_shows_browser_column():
assert "uuid-1" in result.output
assert "work" in result.output
def test_windows_open_passes_url():
with patch("browser_cli.commands.windows.send_command", return_value={"id": 7}) as send_command:
result = CliRunner().invoke(main, ["windows", "open", "https://example.com"])
assert result.exit_code == 0
assert "https://example.com" in result.output
send_command.assert_called_once_with("windows.open", {"url": "https://example.com"}, profile=None)
def test_extract_markdown_command():
with patch("browser_cli.commands.extract.send_command", return_value="# Title\n") as send_command:
result = CliRunner().invoke(main, ["extract", "markdown"])