Title: [255545] trunk/LayoutTests
Revision
255545
Author
[email protected]
Date
2020-02-01 16:56:13 -0800 (Sat, 01 Feb 2020)

Log Message

fast/events/touch/ios/long-press-on-link.html consistently times out after r254699
https://bugs.webkit.org/show_bug.cgi?id=207095

Reviewed by Darin Adler.

After <https://trac.webkit.org/r254699>, tests that end without causing presented view controllers to dismiss
will always cause the subsequent test to time out. This happens all the time with the layout test
fast/events/touch/ios/long-press-on-link.html, which runs after fast/events/touch/ios/long-press-on-image.html;
both of these tests long press previewable elements to present a context menu, but don't attempt to dismiss
these previews.

Address this by tapping at the web view's origin after ending the long press gesture, which causes the preview
view controllers that were presented by the test to dismiss.

* fast/events/touch/ios/long-press-on-image-expected.txt:
* fast/events/touch/ios/long-press-on-image.html:
* fast/events/touch/ios/long-press-on-link-expected.txt:
* fast/events/touch/ios/long-press-on-link.html:

Modernize these layout tests by adopting helper methods for driving interaction (instead of directly using
testRunner.runUIScript). Also, use the testing helpers in `js-test.js`, and add descriptions to each test.

* resources/ui-helper.js:
(window.UIHelper.longPressAndGetContextMenuContentAt.return.new.Promise):
(window.UIHelper.longPressAndGetContextMenuContentAt):

Make this resolve the promise to a parsed JSON object instead of a JSON string. Currently, the result is a JSON
string that is parsed at each call site.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (255544 => 255545)


--- trunk/LayoutTests/ChangeLog	2020-02-02 00:20:04 UTC (rev 255544)
+++ trunk/LayoutTests/ChangeLog	2020-02-02 00:56:13 UTC (rev 255545)
@@ -1,3 +1,34 @@
+2020-02-01  Wenson Hsieh  <[email protected]>
+
+        fast/events/touch/ios/long-press-on-link.html consistently times out after r254699
+        https://bugs.webkit.org/show_bug.cgi?id=207095
+
+        Reviewed by Darin Adler.
+
+        After <https://trac.webkit.org/r254699>, tests that end without causing presented view controllers to dismiss
+        will always cause the subsequent test to time out. This happens all the time with the layout test
+        fast/events/touch/ios/long-press-on-link.html, which runs after fast/events/touch/ios/long-press-on-image.html;
+        both of these tests long press previewable elements to present a context menu, but don't attempt to dismiss
+        these previews.
+
+        Address this by tapping at the web view's origin after ending the long press gesture, which causes the preview
+        view controllers that were presented by the test to dismiss.
+
+        * fast/events/touch/ios/long-press-on-image-expected.txt:
+        * fast/events/touch/ios/long-press-on-image.html:
+        * fast/events/touch/ios/long-press-on-link-expected.txt:
+        * fast/events/touch/ios/long-press-on-link.html:
+
+        Modernize these layout tests by adopting helper methods for driving interaction (instead of directly using
+        testRunner.runUIScript). Also, use the testing helpers in `js-test.js`, and add descriptions to each test.
+
+        * resources/ui-helper.js:
+        (window.UIHelper.longPressAndGetContextMenuContentAt.return.new.Promise):
+        (window.UIHelper.longPressAndGetContextMenuContentAt):
+
+        Make this resolve the promise to a parsed JSON object instead of a JSON string. Currently, the result is a JSON
+        string that is parsed at each call site.
+
 2020-02-01  Alexey Shvayka  <[email protected]>
 
         Non-alphabetical \c escapes should be syntax errors in Unicode patterns only

Modified: trunk/LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt (255544 => 255545)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt	2020-02-02 00:20:04 UTC (rev 255544)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt	2020-02-02 00:56:13 UTC (rev 255545)
@@ -1 +1,10 @@
-PASS: context menu triggered on image
+Verifies that long pressing an image presents a context menu that shows the image name. To manually test, long press on the image.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS context menu triggered on image
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/fast/events/touch/ios/long-press-on-image.html (255544 => 255545)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-on-image.html	2020-02-02 00:20:04 UTC (rev 255544)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-on-image.html	2020-02-02 00:56:13 UTC (rev 255545)
@@ -1,60 +1,45 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true runSingly=true ] -->
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
 <meta charset="utf-8">
-
 <html>
 <head>
+    <meta name="viewport" content="initial-scale=1">
+    <script src=""
+    <script src=""
+    <script src=""
+    <style>
+    #target {
+        height: 100px;
+        width: 200px;
+        background-color: silver;
+    }
+    </style>
     <script>
-        if (window.testRunner) {
-            testRunner.dumpAsText();
-            testRunner.waitUntilDone();
-        }
+    jsTestIsAsync = true;
 
-        function getUIScript()
-        {
-            return `
-            (function() {
-                uiController.longPressAtPoint(30, 20, function() {
-                    uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('contextMenu')));
-                });
-             })();`
-        }
+    addEventListener("load", async () => {
+        description("Verifies that long pressing an image presents a context menu that shows the image name. To manually test, long press on the image.");
 
-        function runTest()
-        {
-            if (!testRunner.runUIScript)
-                return;
+        if (!window.testRunner || !testRunner.runUIScript)
+            return;
 
-            var target = document.getElementById('target');
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(getUIScript(), function(result) {
-                    var results = JSON.parse(result).contextMenu;
-                    var output = '';
-                    if (results.imageURL.includes("dice.png") && results.isImage && !results.isLink)
-                        output += 'PASS: context menu triggered on image';
-                    else
-                        output += 'FAIL: context menu was not triggered on image';
+        const targetRect = document.getElementById("target").getBoundingClientRect();
+        const pressPointX = targetRect.x + targetRect.width / 2;
+        const pressPointY = targetRect.y + targetRect.height / 2;
+        const results = (await UIHelper.longPressAndGetContextMenuContentAt(pressPointX, pressPointY)).contextMenu;
+        if (results.imageURL.includes("dice.png") && results.isImage && !results.isLink)
+            testPassed("context menu triggered on image");
+        else
+            testFailed("context menu was not triggered on image");
 
-                    document.getElementById('target').innerHTML = output;
-                    testRunner.notifyDone();
-                });
-            }
-        }
-
-        window.addEventListener('load', runTest, false);
+        await liftUpAtPoint(pressPointX, pressPointY);
+        await UIHelper.activateAt(0, 0);
+        finishJSTest();
+    });
     </script>
-    <style>
-        #target {
-            height: 100px;
-            width: 200px;
-            background-color: silver;
-        }
-    </style>
-    <meta name="viewport" content="initial-scale=1">
 </head>
 <body>
 <div id="target">
     <img src="" width="320" height="240" alt="Dice">
-    This test requires UIScriptController to run.
 </div>
 </body>
 </html>

Modified: trunk/LayoutTests/fast/events/touch/ios/long-press-on-link-expected.txt (255544 => 255545)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-on-link-expected.txt	2020-02-02 00:20:04 UTC (rev 255544)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-on-link-expected.txt	2020-02-02 00:56:13 UTC (rev 255545)
@@ -1 +1,10 @@
-PASS: correct page loaded in popover
+Verifies that long pressing a link presents a context menu that shows the link URL. To manually test, long press on the link. The context menu should show a preview for http://localhost:54321/.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS correct page loaded in preview
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Link Test

Modified: trunk/LayoutTests/fast/events/touch/ios/long-press-on-link.html (255544 => 255545)


--- trunk/LayoutTests/fast/events/touch/ios/long-press-on-link.html	2020-02-02 00:20:04 UTC (rev 255544)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-on-link.html	2020-02-02 00:56:13 UTC (rev 255545)
@@ -1,51 +1,45 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true runSingly=true ] -->
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
 
 <html>
 <head>
+    <meta name="viewport" content="initial-scale=1">
     <script src=""
     <script src=""
+    <script src=""
+    <style>
+    #target {
+        height: 100px;
+        width: 200px;
+        background-color: silver;
+    }
+    </style>
     <script>
-        if (window.testRunner) {
-            testRunner.dumpAsText();
-            testRunner.waitUntilDone();
-        }
+    jsTestIsAsync = true;
 
-        async function runTest()
-        {
-            if (!testRunner.runUIScript)
-                return;
+    addEventListener("load", async () => {
+        description("Verifies that long pressing a link presents a context menu that shows the link URL. To manually test, long press on the link. The context menu should show a preview for http://localhost:54321/.");
 
-            let output = '';
-            let target = document.getElementById('target');
-            let targetRect = document.getElementById('targetRect').getBoundingClientRect();
-            let pressPointX = targetRect.x + targetRect.width / 2;
-            let pressPointY = targetRect.y + targetRect.height / 2;
+        if (!window.testRunner || !testRunner.runUIScript)
+            return;
 
-            let result = await UIHelper.longPressAndGetContextMenuContentAt(pressPointX, pressPointY);
-            let results = JSON.parse(result).contextMenu;
-            if (results.url == 'http://localhost:54321/' && results.isLink)
-                output += 'PASS: correct page loaded in popover';
-            document.getElementById('target').innerHTML = output;
+        const targetRect = document.getElementById("targetRect").getBoundingClientRect();
+        const pressPointX = targetRect.x + targetRect.width / 2;
+        const pressPointY = targetRect.y + targetRect.height / 2;
+        const results = (await UIHelper.longPressAndGetContextMenuContentAt(pressPointX, pressPointY)).contextMenu;
+        if (results.url == "http://localhost:54321/" && results.isLink)
+            testPassed("correct page loaded in preview");
+        else
+            testFailed("did not load correct page");
 
-            await liftUpAtPoint(pressPointX, pressPointY);
-            testRunner.notifyDone();
-        }
-
-        window.addEventListener('load', runTest, false);
+        await liftUpAtPoint(pressPointX, pressPointY);
+        await UIHelper.activateAt(0, 0);
+        finishJSTest();
+    });
     </script>
-    <style>
-        #target {
-            height: 100px;
-            width: 200px;
-            background-color: silver;
-        }
-    </style>
-    <meta name="viewport" content="initial-scale=1">
 </head>
 <body>
 <div id="target">
     <a id="targetRect" href="" Test</a>
-    This test requires UIScriptController to run.
 </div>
 </body>
 </html>

Modified: trunk/LayoutTests/resources/ui-helper.js (255544 => 255545)


--- trunk/LayoutTests/resources/ui-helper.js	2020-02-02 00:20:04 UTC (rev 255544)
+++ trunk/LayoutTests/resources/ui-helper.js	2020-02-02 00:56:13 UTC (rev 255545)
@@ -356,7 +356,7 @@
                     uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('contextMenu')));
                 };
                 uiController.longPressAtPoint(${x}, ${y}, function() { });
-            })();`, resolve);
+            })();`, result => resolve(JSON.parse(result)));
         });
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to