4cd2d4af2b
Test Browser Use CLI Install / uv pip install (macos-latest) (push) Waiting to run
Test Browser Use CLI Install / uv pip install (windows-latest) (push) Waiting to run
Test Browser Use CLI Install / uv pip install (ubuntu-latest) (push) Failing after 1s
Test Browser Use CLI Install / uvx browser-use from local wheel (push) Failing after 1s
Test Browser Use CLI Install / uvx browser-use[cli] from PyPI (push) Failing after 1s
package / pip-install-on-macos-latest-py-3.11 (push) Has been skipped
package / pip-install-on-macos-latest-py-3.13 (push) Has been skipped
package / pip-install-on-ubuntu-latest-py-3.11 (push) Has been skipped
package / pip-install-on-windows-latest-py-3.13 (push) Has been skipped
cloud_evals / trigger_cloud_eval_image_build (push) Failing after 1s
docker / build_publish_image (push) Failing after 1s
Test Browser Use CLI Install / browser-use skill sync (push) Failing after 1s
lint / code-style (push) Failing after 0s
lint / type-checker (push) Failing after 1s
package / pip-build (push) Failing after 1s
lint / syntax-errors (push) Failing after 3s
package / pip-install-on-ubuntu-latest-py-3.13 (push) Has been skipped
package / pip-install-on-windows-latest-py-3.11 (push) Has been skipped
test / ${{ matrix.test_filename }} (push) Has been skipped
test / evaluate-tasks (push) Has been skipped
test / setup-chromium (push) Failing after 2s
test / find_tests (push) Failing after 2s
55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
from browser_use.browser import chrome
|
|
|
|
|
|
def test_macos_profile_path_matches_detected_browser_variant(monkeypatch, tmp_path):
|
|
monkeypatch.setattr(chrome.platform, 'system', lambda: 'Darwin')
|
|
monkeypatch.setattr(Path, 'home', lambda: tmp_path)
|
|
|
|
assert chrome.get_chrome_profile_path(
|
|
None,
|
|
executable_path='/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
) == str(tmp_path / 'Library' / 'Application Support' / 'Chromium')
|
|
assert chrome.get_chrome_profile_path(
|
|
None,
|
|
executable_path='/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
|
|
) == str(tmp_path / 'Library' / 'Application Support' / 'Google' / 'Chrome Canary')
|
|
assert chrome.get_chrome_profile_path(
|
|
None,
|
|
executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
) == str(tmp_path / 'Library' / 'Application Support' / 'Google' / 'Chrome')
|
|
|
|
|
|
def test_list_chrome_profiles_uses_detected_browser_variant(monkeypatch, tmp_path):
|
|
monkeypatch.setattr(chrome.platform, 'system', lambda: 'Darwin')
|
|
monkeypatch.setattr(Path, 'home', lambda: tmp_path)
|
|
monkeypatch.setattr(chrome, 'find_chrome_executable', lambda: '/Applications/Chromium.app/Contents/MacOS/Chromium')
|
|
|
|
user_data_dir = tmp_path / 'Library' / 'Application Support' / 'Chromium'
|
|
user_data_dir.mkdir(parents=True)
|
|
(user_data_dir / 'Local State').write_text(
|
|
json.dumps({'profile': {'info_cache': {'Profile 1': {'name': 'Work'}}}}),
|
|
encoding='utf-8',
|
|
)
|
|
|
|
assert chrome.list_chrome_profiles() == [{'directory': 'Profile 1', 'name': 'Work'}]
|
|
|
|
|
|
def test_list_chrome_profiles_returns_empty_for_unexpected_json_shapes(monkeypatch, tmp_path):
|
|
monkeypatch.setattr(chrome.platform, 'system', lambda: 'Darwin')
|
|
monkeypatch.setattr(Path, 'home', lambda: tmp_path)
|
|
monkeypatch.setattr(chrome, 'find_chrome_executable', lambda: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')
|
|
|
|
user_data_dir = tmp_path / 'Library' / 'Application Support' / 'Google' / 'Chrome'
|
|
user_data_dir.mkdir(parents=True)
|
|
|
|
for payload in (
|
|
[],
|
|
{'profile': {'info_cache': []}},
|
|
{'profile': {'info_cache': {'Default': []}}},
|
|
):
|
|
(user_data_dir / 'Local State').write_text(json.dumps(payload), encoding='utf-8')
|
|
assert chrome.list_chrome_profiles() == []
|