- Revision
- 252496
- Author
- [email protected]
- Date
- 2019-11-15 11:56:09 -0800 (Fri, 15 Nov 2019)
Log Message
[iOS] Two layout tests in editing/selection/ios time out when waiting for selection views to appear
https://bugs.webkit.org/show_bug.cgi?id=204231
<rdar://problem/56096961>
Reviewed by Megan Gardner.
Adjust these layout tests to select text by long pressing, instead of selecting text by tapping a button that
programmatically selects a range of text. The latter only results in platform selection views if the user (or,
in this case, a previous test in the same web view) has already manually selected text. This isn't guaranteed,
given that the previous test may have timed out, or may have different test options which require a new
WKWebView to have been created.
* editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text.html:
* editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text-expected.txt:
* editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text.html:
* resources/ui-helper.js:
(window.UIHelper.async.longPressElement):
(window.UIHelper.async.longPressAtPoint.return.new.Promise.):
(window.UIHelper.async.longPressAtPoint.return.new.Promise):
(window.UIHelper.async.longPressAtPoint):
Also add helper methods in ui-helper.js to trigger long press gestures, so that we can start moving away from
the helper methods in basic-gestures.js.
(window.UIHelper):
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (252495 => 252496)
--- trunk/LayoutTests/ChangeLog 2019-11-15 19:50:20 UTC (rev 252495)
+++ trunk/LayoutTests/ChangeLog 2019-11-15 19:56:09 UTC (rev 252496)
@@ -1,3 +1,31 @@
+2019-11-15 Wenson Hsieh <[email protected]>
+
+ [iOS] Two layout tests in editing/selection/ios time out when waiting for selection views to appear
+ https://bugs.webkit.org/show_bug.cgi?id=204231
+ <rdar://problem/56096961>
+
+ Reviewed by Megan Gardner.
+
+ Adjust these layout tests to select text by long pressing, instead of selecting text by tapping a button that
+ programmatically selects a range of text. The latter only results in platform selection views if the user (or,
+ in this case, a previous test in the same web view) has already manually selected text. This isn't guaranteed,
+ given that the previous test may have timed out, or may have different test options which require a new
+ WKWebView to have been created.
+
+ * editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text.html:
+ * editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text-expected.txt:
+ * editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text.html:
+ * resources/ui-helper.js:
+ (window.UIHelper.async.longPressElement):
+ (window.UIHelper.async.longPressAtPoint.return.new.Promise.):
+ (window.UIHelper.async.longPressAtPoint.return.new.Promise):
+ (window.UIHelper.async.longPressAtPoint):
+
+ Also add helper methods in ui-helper.js to trigger long press gestures, so that we can start moving away from
+ the helper methods in basic-gestures.js.
+
+ (window.UIHelper):
+
2019-11-15 Simon Fraser <[email protected]>
The image is flashing if falls out and has an animation transform: rotate
Modified: trunk/LayoutTests/editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text-expected.txt (252495 => 252496)
--- trunk/LayoutTests/editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text-expected.txt 2019-11-15 19:50:20 UTC (rev 252495)
+++ trunk/LayoutTests/editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text-expected.txt 2019-11-15 19:56:09 UTC (rev 252496)
@@ -1,4 +1,4 @@
-This test verifies that tapping selected non-editable text clears the text selection in the case where the selected text covers the vast majority of visible content. To manually test, tap the button to select the text above, and then tap inside the selection to clear it.
+This test verifies that tapping selected non-editable text clears the text selection in the case where the selected text covers the vast majority of visible content. To manually test, select the text above, and then tap inside the selection to clear it.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text.html (252495 => 252496)
--- trunk/LayoutTests/editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text.html 2019-11-15 19:50:20 UTC (rev 252495)
+++ trunk/LayoutTests/editing/selection/ios/clear-selection-after-tap-in-large-selected-non-editable-text.html 2019-11-15 19:56:09 UTC (rev 252496)
@@ -13,8 +13,9 @@
}
#text {
- font-size: 54px;
+ font-size: 250px;
margin-top: 0;
+ word-wrap: break-word;
}
</style>
<script>
@@ -21,22 +22,16 @@
jsTestIsAsync = true;
addEventListener("load", async () => {
- description("This test verifies that tapping selected non-editable text clears the text selection in the case where the selected text covers the vast majority of visible content. To manually test, tap the button to select the text above, and then tap inside the selection to clear it.");
+ description("This test verifies that tapping selected non-editable text clears the text selection in the case where the selected text covers the vast majority of visible content. To manually test, select the text above, and then tap inside the selection to clear it.");
const text = document.getElementById("text");
- const button = document.querySelector("button");
- button.addEventListener("mousedown", event => {
- getSelection().selectAllChildren(text);
- event.preventDefault();
- button.remove();
- });
-
- await UIHelper.activateElement(button);
+ await UIHelper.longPressElement(text);
await UIHelper.waitForSelectionToAppear();
testPassed("Observed selection.");
- await UIHelper.activateAt(150, 250);
+ await UIHelper.waitForDoubleTapDelay();
+ await UIHelper.activateElement(text);
await UIHelper.waitForSelectionToDisappear();
testPassed("Dismissed selection.");
@@ -46,8 +41,7 @@
</script>
</head>
<body>
-<button>Click to select text</button>
-<p id="text">Here’s to the crazy ones, the misfits, the rebels, the trouble makers, the round pegs in the square holes, the ones who see things differently. There not fond of rules, and they have no respect for the status quo, you can quote then, disagree with them, glorify or vilify them, about the only thing you can’t do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world are the ones who do.</p>
+<p id="text">Select</p>
<p id="description"></p>
<p id="console"></p>
</body>
Modified: trunk/LayoutTests/editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text-expected.txt (252495 => 252496)
--- trunk/LayoutTests/editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text-expected.txt 2019-11-15 19:50:20 UTC (rev 252495)
+++ trunk/LayoutTests/editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text-expected.txt 2019-11-15 19:56:09 UTC (rev 252496)
@@ -1,11 +1,12 @@
-This test verifies that tapping selected non-editable text toggles callout bar visibility. To manually test, tap the button to select the text above, and then tap inside the selection to show the callout bar; tap inside the selection again to dismiss the callout bar, and finally tap outside of the selected text to clear the selection.
+This test verifies that tapping selected non-editable text toggles callout bar visibility. To manually test, select the text above, and wait for the callout bar to show; tap inside the selection to dismiss the callout bar, tap to show the callout bar again, and finally tap outside of the selected text to clear the selection.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Observed selection.
-PASS Showed callout bar after first tap in selection.
-PASS Dismissed callout bar after second tap in selection.
+PASS Showed callout bar after selecting text.
+PASS Dismissed callout bar after tap in selected text.
+PASS Showed callout bar after second tap in selected text.
PASS Dismissed selection after tap outside of selection.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text.html (252495 => 252496)
--- trunk/LayoutTests/editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text.html 2019-11-15 19:50:20 UTC (rev 252495)
+++ trunk/LayoutTests/editing/selection/ios/toggle-callout-bar-after-tap-in-selected-non-editable-text.html 2019-11-15 19:56:09 UTC (rev 252496)
@@ -11,35 +11,42 @@
height: 100%;
margin: 0;
}
+
+#text {
+ font-size: 120px;
+ margin: 0;
+}
+
+#target {
+ margin-top: 100px;
+}
+text
</style>
<script>
jsTestIsAsync = true;
addEventListener("load", async () => {
- description("This test verifies that tapping selected non-editable text toggles callout bar visibility. To manually test, tap the button to select the text above, and then tap inside the selection to show the callout bar; tap inside the selection again to dismiss the callout bar, and finally tap outside of the selected text to clear the selection.");
+ description("This test verifies that tapping selected non-editable text toggles callout bar visibility. To manually test, select the text above, and wait for the callout bar to show; tap inside the selection to dismiss the callout bar, tap to show the callout bar again, and finally tap outside of the selected text to clear the selection.");
const text = document.getElementById("text");
- const button = document.querySelector("button");
const target = document.getElementById("target");
- button.addEventListener("mousedown", event => {
- getSelection().selectAllChildren(text);
- event.preventDefault();
- button.remove();
- });
-
- await UIHelper.activateElement(button);
+ await UIHelper.longPressElement(text);
await UIHelper.waitForSelectionToAppear();
testPassed("Observed selection.");
- await UIHelper.activateElement(text);
await UIHelper.waitForMenuToShow();
- testPassed("Showed callout bar after first tap in selection.");
+ testPassed("Showed callout bar after selecting text.");
await UIHelper.activateElement(text);
await UIHelper.waitForMenuToHide();
- testPassed("Dismissed callout bar after second tap in selection.");
+ testPassed("Dismissed callout bar after tap in selected text.");
+ await UIHelper.waitForDoubleTapDelay();
+ await UIHelper.activateElement(text);
+ await UIHelper.waitForMenuToShow();
+ testPassed("Showed callout bar after second tap in selected text.");
+
await UIHelper.activateElement(target);
await UIHelper.waitForSelectionToDisappear();
testPassed("Dismissed selection after tap outside of selection.");
@@ -51,8 +58,7 @@
</script>
</head>
<body>
-<button>Click to select text</button>
-<p id="text">Here’s to the crazy ones, the misfits, the rebels, the trouble makers, the round pegs in the square holes, the ones who see things differently. There not fond of rules, and they have no respect for the status quo, you can quote then, disagree with them, glorify or vilify them, about the only thing you can’t do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world are the ones who do.</p>
+<p id="text">Select</p>
<div id="target">Then click here</div>
<p id="description"></p>
<p id="console"></p>
Modified: trunk/LayoutTests/resources/ui-helper.js (252495 => 252496)
--- trunk/LayoutTests/resources/ui-helper.js 2019-11-15 19:50:20 UTC (rev 252495)
+++ trunk/LayoutTests/resources/ui-helper.js 2019-11-15 19:56:09 UTC (rev 252496)
@@ -1067,4 +1067,21 @@
testRunner.runUIScript(`uiController.setContinuousSpellCheckingEnabled(${enabled})`, resolve);
});
}
+
+ static async longPressElement(element)
+ {
+ return this.longPressAtPoint(element.offsetLeft + element.offsetWidth / 2, element.offsetTop + element.offsetHeight / 2);
+ }
+
+ static async longPressAtPoint(x, y)
+ {
+ return new Promise(resolve => {
+ testRunner.runUIScript(`
+ (function() {
+ uiController.longPressAtPoint(${x}, ${y}, function() {
+ uiController.uiScriptComplete();
+ });
+ })();`, resolve);
+ });
+ }
}