OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from telemetry import test | 5 from telemetry import benchmark |
6 from telemetry.core import exceptions | 6 from telemetry.core import exceptions |
7 from telemetry.core import util | 7 from telemetry.core import util |
8 from telemetry.core.backends.chrome import tracing_backend | 8 from telemetry.core.backends.chrome import tracing_backend |
9 from telemetry.timeline import model | 9 from telemetry.timeline import model |
10 from telemetry.page.actions import gesture_action | 10 from telemetry.page.actions import gesture_action |
11 from telemetry.page.actions import action_runner as action_runner_module | 11 from telemetry.page.actions import action_runner as action_runner_module |
12 # pylint: disable=W0401,W0614 | 12 # pylint: disable=W0401,W0614 |
13 from telemetry.page.actions.all_page_actions import * | 13 from telemetry.page.actions.all_page_actions import * |
14 from telemetry.unittest import tab_test_case | 14 from telemetry.unittest import tab_test_case |
15 from telemetry.web_perf import timeline_interaction_record as tir_module | 15 from telemetry.web_perf import timeline_interaction_record as tir_module |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 action_runner.ExecuteJavaScript('valueSettableByTest = 3;') | 152 action_runner.ExecuteJavaScript('valueSettableByTest = 3;') |
153 action_runner.ClickElement( | 153 action_runner.ClickElement( |
154 element_function='document.body.firstElementChild;') | 154 element_function='document.body.firstElementChild;') |
155 self.assertEqual(3, action_runner.EvaluateJavaScript('valueToTest')) | 155 self.assertEqual(3, action_runner.EvaluateJavaScript('valueToTest')) |
156 | 156 |
157 def WillFail(): | 157 def WillFail(): |
158 action_runner.ClickElement('#notfound') | 158 action_runner.ClickElement('#notfound') |
159 self.assertRaises(exceptions.EvaluateException, WillFail) | 159 self.assertRaises(exceptions.EvaluateException, WillFail) |
160 | 160 |
161 @test.Disabled('debug') | 161 @benchmark.Disabled('debug') |
162 def testTapElement(self): | 162 def testTapElement(self): |
163 self.Navigate('page_with_clickables.html') | 163 self.Navigate('page_with_clickables.html') |
164 action_runner = action_runner_module.ActionRunner(self._tab) | 164 action_runner = action_runner_module.ActionRunner(self._tab) |
165 | 165 |
166 action_runner.ExecuteJavaScript('valueSettableByTest = 1;') | 166 action_runner.ExecuteJavaScript('valueSettableByTest = 1;') |
167 action_runner.TapElement('#test') | 167 action_runner.TapElement('#test') |
168 self.assertEqual(1, action_runner.EvaluateJavaScript('valueToTest')) | 168 self.assertEqual(1, action_runner.EvaluateJavaScript('valueToTest')) |
169 | 169 |
170 action_runner.ExecuteJavaScript('valueSettableByTest = 2;') | 170 action_runner.ExecuteJavaScript('valueSettableByTest = 2;') |
171 action_runner.TapElement(text='Click/tap me') | 171 action_runner.TapElement(text='Click/tap me') |
(...skipping 21 matching lines...) Expand all Loading... |
193 self.assertTrue(action_runner.EvaluateJavaScript( | 193 self.assertTrue(action_runner.EvaluateJavaScript( |
194 'document.querySelector("#left-right").scrollLeft') > 75) | 194 'document.querySelector("#left-right").scrollLeft') > 75) |
195 action_runner.SwipeElement( | 195 action_runner.SwipeElement( |
196 selector='#top-bottom', direction='up', top_start_ratio=0.9) | 196 selector='#top-bottom', direction='up', top_start_ratio=0.9) |
197 self.assertTrue(action_runner.EvaluateJavaScript( | 197 self.assertTrue(action_runner.EvaluateJavaScript( |
198 'document.querySelector("#top-bottom").scrollTop') > 75) | 198 'document.querySelector("#top-bottom").scrollTop') > 75) |
199 | 199 |
200 action_runner.SwipePage(direction='left', left_start_ratio=0.9) | 200 action_runner.SwipePage(direction='left', left_start_ratio=0.9) |
201 self.assertTrue(action_runner.EvaluateJavaScript( | 201 self.assertTrue(action_runner.EvaluateJavaScript( |
202 'document.body.scrollLeft') > 75) | 202 'document.body.scrollLeft') > 75) |
OLD | NEW |