Commit 004e3c45 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Add a WPT test to verify the text editing commands in infrastructure/

We should have a WPT test to verify the text editing commands, such as
"cut", "copy", "paste", and "select". When we press "ctrl/cmd" + "a", it
should select all the text, "ctrl/cmd" + "x" should cut the select text,
"ctrl/cmd" + "c" should copy the select text, and "ctrl/cmd" + "v"
should paste the copied or cut text.

Bug: chromedriver:3462
Change-Id: Id65de52c9cc444d98eca4910be77b7c3682f9404
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521109
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827908}
parent 25969267
......@@ -2133,6 +2133,7 @@ crbug.com/893480 external/wpt/infrastructure/testdriver/actions/actionsWithKeyPr
crbug.com/1040611 external/wpt/uievents/order-of-events/mouse-events/wheel-basic.html [ Failure Timeout ]
crbug.com/1040611 external/wpt/uievents/order-of-events/mouse-events/wheel-scrolling.html [ Failure Timeout ]
crbug.com/893480 external/wpt/css/css-scroll-snap/input/keyboard.html [ Failure Timeout ]
crbug.com/893480 external/wpt/infrastructure/testdriver/actions/textEditCommands.html [ Failure Timeout ]
# isInputPending requires threaded compositing and layerized iframes
crbug.com/910421 external/wpt/is-input-pending/* [ Skip ]
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>TestDriver actions: text edit commands</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<style>
div { padding:0px; margin: 0px; }
</style>
<body>
<div>
<input type="text" id="text1" value="Hello World" />
<input type="text" id="text2">
</div>
</body>
<script>
async_test(t => {
let text1 = document.getElementById("text1");
let text2 = document.getElementById("text2");
text1.addEventListener("click", function() {
let text1 = document.getElementById("text1");
text1.value="new text";
});
const ctrl_key = "\uE009";
const cmd_key = "\uE03D";
let edit_command_key = ctrl_key;
if(navigator.platform.includes('Mac'))
edit_command_key = cmd_key;
let actions = new test_driver.Actions()
.pointerMove(0, 0, {origin: text1})
.pointerDown()
.pointerUp()
.addTick()
.keyDown(edit_command_key)
.keyDown("a")
.keyUp("a")
.keyDown("x")
.keyUp("x")
.keyUp(edit_command_key)
.addTick()
.pointerMove(0, 0, {origin: text2})
.pointerDown()
.pointerUp()
.keyDown(edit_command_key)
.keyDown("v")
.keyUp("v")
.keyUp(edit_command_key);
actions.send()
.then(t.step_func_done(() => {
assert_equals(text1.value, "");
assert_equals(text2.value, "new text");
}))
.catch(e => t.step_func(() => assert_unreached("Actions sequence failed " + e)));
});
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment