Bug 188335 - [iOS] Tests that try to interact with the QuickType bar time out on iOS 11+
Summary: [iOS] Tests that try to interact with the QuickType bar time out on iOS 11+
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-05 18:22 PDT by Wenson Hsieh
Modified: 2018-08-06 10:47 PDT (History)
6 users (show)

See Also:


Attachments
Patch (25.04 KB, patch)
2018-08-05 20:06 PDT, Wenson Hsieh
thorton: review+
Details | Formatted Diff | Diff
Patch for landing (25.80 KB, patch)
2018-08-06 07:22 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2018-08-05 18:22:52 PDT
<rdar://problem/32542437>
Comment 1 Wenson Hsieh 2018-08-05 19:51:51 PDT
...and I might as well fix <rdar://problem/32542433> too while I'm at it.
Comment 2 Wenson Hsieh 2018-08-05 20:06:36 PDT
Created attachment 346610 [details]
Patch
Comment 3 Tim Horton 2018-08-05 21:50:30 PDT
Comment on attachment 346610 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346610&action=review

> LayoutTests/ChangeLog:27
> +        Add a new UIHelper method to type a character using the keyboard. Sends hardware keyboard events on the WebKit2
> +        port of iOS, and uses EventSender elsewhere.

Should we just make EventSender work so the tests don't have to mind? Does that even make sense? (like, is it possible to hide this behind the existing interface)
Comment 4 Wenson Hsieh 2018-08-05 22:03:33 PDT
Comment on attachment 346610 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346610&action=review

>> LayoutTests/ChangeLog:27
>> +        port of iOS, and uses EventSender elsewhere.
> 
> Should we just make EventSender work so the tests don't have to mind? Does that even make sense? (like, is it possible to hide this behind the existing interface)

IIRC, this was my original approach back in 2015, when I prototyped gesture/interaction testing in WK2 iOS. We ultimately went with UIScriptController instead, which offers more flexibility and doesn't limit us to dispatching and waiting for all events to finish synchronously, since its API is all completion-block-based.

In a sense, UIHelper and its static functions help mitigate this schism in testing API by providing ways to simulate cross-platform user interaction, but I think that in the future, we would ideally implement the UIScriptController stubs on macOS so that interactions could be simulated via UIScriptController, and then EventSenderProxy could then be implemented in terms of calls to UIScriptController.
Comment 5 Tim Horton 2018-08-05 22:07:33 PDT
(In reply to Wenson Hsieh from comment #4)
> Comment on attachment 346610 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=346610&action=review
> 
> >> LayoutTests/ChangeLog:27
> >> +        port of iOS, and uses EventSender elsewhere.
> > 
> > Should we just make EventSender work so the tests don't have to mind? Does that even make sense? (like, is it possible to hide this behind the existing interface)
> 
> IIRC, this was my original approach back in 2015, when I prototyped
> gesture/interaction testing in WK2 iOS. We ultimately went with
> UIScriptController instead, which offers more flexibility and doesn't limit
> us to dispatching and waiting for all events to finish synchronously, since
> its API is all completion-block-based.

> In a sense, UIHelper and its static functions help mitigate this schism in

Good point.

> testing API by providing ways to simulate cross-platform user interaction,
> but I think that in the future, we would ideally implement the
> UIScriptController stubs on macOS so that interactions could be simulated
> via UIScriptController, and then EventSenderProxy could then be implemented
> in terms of calls to UIScriptController.

Ah! That sounds like a good plan for maximum flexibility.
Comment 6 Wenson Hsieh 2018-08-06 07:21:59 PDT
Comment on attachment 346610 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346610&action=review

> Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:-393
> -    id UIKeyboardPredictionViewClass = NSClassFromString(@"UIKeyboardPredictionView");

Ah, this means I can also remove the UIKeyboardPredictionView forward declaration in UIKitTestSPI.h...
Comment 7 Wenson Hsieh 2018-08-06 07:22:37 PDT
Created attachment 346626 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2018-08-06 08:01:55 PDT
Comment on attachment 346626 [details]
Patch for landing

Clearing flags on attachment: 346626

Committed r234601: <https://trac.webkit.org/changeset/234601>
Comment 9 Ryan Haddad 2018-08-06 10:34:26 PDT
(In reply to WebKit Commit Bot from comment #8)
> Committed r234601: <https://trac.webkit.org/changeset/234601>

The following API test is timing out on iOS Simulator after this change:

    TestWebKitAPI.KeyboardInputTests.CaretSelectionRectAfterRestoringFirstResponder
        2018-08-06 09:28:39.260 TestWebKitAPI[9284:303241744] Expected a caret rect of {{16, 13}, {3, 15}}, but still observed {{16.000000000000004, 13.000000000000002}, {2.0631577968597412, 15.000000000000002}}

https://build.webkit.org/builders/Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/6630
Comment 10 Wenson Hsieh 2018-08-06 10:35:33 PDT
(In reply to Ryan Haddad from comment #9)
> (In reply to WebKit Commit Bot from comment #8)
> > Committed r234601: <https://trac.webkit.org/changeset/234601>
> 
> The following API test is timing out on iOS Simulator after this change:
> 
>    
> TestWebKitAPI.KeyboardInputTests.
> CaretSelectionRectAfterRestoringFirstResponder
>         2018-08-06 09:28:39.260 TestWebKitAPI[9284:303241744] Expected a
> caret rect of {{16, 13}, {3, 15}}, but still observed {{16.000000000000004,
> 13.000000000000002}, {2.0631577968597412, 15.000000000000002}}
> 
> https://build.webkit.org/builders/
> Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/6630

Taking a look now. Looks like it just needs to be tweaked a bit...
Comment 11 Wenson Hsieh 2018-08-06 10:36:35 PDT
(In reply to Ryan Haddad from comment #9)
> (In reply to WebKit Commit Bot from comment #8)
> > Committed r234601: <https://trac.webkit.org/changeset/234601>
> 
> The following API test is timing out on iOS Simulator after this change:
> 
>    
> TestWebKitAPI.KeyboardInputTests.
> CaretSelectionRectAfterRestoringFirstResponder
>         2018-08-06 09:28:39.260 TestWebKitAPI[9284:303241744] Expected a
> caret rect of {{16, 13}, {3, 15}}, but still observed {{16.000000000000004,
> 13.000000000000002}, {2.0631577968597412, 15.000000000000002}}
> 
> https://build.webkit.org/builders/
> Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/6630

Also, surely you mean after https://trac.webkit.org/changeset/234600/webkit, no?
Comment 12 Ryan Haddad 2018-08-06 10:46:24 PDT
(In reply to Wenson Hsieh from comment #11)
> (In reply to Ryan Haddad from comment #9)
> Also, surely you mean after https://trac.webkit.org/changeset/234600/webkit,
> no?
Indeed, my apologies.
Comment 13 Wenson Hsieh 2018-08-06 10:47:05 PDT
(In reply to Ryan Haddad from comment #12)
> (In reply to Wenson Hsieh from comment #11)
> > (In reply to Ryan Haddad from comment #9)
> > Also, surely you mean after https://trac.webkit.org/changeset/234600/webkit,
> > no?
> Indeed, my apologies.

No worries :)

Migrated the CC's over to that bug.