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

Side by Side Diff: tools/telemetry/telemetry/page/actions/click_element_unittest.py

Issue 181483002: Telemetry: Clean up tap and click_element gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from telemetry.page.actions import click_element
6 from telemetry.page.actions import wait
7 from telemetry.unittest import tab_test_case
8
9
10 class ClickElementActionTest(tab_test_case.TabTestCase):
11 def testClickWithSelectorWaitForNavigation(self):
12 self.Navigate('page_with_link.html')
13 self.assertEquals(
14 self._tab.EvaluateJavaScript('document.location.pathname;'),
15 '/page_with_link.html')
16
17 data = {'selector': 'a[id="clickme"]'}
18 i = click_element.ClickElementAction(data)
19 data = {'condition': 'href_change'}
20 j = wait.WaitAction(data)
21 j.RunAction(None, self._tab, i)
22
23 self.assertEquals(
24 self._tab.EvaluateJavaScript('document.location.pathname;'),
25 '/blank.html')
26
27 def testClickWithSingleQuoteSelectorWaitForNavigation(self):
28 self.Navigate('page_with_link.html')
29 self.assertEquals(
30 self._tab.EvaluateJavaScript('document.location.pathname;'),
31 '/page_with_link.html')
32
33 data = {'selector': 'a[id=\'clickme\']'}
34 i = click_element.ClickElementAction(data)
35 data = {'condition': 'href_change'}
36 j = wait.WaitAction(data)
37 j.RunAction(None, self._tab, i)
38
39 self.assertEquals(
40 self._tab.EvaluateJavaScript('document.location.pathname;'),
41 '/blank.html')
42
43 def testClickWithTextWaitForRefChange(self):
44 self.Navigate('page_with_link.html')
45 self.assertEquals(
46 self._tab.EvaluateJavaScript('document.location.pathname;'),
47 '/page_with_link.html')
48
49 data = {'text': 'Click me'}
50 i = click_element.ClickElementAction(data)
51 data = {'condition': 'href_change'}
52 j = wait.WaitAction(data)
53 j.RunAction(None, self._tab, i)
54
55 self.assertEquals(
56 self._tab.EvaluateJavaScript('document.location.pathname;'),
57 '/blank.html')
58
59 def testClickWithXPathWaitForRefChange(self):
60 self.Navigate('page_with_link.html')
61 self.assertEquals(
62 self._tab.EvaluateJavaScript('document.location.pathname;'),
63 '/page_with_link.html')
64
65 data = {'xpath': '//a[@id="clickme"]'}
66 i = click_element.ClickElementAction(data)
67 data = {'condition': 'href_change'}
68 j = wait.WaitAction(data)
69 j.RunAction(None, self._tab, i)
70
71 self.assertEquals(
72 self._tab.EvaluateJavaScript('document.location.pathname;'),
73 '/blank.html')
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page/actions/click_element.py ('k') | tools/telemetry/telemetry/page/actions/javascript_click.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698