webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

The first pointerMove action at (0,0) is "no-op" action?

Open EdgarChen opened this issue 4 years ago • 1 comments

Consider the following code,

new test_driver.Actions().pointerMove(0, 0).send();

Per spec, the x and y of new created input source state are both initialized to 0. And the first pointer move action is also at (0,0), so perform-a-pointer-move ignores this action in step 7,

If x is not equal to current x or y is not equal to current y, run the following steps:

There is a similar usage in https://github.com/web-platform-tests/wpt/blob/15a842eb41aacf39ae345e76611c564fddbde70b/pointerevents/pointerevent_setpointercapture_inactive_button_mouse.html#L42 where test expects a pointer event generated at (0,0), not a no-op action, and ChromeDriver seems behave the same given Chrome could pass this test. But Gecko couldn't pass given GeckoDriver follows the spec.

So file this issue to clarify if it is the behavior we expect or actually a spec issue. Thanks.

EdgarChen avatar Sep 17 '20 12:09 EdgarChen

The problem encountered in the test is actually due to how the WPT harness constructs action sequences. See https://github.com/web-platform-tests/wpt/issues/25651

mjzffr avatar Sep 21 '20 14:09 mjzffr

I wonder if we actually should have an uninitialized field as part of the pointer input source, or initialize the x and y coordinates with a negative values like -1 to allow a movement of the mouse to 0 / 0. Pointer coordinates shouldn't be negative, right?

whimboo avatar Sep 11 '23 14:09 whimboo

So there is actually the restriction of x and y being an unsigned integer so that we cannot set the default value to a negative number. Also having to check for an uninitialized flag also doesn't sound great.

As such we should figure out if the current behavior is expected or not. As we have seen at least for Chrome the initial move to 0 / 0 results in a mousemove event, which is actually wrong according to the spec. The default coordinates for both x and y is 0, and when trying to run a pointer move action the step 7 should not be true and as such no event fired.

@sadym-chromium and @nechaev-chromium, is there a reason why Chrome behaves different here?

I've pushed https://github.com/web-platform-tests/wpt/pull/42579 as draft PR to see the results for all the browsers.

whimboo avatar Oct 17 '23 09:10 whimboo

I've pushed web-platform-tests/wpt#42579 as draft PR to see the results for all the browsers.

As it can be seen the test fails for Chrome. Sadly no Safari results are present but when I run the test with Safari it passes as well. So is that a bug in chromedriver?

whimboo avatar Oct 17 '23 10:10 whimboo

Official test results of the newly added tests are available now on wpt.fyi:

https://wpt.fyi/results/webdriver/tests/classic/perform_actions/pointer_mouse.py?label=master&label=experimental&aligned

As it can be seen both Firefox and Safari are compliant to the WebDriver specification while Chrome and Edge show a misbehavior.

whimboo avatar Oct 25 '23 08:10 whimboo

With the newly added test for WebDriver BiDi (via https://github.com/web-platform-tests/wpt/pull/43018) it has been shown that this is indeed a WebDriver classic only issue with Chromedriver.

whimboo avatar Nov 08 '23 11:11 whimboo

Given that the extra event is a bug in chromedriver I've filed https://bugs.chromium.org/p/chromedriver/issues/detail?id=4618

I assume that going forward we want to keep this initial move as a no-op action? If yes we should close this issue.

whimboo avatar Nov 08 '23 13:11 whimboo

Official test results of the newly added tests are available now on wpt.fyi:

https://wpt.fyi/results/webdriver/tests/classic/perform_actions/pointer_mouse.py?label=master&label=experimental&aligned

As it can be seen both Firefox and Safari are compliant to the WebDriver specification while Chrome and Edge show a misbehavior.

The test_move_to_position_in_viewport[default value] subtest, I presume?

gsnedders avatar Nov 08 '23 13:11 gsnedders

Official test results of the newly added tests are available now on wpt.fyi: https://wpt.fyi/results/webdriver/tests/classic/perform_actions/pointer_mouse.py?label=master&label=experimental&aligned As it can be seen both Firefox and Safari are compliant to the WebDriver specification while Chrome and Edge show a misbehavior.

The test_move_to_position_in_viewport[default value] subtest, I presume?

Yes, sorry for not being that precise.

Given that we are in agreement lets close this issue as expected behavior.

whimboo avatar Nov 08 '23 14:11 whimboo