Bug 196031

Summary: REGRESSION (r243153): [iPhone] TestWebKitAPI.FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState is failing
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, dbates, thorton, webkit-bot-watchers-bugzilla, webkit-bug-importer
Priority: P2 Keywords: InRadar, PlatformOnly, Regression
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: iOS 12   
See Also: https://bugs.webkit.org/show_bug.cgi?id=195820
Bug Depends on: 195820    
Bug Blocks:    
Attachments:
Description Flags
Patch thorton: review+

Description Ryan Haddad 2019-03-20 13:56:49 PDT
The following API test is failing on iOS bots:

    TestWebKitAPI.FocusPreservationTests.ChangingFocusedNodeResetsFocusPreservationState
        
        /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/ios/FocusPreservationTests.mm:100
        Value of: [webView stringByEvaluatingJavaScript:@"document.activeElement == document.querySelector('select')"].boolValue
          Actual: true
        Expected: false

https://build.webkit.org/builders/Apple%20iOS%2012%20Simulator%20Release%20WK2%20%28Tests%29/builds/3212/steps/run-api-tests/logs/stdio
Comment 1 Ryan Haddad 2019-03-20 13:57:45 PDT
This appears to have started with:
"[iOS] Focus not preserved when switching between tabs"
https://trac.webkit.org/changeset/243153/webkit

Dan, would you please take a look?
Comment 2 Radar WebKit Bug Importer 2019-03-20 14:13:29 PDT
<rdar://problem/49078172>
Comment 3 Daniel Bates 2019-03-20 14:36:19 PDT
(In reply to Ryan Haddad from comment #0)
> The following API test is failing on iOS bots:
> 
>    
> TestWebKitAPI.FocusPreservationTests.
> ChangingFocusedNodeResetsFocusPreservationState
>         
>        
> /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/
> ios/FocusPreservationTests.mm:100
>         Value of: [webView
> stringByEvaluatingJavaScript:@"document.activeElement ==
> document.querySelector('select')"].boolValue
>           Actual: true
>         Expected: false
> 
> https://build.webkit.org/builders/
> Apple%20iOS%2012%20Simulator%20Release%20WK2%20%28Tests%29/builds/3212/steps/
> run-api-tests/logs/stdio

Progression. Will update test.
Comment 4 Daniel Bates 2019-03-20 14:47:17 PDT
(In reply to Daniel Bates from comment #3)
> (In reply to Ryan Haddad from comment #0)
> > The following API test is failing on iOS bots:
> > 
> >    
> > TestWebKitAPI.FocusPreservationTests.
> > ChangingFocusedNodeResetsFocusPreservationState
> >         
> >        
> > /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/
> > ios/FocusPreservationTests.mm:100
> >         Value of: [webView
> > stringByEvaluatingJavaScript:@"document.activeElement ==
> > document.querySelector('select')"].boolValue
> >           Actual: true
> >         Expected: false
> > 
> > https://build.webkit.org/builders/
> > Apple%20iOS%2012%20Simulator%20Release%20WK2%20%28Tests%29/builds/3212/steps/
> > run-api-tests/logs/stdio
> 
> Progression. Will update test.

This would be a progression on iPad, but these tests are run using an iPhone I think so this is a regression.
Comment 5 Daniel Bates 2019-03-20 14:59:47 PDT
Test needs to be updated. It was written with blackbox knowledge of the fact that -[WKWebView resignFirstResponder] is what is called when the <select> picker is dismissed when the Done button is pressed. The test wants to press the Done button, but does it in an indirect way. Need to fix test to do what it actually wants to do.
Comment 6 Daniel Bates 2019-03-20 15:28:38 PDT
Created attachment 365411 [details]
Patch
Comment 7 Daniel Bates 2019-03-20 15:48:11 PDT
Committed r243248: <https://trac.webkit.org/changeset/243248>