Closed Bug 1793835 Opened 2 years ago Closed 2 years ago

Intermittent /web-platform/tests/webdriver/tests/perform_actions/pointer_tripleclick.py | test_tripleclick_at_coordinates - InvalidArgumentException: invalid argument (400): data did not match any variant of untagged enum PointerActionItem at line 1 colum

Categories

(Remote Protocol :: Marionette, defect)

Default
defect

Tracking

(firefox107 disabled, firefox108 fixed)

RESOLVED FIXED
108 Branch
Tracking Status
firefox107 --- disabled
firefox108 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

The test is currently marked as failing.

 0:15.23 pid:59962 1664998111424	webdriver::server	DEBUG	-> POST /session/b90081eb-00cd-4201-874a-8e0b15be3d45/actions {"actions": [{"type": "pointer", "id": "pointer_id", "actions": [{"type": "pointerMove", "x": 400.0, "y": 27.0}, {"type": "pointerDown", "button": 0}, {"type": "pointerUp", "button": 0}, {"type": "pointerDown", "button": 0}, {"type": "pointerUp", "button": 0}, {"type": "pointerDown", "button": 0}, {"type": "pointerUp", "button": 0}], "parameters": {"pointerType": "mouse"}}]}
 0:15.23 pid:59962 1664998111424	webdriver::server	DEBUG	<- 400 Bad Request {"value":{"error":"invalid argument","message":"data did not match any variant of untagged enum PointerActionItem at line 1 column 375","stacktrace":""}}

The problem here is the initial PointerMove action which has the x and y values as floating points:
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/webdriver/tests/perform_actions/pointer_tripleclick.py#26

While the test converts the calculated center x and y values to int we still have an addition with the original x and y position of the element, which results in a floating number again. Per spec the Pointer Move action requires an integer.

Now there is the question why Pointer Move requires the position to be integers and not floating point values?

Flags: needinfo?(james)

It requires them to be integers because we only allow integer coordinates (as per the definitions of the related events), and although e.g. 1.0 is probably fine, 1.5 isn't, so it's easier to check for non-integer values than make some "is close enough to an integer that we'll allow it" check.

Having said that Chrome does seem to pass this test: https://wpt.fyi/results/webdriver/tests/perform_actions/pointer_tripleclick.py?label=master&label=experimental&aligned&view=subtest&q=%2Fwebdriver%2Ftests%2Fperform_actions%2Fpointer_tripleclick.py It would be interesting to know what they're doing for conversion e.g. is it round or floor, or something else? We could change the spec to match if we think the current behaviour is too restrictive.

It's also possible that this is an unnecessary or unhelpful restriction in these days of high dpi displays where we can have multiple physical pixels per CSS pixel, in which case we should probably really allow floats. But that's definitely a WG discussion question.

Flags: needinfo?(james)

Hi Maksim, could you maybe check James' question regarding Chrome? It would be good to know why Chrome currently passes this test. Thanks.

Flags: needinfo?(sadym)

It looks like ChromeDriver implicitly casts x and y from double to int, which ends up with flooring them:
https://source.chromium.org/chromium/chromium/src/+/main:chrome/test/chromedriver/window_commands.cc;drc=cedd38c9e15096e947a62529490a0fd84b743c3f;l=1117

Flags: needinfo?(sadym)

Thanks Maksim! As such I would suggest that we update the test for now and call math.floor() when calculating the x and y coordinates.

Note that with the above change the test still fails with Firefox:

0:22.73 INFO STDOUT:         actual_text = session.execute_script("return document.getSelection().toString();")
 0:22.73 INFO STDOUT:
 0:22.73 INFO STDOUT: >       assert lots_of_text == actual_text
 0:22.73 INFO STDOUT: E       AssertionError: assert ('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod '\n 'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, '\n 'quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo '\n 'consequat.') == ''
 0:22.73 INFO STDOUT: E         + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

First I thought it's because of the browser.triple_click_selects_paragraph preference but that's not the case. I'll file a follow-up bug to handle that case.

Blocks: 1795327

(In reply to James Graham [:jgraham] from comment #2)

It's also possible that this is an unnecessary or unhelpful restriction in these days of high dpi displays where we can have multiple physical pixels per CSS pixel, in which case we should probably really allow floats. But that's definitely a WG discussion question.

I've filed https://github.com/w3c/webdriver/issues/1690 for the discussion.

No longer blocks: 1795327
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a052247fef33 [wdspec] Fix test_tripleclick_at_coordinates for "data did not match any variant of untagged enum PointerActionItem". r=webdriver-reviewers,jgraham
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36617 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot

This is fixed now.

Assignee: nobody → hskupin
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
Moving bug to Remote Protocol::Marionette component per bug 1815831.
Component: geckodriver → Marionette
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: