fix: prevent browser target and focus surprises
- Respect the globally selected browser when renaming client aliases. - Pass the resolved local profile into sync and async local transports so BROWSER_CLI_PROFILE is honored consistently. - Stop tabs.active from explicitly focusing the OS browser window, avoiding virtual-desktop jumps during tab activation. - Make window merging skip audible, unmuted windows so video playback windows are not selected as merge targets. - Bump the Python package and extension manifest versions to 0.12.2. - Add regression coverage for browser selection and focus-stealing behavior.
This commit is contained in:
@@ -132,6 +132,44 @@ def test_send_command_auto_routes_single_remote_target(monkeypatch):
|
||||
assert sent["_route"] == "work"
|
||||
assert "token" not in sent
|
||||
|
||||
def test_send_command_uses_env_profile_for_local_transport(monkeypatch):
|
||||
monkeypatch.delenv("BROWSER_CLI_REMOTE", raising=False)
|
||||
monkeypatch.setenv("BROWSER_CLI_PROFILE", "work")
|
||||
seen = {}
|
||||
|
||||
def fake_send_local(profile, payload, resolve_socket):
|
||||
seen["profile"] = profile
|
||||
seen["payload"] = json.loads(payload)
|
||||
return json.dumps({"success": True, "data": "ok"}).encode("utf-8")
|
||||
|
||||
monkeypatch.setattr("browser_cli.client.targets.is_active_local_profile", lambda profile: True)
|
||||
monkeypatch.setattr("browser_cli.client.core.local_transport.send_local_sync", fake_send_local)
|
||||
|
||||
assert send_command("tabs.list") == "ok"
|
||||
assert seen["profile"] == "work"
|
||||
assert seen["payload"]["command"] == "tabs.list"
|
||||
|
||||
async def _async_local_profile_result(monkeypatch):
|
||||
seen = {}
|
||||
|
||||
async def fake_send_local(profile, payload, resolve_socket):
|
||||
seen["profile"] = profile
|
||||
return json.dumps({"success": True, "data": "ok"}).encode("utf-8")
|
||||
|
||||
monkeypatch.setattr("browser_cli.client.targets.is_active_local_profile", lambda profile: True)
|
||||
monkeypatch.setattr("browser_cli.client.core.local_transport.send_local_async", fake_send_local)
|
||||
result = await send_command_async("tabs.list")
|
||||
return result, seen
|
||||
|
||||
def test_send_command_async_uses_env_profile_for_local_transport(monkeypatch):
|
||||
monkeypatch.delenv("BROWSER_CLI_REMOTE", raising=False)
|
||||
monkeypatch.setenv("BROWSER_CLI_PROFILE", "work")
|
||||
|
||||
result, seen = asyncio.run(_async_local_profile_result(monkeypatch))
|
||||
|
||||
assert result == "ok"
|
||||
assert seen["profile"] == "work"
|
||||
|
||||
def test_send_command_prefers_active_local_profile_over_saved_remote_alias(monkeypatch, tmp_path):
|
||||
monkeypatch.delenv("BROWSER_CLI_REMOTE", raising=False)
|
||||
monkeypatch.delenv("BROWSER_CLI_PROFILE", raising=False)
|
||||
|
||||
Reference in New Issue
Block a user