@@ -214,18 +214,41 @@ def test_new_request_and_response_types_are_public():
214214 assert "CursorPositionActionResponse" in models .__all__
215215 assert "ScrollAtCursorActionParams" in models .__all__
216216 assert "ScrollAtCursorActionParams" in types .__all__
217+ assert ScrollAtCursorActionParams in get_args (ComputerActionParams )
218+ assert types .ScrollAtCursorActionParams in get_args (types .ComputerActionParams )
217219 assert "ComputerActionResponseDataCursorPosition" in models .__all__
218220
219221
220222@pytest .mark .parametrize ("keys" , [None , [], ["Shift_L" ]])
221- def test_scroll_at_cursor_dict_and_model_wire_parity (keys ):
223+ def test_scroll_at_cursor_dict_and_model_wire_parity (manager , keys ):
224+ driver , session , calls = manager
222225 params = {"action" : "scroll" , "scroll_x" : 0 , "scroll_y" : - 2 }
223226 if keys is not None :
224227 params ["keys" ] = keys
225228 model = ScrollAtCursorActionParams (** params )
226- assert dump_request (
227- params , ScrollAtCursorActionParams , name = "params"
228- ) == dump_request (model , ScrollAtCursorActionParams , name = "params" )
229+ run (driver ._execute_request (session , params ))
230+ run (driver ._execute_request (session , model ))
231+ assert calls [- 1 ] == calls [- 2 ]
232+ assert calls [- 1 ][2 ] == {
233+ "action" : "scroll" ,
234+ "scrollX" : 0 ,
235+ "scrollY" : - 2 ,
236+ "returnScreenshot" : False ,
237+ ** ({"keys" : keys } if keys is not None else {}),
238+ }
239+
240+
241+ @pytest .mark .parametrize ("coordinates" , [{"x" : 10 }, {"y" : 20 }, {"x" : None , "y" : None }])
242+ def test_scroll_requests_reject_incomplete_or_null_coordinates (manager , coordinates ):
243+ driver , session , calls = manager
244+ with pytest .raises (ValueError ):
245+ run (
246+ driver ._execute_request (
247+ session ,
248+ {"action" : "scroll" , "scroll_x" : 0 , "scroll_y" : 1 , ** coordinates },
249+ )
250+ )
251+ assert not calls
229252
230253
231254def test_old_scroll_model_still_requires_coordinates ():
0 commit comments