fix(v2): botBrowser refuses a negative volume level

level=-10 was read as 10 (the sign was dropped) and unmuted the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-19 01:02:01 +09:00
parent 912b3304ac
commit 218e7734be
3 changed files with 7 additions and 5 deletions

View File

@@ -203,8 +203,10 @@ def test_volume_sets_the_sound_of_the_page_to_the_level_asked(fake):
BotBrowserTool().run({"action": "volume", "level": "30%"}, ctx())
BotBrowserTool().run({"action": "volume", "level": 250}, ctx())
assert fake.calls[1:] == [("volume", 30), ("volume", 100)]
bad = BotBrowserTool().run({"action": "volume"}, ctx())
assert not bad.success and len(fake.calls) == 3
for missing in ({"action": "volume"}, {"action": "volume", "level": -10}, {"action": "volume", "level": "-5%"}):
bad = BotBrowserTool().run(missing, ctx())
assert not bad.success, missing
assert len(fake.calls) == 3
def test_the_volume_of_sound_that_plays_is_reported(fake):