On 04/12/2018 02:23, Masayuki Nakano wrote:
On 2018/11/30 20:42, James Graham wrote:
On 30/11/2018 01:37, Masayuki Nakano wrote:
web-platform-tests: N/A due to requiring user input, but we have
mochitests with synthesized events.
I think it should be possible to write web-platform-tests for this
kind of thing now, using the testdriver API and in particular the
actions support see e.g. [1], [2]
If this still doesn't meet your use case please let me know because we
should work out how to make testing this kind of stuff possible
cross-browser; as you well know UI events have been an interop
nightmare in the past and we can't afford to let that situation
continue into the future for new devices and APIs.
[1] https://web-platform-tests.org/writing-tests/testdriver.html
[2]
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/infrastructure/testdriver/actions/multiDevice.html
Thank you for the information.
I'm looking for the implementation of the keyboard event dispatchers,
but I've not found it yet. Could you let me know where it is?
So, the full picture is that the test harness provides a js
implementation of the testdriver API action_sequence method [1] which
routes a message to the harness asking it to dispatch some actions. In
the marionette backend this ends up at [2] which sends a
WebDriver:PerformActions command to the browser. That ends up in [3] and
then [4] and [5] which in the case of a key event goes through [6] and,
skipping several layers of setup, eventually [7]. That is ultimately
using nsITextInputProcessor, and the implementation looks extremely
similar to synthesizeKey from EventUtils.js [8].
So I believe that unless one of the intervening layers is doing
something wrong or putting unnecessary constraints on what's possible,
it should be possible to use this API to generate the exact same events
that you would get from EventUtils.js. If there are use cases you are
unable to replicate using the testdriver API please let me know because
they are likely bugs that ought to be fixed; the intent here is that the
events looks as close as possible to real key events generated by real
user interaction.
[1]
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/tools/wptrunner/wptrunner/testdriver-extra.js#75
[2]
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py#374
[3]
https://searchfox.org/mozilla-central/source/testing/marionette/listener.js#776
[4]
https://searchfox.org/mozilla-central/source/testing/marionette/action.js#988
[5]
https://searchfox.org/mozilla-central/source/testing/marionette/action.js#1096
[6]
https://searchfox.org/mozilla-central/source/testing/marionette/action.js#1142
[7]
https://searchfox.org/mozilla-central/source/testing/marionette/event.js#384
[8]
https://searchfox.org/mozilla-central/source/testing/mochitest/tests/SimpleTest/EventUtils.js#850
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform