[webkit-dev] Use LayoutTests/resources/ui-helper.js to tap or click an element regardless of platform

Yusuke SUZUKI utatane.tea at gmail.com
Tue Dec 13 23:13:34 PST 2016


In UIHelper, we heavily use Promises.
I think we can further simplify the test code with async/await.

For example,

UIHelper.wait(async function () {
    await UIHelper.activateAt(shadowHost.offsetLeft + 5,
shadowHost.offsetTop + 5);
    await UIHelper.activateAt(shadowHost.offsetLeft + 25,
shadowHost.offsetTop + 25);

Yusuke Suzuki

On Wed, Dec 14, 2016 at 3:55 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:

> Hi,
> I added a little helper class called UIHelper in https://trac.webkit.org/
> changeset/209780 to provide an abstraction around eventSender and
> UIScriptController so that you can trigger a click or a tap at a specified
> coordinate without having to worry about which platform you’re on.
> This is useful if the only thing you’re trying to do is to activate some
> element (e.g. hyperlink, click event handler, etc…) in both DumpRenderTree
> and WebKitTestRunner on both macOS and iOS.
> *Background*: iOS WebKit2 port doesn’t have eventSender due to its
> architecture.  As a result, we have UIScriptController which executes
> JavaScript in the UIProcess to trigger key events and touch there.
> However, Mac port’s WebKitTestRunner doesn’t support tap (due to the lack
> of support for touch events).  Furthermore, UIScriptController isn’t
> available in DumpRenderTree on both macOS and iOS.  This makes writing a
> test to activate an element via user interaction that works in
> DumpRenderTree and WebKitTestRunner across macOS and iOS extremely
> challenging.  UIHelper script I added will make this easier by providing an
> abstraction around eventSender and UIScriptController by wrapping those
> internal APIs.
> - R. Niwa
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20161214/d86e5bf9/attachment.html>

More information about the webkit-dev mailing list