[iOS] Callout menu overlaps in-page controls when editing a comment in github.com...
[WebKit-https.git] / LayoutTests / resources / ui-helper.js
index 4de0d14..9e5fcbe 100644 (file)
@@ -665,4 +665,24 @@ window.UIHelper = class UIHelper {
         const script = "JSON.stringify([uiController.lastUndoLabel, uiController.firstRedoLabel])";
         return new Promise(resolve => testRunner.runUIScript(script, result => resolve(JSON.parse(result))));
     }
+
+    static waitForMenuToShow()
+    {
+        return new Promise(resolve => {
+            testRunner.runUIScript(`
+                (function() {
+                    if (!uiController.isShowingMenu)
+                        uiController.didShowMenuCallback = () => uiController.uiScriptComplete();
+                    else
+                        uiController.uiScriptComplete();
+                })()`, resolve);
+        });
+    }
+
+    static menuRect()
+    {
+        return new Promise(resolve => {
+            testRunner.runUIScript("JSON.stringify(uiController.menuRect)", result => resolve(JSON.parse(result)));
+        });
+    }
 }