Fix flakey test fast/events/autoscroll-when-input-is-offscreen.html
https://bugs.webkit.org/show_bug.cgi?id=197897
<rdar://problem/50306931>

Reviewed by Wenson Hsieh.

Programmatic scrolls are included in the transaction and we want to
ensure that they've been applied. Then we can be sure that the page
has finished scrolling and it's appropriate to test the page offset.

* fast/events/autoscroll-when-input-is-offscreen.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index cc5f45a..8d7e3b1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2019-05-14  Megan Gardner  <megan_gardner@apple.com>
+
+        Fix flakey test fast/events/autoscroll-when-input-is-offscreen.html
+        https://bugs.webkit.org/show_bug.cgi?id=197897
+        <rdar://problem/50306931>
+
+        Reviewed by Wenson Hsieh.
+
+        Programmatic scrolls are included in the transaction and we want to 
+        ensure that they've been applied. Then we can be sure that the page 
+        has finished scrolling and it's appropriate to test the page offset. 
+
+        * fast/events/autoscroll-when-input-is-offscreen.html:
+
 2019-05-14  Shawn Roberts  <sroberts@apple.com>
 
         storage/indexeddb/modern/deletedatabase-2-private.html is a flaky failure
diff --git a/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html b/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html
index 1592f00..e816c6e 100644
--- a/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html
+++ b/LayoutTests/fast/events/autoscroll-when-input-is-offscreen.html
@@ -19,11 +19,11 @@
         await UIHelper.setHardwareKeyboardAttached(false);
         await UIHelper.activateElementAndWaitForInputSession(document.getElementById('editable'));
         
-        var programaticScroll = 500;
-        document.scrollingElement.scrollTop = programaticScroll;
+        var programmaticScroll = 500;
+        document.scrollingElement.scrollTop = programmaticScroll;
         await UIHelper.enterText("Test");
-
-        if (window.pageYOffset < programaticScroll)
+        await UIHelper.ensurePresentationUpdate();
+        if (window.pageYOffset < programmaticScroll)
             output += 'PASS: page has scrolled back to the top to show the element that has text being entered into it.';
         else
             output += 'FAIL: page has failed to scroll when entering text into a form that is offscreen.';