| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 decorators | 5 from telemetry import decorators |
| 6 from telemetry.internal.actions import tap | 6 from telemetry.internal.actions import tap |
| 7 from telemetry.testing import tab_test_case | 7 from telemetry.testing import tab_test_case |
| 8 | 8 |
| 9 class TapActionTest(tab_test_case.TabTestCase): | 9 class TapActionTest(tab_test_case.TabTestCase): |
| 10 | 10 |
| 11 def _PerformTapAction(self, *args, **kwargs): | 11 def _PerformTapAction(self, *args, **kwargs): |
| 12 action = tap.TapAction(*args, **kwargs) | 12 action = tap.TapAction(*args, **kwargs) |
| 13 action.WillRunAction(self._tab) | 13 action.WillRunAction(self._tab) |
| 14 action.RunAction(self._tab) | 14 action.RunAction(self._tab) |
| 15 | 15 |
| 16 @decorators.Disabled('win') # http://crbug.com/634343 | 16 # https://github.com/catapult-project/catapult/issues/3099 (Android) |
| 17 # http://crbug.com/634343 (Windows) |
| 18 @decorators.Disabled('android', 'win') |
| 17 def testTapSinglePage(self): | 19 def testTapSinglePage(self): |
| 18 self.Navigate('page_with_clickables.html') | 20 self.Navigate('page_with_clickables.html') |
| 19 | 21 |
| 20 self._tab.ExecuteJavaScript('valueSettableByTest = 1;') | 22 self._tab.ExecuteJavaScript('valueSettableByTest = 1;') |
| 21 self._PerformTapAction('#test') | 23 self._PerformTapAction('#test') |
| 22 self.assertEqual(1, self._tab.EvaluateJavaScript('valueToTest')) | 24 self.assertEqual(1, self._tab.EvaluateJavaScript('valueToTest')) |
| 23 | 25 |
| 24 self._tab.ExecuteJavaScript('valueSettableByTest = 2;') | 26 self._tab.ExecuteJavaScript('valueSettableByTest = 2;') |
| 25 self._PerformTapAction(text='Click/tap me') | 27 self._PerformTapAction(text='Click/tap me') |
| 26 self.assertEqual(2, self._tab.EvaluateJavaScript('valueToTest')) | 28 self.assertEqual(2, self._tab.EvaluateJavaScript('valueToTest')) |
| 27 | 29 |
| 28 self._tab.ExecuteJavaScript('valueSettableByTest = 3;') | 30 self._tab.ExecuteJavaScript('valueSettableByTest = 3;') |
| 29 self._PerformTapAction(element_function='document.body.firstElementChild') | 31 self._PerformTapAction(element_function='document.body.firstElementChild') |
| 30 self.assertEqual(3, self._tab.EvaluateJavaScript('valueToTest')) | 32 self.assertEqual(3, self._tab.EvaluateJavaScript('valueToTest')) |
| 31 | 33 |
| 32 @decorators.Disabled('win') # http://crbug.com/634343 | 34 @decorators.Disabled('win') # http://crbug.com/634343 |
| 33 def testTapNavigate(self): | 35 def testTapNavigate(self): |
| 34 self.Navigate('page_with_link.html') | 36 self.Navigate('page_with_link.html') |
| 35 self._PerformTapAction(selector='#clickme') | 37 self._PerformTapAction(selector='#clickme') |
| 36 self._tab.WaitForJavaScriptExpression( | 38 self._tab.WaitForJavaScriptExpression( |
| 37 'document.location.pathname === "/blank.html"', timeout=5) | 39 'document.location.pathname === "/blank.html"', timeout=5) |
| 38 self._tab.WaitForJavaScriptExpression( | 40 self._tab.WaitForJavaScriptExpression( |
| 39 'document.readyState === "complete"', timeout=5) | 41 'document.readyState === "complete"', timeout=5) |
| OLD | NEW |