Files
browser-use__browser-use/tests/ci/test_setup_command.py
ShawnPana 0bf1f02d97 fix: CI failures — ruff formatting, type errors, test_setup_command
- Ruff format all skill_cli and test files
- Fix type: get_config_value returns str|int|None, callers cast properly
- Fix type: BrowserWrapper.actions is non-optional (always provided)
- Fix type: config comparison uses 'is' not '=='
- Rewrite test_setup_command for new setup.handle(yes=True) API
- Add None guard in test_cli_lifecycle for state file
2026-04-01 19:58:33 -07:00

30 lines
799 B
Python

"""Tests for setup command.
Verifies the setup command runs and returns expected structure.
"""
import tempfile
from pathlib import Path
from browser_use.skill_cli.commands import setup
def test_setup_returns_valid_structure(monkeypatch):
"""Test setup handle returns expected result structure."""
with tempfile.TemporaryDirectory(prefix='bu-') as d:
monkeypatch.setenv('BROWSER_USE_HOME', d)
result = setup.handle(yes=True)
assert isinstance(result, dict)
assert 'status' in result or 'error' in result
def test_setup_creates_config(monkeypatch):
"""Test setup creates config.json."""
with tempfile.TemporaryDirectory(prefix='bu-') as d:
monkeypatch.setenv('BROWSER_USE_HOME', d)
setup.handle(yes=True)
config_path = Path(d) / 'config.json'
assert config_path.exists()