fix: make navigation no-focus by default
Testing / test (push) Failing after 15s
Testing / remote-protocol-compat (0.9.5) (push) Successful in 46s
Testing / remote-protocol-compat (0.9.3) (push) Successful in 47s

- Change nav open and open-wait to avoid activating newly created tabs unless
  --focus is explicitly requested.
- Send background=true for default opens so older or remote extensions also
  avoid stealing focus even if they ignore the new focus flag.
- Remove the redundant --bg flag from navigation and search CLI commands now
  that no-focus/background behavior is the default.
- Thread focus support through the sync SDK, async SDK, tab helpers, and
  workflow decorators.
- Update README and demo usage to document the new default and --focus opt-in.
- Bump package and extension metadata to 0.12.3.
- Add regression coverage for CLI help, wire payloads, and extension behavior.
This commit is contained in:
2026-06-14 13:59:15 +02:00
parent 509f1387de
commit 3e3b8d529c
16 changed files with 105 additions and 42 deletions
+46 -5
View File
@@ -346,14 +346,43 @@ def test_cli_perf_profile_ultra():
from browser_cli.commands.navigate import nav_group
def test_cli_nav_open():
result = _run(nav_group, ["open", "https://example.com"], {"id": 42, "url": "https://example.com"})
assert result.exit_code == 0
assert "Opened" in result.output
with patch("browser_cli.send_command", return_value={"id": 42, "url": "https://example.com"}) as send_command:
result = CliRunner().invoke(nav_group, ["open", "https://example.com"])
def test_cli_nav_open_bg():
result = _run(nav_group, ["open", "https://example.com", "--bg"], {"id": 42})
assert result.exit_code == 0
assert "Opened" in result.output
send_command.assert_called_once_with(
"navigate.open",
{"url": "https://example.com", "background": True, "focus": False, "window": None, "group": None},
profile=None,
remote=None,
key=None,
)
def test_cli_nav_open_has_no_bg_option():
result = CliRunner().invoke(nav_group, ["open", "--help"])
assert result.exit_code == 0
assert "--bg" not in result.output
def test_cli_nav_open_wait_has_no_bg_option():
result = CliRunner().invoke(nav_group, ["open-wait", "--help"])
assert result.exit_code == 0
assert "--bg" not in result.output
def test_cli_nav_open_focus_is_explicit():
with patch("browser_cli.send_command", return_value={"id": 42}) as send_command:
result = CliRunner().invoke(nav_group, ["open", "https://example.com", "--focus"])
assert result.exit_code == 0
send_command.assert_called_once_with(
"navigate.open",
{"url": "https://example.com", "background": False, "focus": True, "window": None, "group": None},
profile=None,
remote=None,
key=None,
)
def test_cli_nav_open_with_group():
result = _run(nav_group, ["open", "https://example.com", "--group", "work"], {"id": 42})
@@ -412,6 +441,18 @@ def test_cli_nav_wait():
assert result.exit_code == 0
assert "Ready" in result.output
# ---------------------------------------------------------------------------
# search commands
# ---------------------------------------------------------------------------
from browser_cli.commands.search import search_group
def test_cli_search_has_no_bg_option():
result = CliRunner().invoke(search_group, ["google", "--help"])
assert result.exit_code == 0
assert "--bg" not in result.output
# ---------------------------------------------------------------------------
# navigate commands — with tab_id argument
# ---------------------------------------------------------------------------