Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: telemetry/telemetry/internal/actions/action_runner_unittest.py

Issue 2122703002: [telemetry] Add support for dispatching key events (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Raise explicit ValueError Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/actions/action_runner_unittest.py
diff --git a/telemetry/telemetry/internal/actions/action_runner_unittest.py b/telemetry/telemetry/internal/actions/action_runner_unittest.py
index a708e0efba999f2e9d5cfe5cf5a52f99b001433f..7cd68cd6c50e474d872afb30ccd57f4733a0c2e9 100644
--- a/telemetry/telemetry/internal/actions/action_runner_unittest.py
+++ b/telemetry/telemetry/internal/actions/action_runner_unittest.py
@@ -255,6 +255,31 @@ class ActionRunnerTest(tab_test_case.TabTestCase):
self.assertTrue(action_runner.EvaluateJavaScript(
'(document.scrollingElement || document.body).scrollLeft') > 75)
+ def testEnterText(self):
+ self.Navigate('blank.html')
+ self._tab.ExecuteJavaScript(
+ '(function() {'
+ ' var elem = document.createElement("textarea");'
+ ' document.body.appendChild(elem);'
+ ' elem.focus();'
+ '})();')
+
+ action_runner = action_runner_module.ActionRunner(self._tab,
+ skip_waits=True)
+ action_runner.EnterText('That is boring') # That is boring|.
+ action_runner.PressKey('Home') # |That is boring.
+ action_runner.PressKey('ArrowRight', repeat_count=2) # Th|at is boring.
+ action_runner.PressKey('Delete', repeat_count=2) # Th| is boring.
+ action_runner.EnterText('is') # This| is boring.
+ action_runner.PressKey('End') # This is boring|.
+ action_runner.PressKey('ArrowLeft', repeat_count=3) # This is bor|ing.
+ action_runner.PressKey('Backspace', repeat_count=3) # This is |ing.
+ action_runner.EnterText('interest') # This is interest|ing.
+
+ self.assertEqual('This is interesting',
+ self._tab.EvaluateJavaScript(
+ 'document.querySelector("textarea").value'))
+
class InteractionTest(unittest.TestCase):
« no previous file with comments | « telemetry/telemetry/internal/actions/action_runner.py ('k') | telemetry/telemetry/internal/actions/key_event.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698