Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhoangt committed Nov 28, 2024
1 parent ce3d7f3 commit cd33d61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions browsergym/core/src/browsergym/core/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def __init__(
shape=(-1, -1, 3),
dtype=np.uint8,
), # swapped axes (height, width, RGB)
"mouse_position": gym.spaces.Sequence(
Float()
),
"dom_object": AnyDict(),
"axtree_object": AnyDict(),
"extra_element_properties": AnyDict(),
Expand Down
4 changes: 3 additions & 1 deletion tests/core/test_actions_highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# register openended gym environments
import browsergym.core
from browsergym.core.action.highlevel import HighLevelActionSet
from browsergym.core.action.parsers import NamedArgument, highlevel_action_parser
from browsergym.core.action.parsers import (NamedArgument,
highlevel_action_parser)
from browsergym.core.constants import BROWSERGYM_ID_ATTRIBUTE as BID_ATTR
from browsergym.utils.obs import flatten_dom_to_str

Expand Down Expand Up @@ -1141,6 +1142,7 @@ def get_checkbox_elem(obs):

obs, reward, term, trunc, info = env.step(action)
checkbox = get_checkbox_elem(obs)
assert obs['mouse_position'] == [x, y]

# box not checked
assert not obs["last_action_error"]
Expand Down

0 comments on commit cd33d61

Please sign in to comment.