@@ -34,9 +34,6 @@ def github_login_screenshot(path_fixtures: pathlib.Path) -> Image.Image:
3434 "askui" ,
3535 "anthropic-claude-3-5-sonnet-20241022" ,
3636])
37- @pytest .mark .xfail (
38- reason = "Location may be inconsistent depending on the model used" ,
39- )
4037class TestVisionAgentLocate :
4138 """Test class for VisionAgent.locate() method."""
4239
@@ -47,19 +44,26 @@ def test_locate_with_string_locator(self, vision_agent: VisionAgent, github_logi
4744 assert 450 <= x <= 570
4845 assert 190 <= y <= 260
4946
50- def test_locate_with_class_locator (self , vision_agent : VisionAgent , github_login_screenshot : Image .Image , model_name : str ) -> None :
47+ def test_locate_with_textfield_class_locator (self , vision_agent : VisionAgent , github_login_screenshot : Image .Image , model_name : str ) -> None :
5148 """Test locating elements using a class locator."""
5249 locator = Class ("textfield" )
5350 x , y = vision_agent .locate (locator , github_login_screenshot , model_name = model_name )
5451 assert 50 <= x <= 860 or 350 <= x <= 570 or 350 <= x <= 570
5552 assert 0 <= y <= 80 or 210 <= y <= 280 or 160 <= y <= 230
53+
54+ def test_locate_with_unspecified_class_locator (self , vision_agent : VisionAgent , github_login_screenshot : Image .Image , model_name : str ) -> None :
55+ """Test locating elements using a class locator."""
56+ locator = Class ()
57+ x , y = vision_agent .locate (locator , github_login_screenshot , model_name = model_name )
58+ assert 0 <= x <= github_login_screenshot .width
59+ assert 0 <= y <= github_login_screenshot .height
5660
5761 def test_locate_with_description_locator (self , vision_agent : VisionAgent , github_login_screenshot : Image .Image , model_name : str ) -> None :
5862 """Test locating elements using a description locator."""
59- locator = Description ("Green sign in button " )
63+ locator = Description ("Username textfield " )
6064 x , y = vision_agent .locate (locator , github_login_screenshot , model_name = model_name )
6165 assert 350 <= x <= 570
62- assert 240 <= y <= 310
66+ assert 160 <= y <= 230
6367
6468 def test_locate_with_similar_text_locator (self , vision_agent : VisionAgent , github_login_screenshot : Image .Image , model_name : str ) -> None :
6569 """Test locating elements using a text locator."""
0 commit comments