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 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
8 | 8 |
9 | 9 |
10 class ToughPinchZoomCasesPage(page_module.Page): | 10 class ToughPinchZoomCasesPage(page_module.Page): |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 """ Why: top google property; a google tab is often open. """ | 25 """ Why: top google property; a google tab is often open. """ |
26 | 26 |
27 def __init__(self, page_set): | 27 def __init__(self, page_set): |
28 super(GoogleSearchPage, self).__init__( | 28 super(GoogleSearchPage, self).__init__( |
29 url='https://www.google.com/#hl=en&q=barack+obama', | 29 url='https://www.google.com/#hl=en&q=barack+obama', |
30 page_set=page_set) | 30 page_set=page_set) |
31 | 31 |
32 def RunNavigateSteps(self, action_runner): | 32 def RunNavigateSteps(self, action_runner): |
33 action_runner.NavigateToPage(self) | 33 action_runner.NavigateToPage(self) |
34 action_runner.RunAction(WaitAction( | 34 action_runner.WaitForElement(text='Next') |
35 { | |
36 'text': 'Next', | |
37 'condition': 'element' | |
38 })) | |
39 | 35 |
40 | 36 |
41 class GmailPage(ToughPinchZoomCasesPage): | 37 class GmailPage(ToughPinchZoomCasesPage): |
42 | 38 |
43 """ Why: productivity, top google properties """ | 39 """ Why: productivity, top google properties """ |
44 | 40 |
45 def __init__(self, page_set): | 41 def __init__(self, page_set): |
46 super(GmailPage, self).__init__( | 42 super(GmailPage, self).__init__( |
47 url='https://mail.google.com/mail/', | 43 url='https://mail.google.com/mail/', |
48 page_set=page_set) | 44 page_set=page_set) |
49 | 45 |
50 self.credentials = 'google' | 46 self.credentials = 'google' |
51 | 47 |
52 def RunNavigateSteps(self, action_runner): | 48 def RunNavigateSteps(self, action_runner): |
53 action_runner.NavigateToPage(self) | 49 action_runner.NavigateToPage(self) |
54 action_runner.RunAction(WaitAction( | 50 action_runner.WaitForJavaScriptCondition( |
55 { | 51 'window.gmonkey !== undefined &&' |
56 'javascript' : ( | 52 'document.getElementById("gb") !== null') |
57 'window.gmonkey !== undefined &&' | |
58 'document.getElementById("gb") !== null') | |
59 })) | |
60 | 53 |
61 | 54 |
62 class GoogleCalendarPage(ToughPinchZoomCasesPage): | 55 class GoogleCalendarPage(ToughPinchZoomCasesPage): |
63 | 56 |
64 """ Why: productivity, top google properties """ | 57 """ Why: productivity, top google properties """ |
65 | 58 |
66 def __init__(self, page_set): | 59 def __init__(self, page_set): |
67 super(GoogleCalendarPage, self).__init__( | 60 super(GoogleCalendarPage, self).__init__( |
68 url='https://www.google.com/calendar/', | 61 url='https://www.google.com/calendar/', |
69 page_set=page_set) | 62 page_set=page_set) |
70 | 63 |
71 self.credentials = 'google' | 64 self.credentials = 'google' |
72 | 65 |
73 def RunNavigateSteps(self, action_runner): | 66 def RunNavigateSteps(self, action_runner): |
74 action_runner.NavigateToPage(self) | 67 action_runner.NavigateToPage(self) |
75 action_runner.RunAction(WaitAction({'seconds':2})) | 68 action_runner.Wait(2) |
76 | 69 |
77 def RunSmoothness(self, action_runner): | 70 def RunSmoothness(self, action_runner): |
78 action_runner.RunAction(PinchAction( | 71 action_runner.RunAction(PinchAction( |
79 { | 72 { |
80 'left_anchor_percentage': 0.1, | 73 'left_anchor_percentage': 0.1, |
81 'top_anchor_percentage': 0.3 | 74 'top_anchor_percentage': 0.3 |
82 })) | 75 })) |
83 | 76 |
84 | 77 |
85 class GoogleImageSearchPage(ToughPinchZoomCasesPage): | 78 class GoogleImageSearchPage(ToughPinchZoomCasesPage): |
(...skipping 14 matching lines...) Expand all Loading... |
100 | 93 |
101 def __init__(self, page_set): | 94 def __init__(self, page_set): |
102 super(GooglePlusPage, self).__init__( | 95 super(GooglePlusPage, self).__init__( |
103 url='https://plus.google.com/+BarackObama/posts', | 96 url='https://plus.google.com/+BarackObama/posts', |
104 page_set=page_set) | 97 page_set=page_set) |
105 | 98 |
106 self.credentials = 'google' | 99 self.credentials = 'google' |
107 | 100 |
108 def RunNavigateSteps(self, action_runner): | 101 def RunNavigateSteps(self, action_runner): |
109 action_runner.NavigateToPage(self) | 102 action_runner.NavigateToPage(self) |
110 action_runner.RunAction(WaitAction( | 103 action_runner.WaitForElement(text='Home') |
111 { | |
112 'text': 'Home', | |
113 'condition': 'element' | |
114 })) | |
115 | 104 |
116 def RunSmoothness(self, action_runner): | 105 def RunSmoothness(self, action_runner): |
117 action_runner.RunAction(PinchAction( | 106 action_runner.RunAction(PinchAction( |
118 { | 107 { |
119 'element_function': ''' | 108 'element_function': ''' |
120 function(callback) { | 109 function(callback) { |
121 callback(document.getElementById("110031535020051778989-tab-bar")) | 110 callback(document.getElementById("110031535020051778989-tab-bar")) |
122 }''' | 111 }''' |
123 })) | 112 })) |
124 | 113 |
125 | 114 |
126 class YoutubePage(ToughPinchZoomCasesPage): | 115 class YoutubePage(ToughPinchZoomCasesPage): |
127 | 116 |
128 """ Why: #3 (Alexa global) """ | 117 """ Why: #3 (Alexa global) """ |
129 | 118 |
130 def __init__(self, page_set): | 119 def __init__(self, page_set): |
131 super(YoutubePage, self).__init__( | 120 super(YoutubePage, self).__init__( |
132 url='http://www.youtube.com', | 121 url='http://www.youtube.com', |
133 page_set=page_set) | 122 page_set=page_set) |
134 | 123 |
135 self.credentials = 'google' | 124 self.credentials = 'google' |
136 | 125 |
137 def RunNavigateSteps(self, action_runner): | 126 def RunNavigateSteps(self, action_runner): |
138 action_runner.NavigateToPage(self) | 127 action_runner.NavigateToPage(self) |
139 action_runner.RunAction(WaitAction({'seconds':2})) | 128 action_runner.Wait(2) |
140 | 129 |
141 class BlogSpotPage(ToughPinchZoomCasesPage): | 130 class BlogSpotPage(ToughPinchZoomCasesPage): |
142 | 131 |
143 """ | 132 """ |
144 Why: #11 (Alexa global), google property; some blogger layouts have infinite | 133 Why: #11 (Alexa global), google property; some blogger layouts have infinite |
145 scroll but more interesting | 134 scroll but more interesting |
146 """ | 135 """ |
147 | 136 |
148 def __init__(self, page_set): | 137 def __init__(self, page_set): |
149 super(BlogSpotPage, self).__init__( | 138 super(BlogSpotPage, self).__init__( |
150 url='http://googlewebmastercentral.blogspot.com/', | 139 url='http://googlewebmastercentral.blogspot.com/', |
151 page_set=page_set, name='Blogger') | 140 page_set=page_set, name='Blogger') |
152 | 141 |
153 def RunNavigateSteps(self, action_runner): | 142 def RunNavigateSteps(self, action_runner): |
154 action_runner.NavigateToPage(self) | 143 action_runner.NavigateToPage(self) |
155 action_runner.RunAction(WaitAction( | 144 action_runner.WaitForElement(text='accessibility') |
156 { | |
157 'text': 'accessibility', | |
158 'condition': 'element' | |
159 })) | |
160 | 145 |
161 | 146 |
162 class FacebookPage(ToughPinchZoomCasesPage): | 147 class FacebookPage(ToughPinchZoomCasesPage): |
163 | 148 |
164 """ Why: top social,Public profile """ | 149 """ Why: top social,Public profile """ |
165 | 150 |
166 def __init__(self, page_set): | 151 def __init__(self, page_set): |
167 super(FacebookPage, self).__init__( | 152 super(FacebookPage, self).__init__( |
168 url='http://www.facebook.com/barackobama', | 153 url='http://www.facebook.com/barackobama', |
169 page_set=page_set, name='Facebook') | 154 page_set=page_set, name='Facebook') |
170 self.credentials = 'facebook' | 155 self.credentials = 'facebook' |
171 | 156 |
172 def RunNavigateSteps(self, action_runner): | 157 def RunNavigateSteps(self, action_runner): |
173 action_runner.NavigateToPage(self) | 158 action_runner.NavigateToPage(self) |
174 action_runner.RunAction(WaitAction( | 159 action_runner.WaitForElement(text='About') |
175 { | |
176 'text': 'About', | |
177 'condition': 'element' | |
178 })) | |
179 | 160 |
180 | 161 |
181 class LinkedinPage(ToughPinchZoomCasesPage): | 162 class LinkedinPage(ToughPinchZoomCasesPage): |
182 | 163 |
183 """ Why: #12 (Alexa global),Public profile """ | 164 """ Why: #12 (Alexa global),Public profile """ |
184 | 165 |
185 def __init__(self, page_set): | 166 def __init__(self, page_set): |
186 super(LinkedinPage, self).__init__( | 167 super(LinkedinPage, self).__init__( |
187 url='http://www.linkedin.com/in/linustorvalds', | 168 url='http://www.linkedin.com/in/linustorvalds', |
188 page_set=page_set, name='LinkedIn') | 169 page_set=page_set, name='LinkedIn') |
(...skipping 13 matching lines...) Expand all Loading... |
202 | 183 |
203 """ Why: #8 (Alexa global),Picked an interesting page """ | 184 """ Why: #8 (Alexa global),Picked an interesting page """ |
204 | 185 |
205 def __init__(self, page_set): | 186 def __init__(self, page_set): |
206 super(TwitterPage, self).__init__( | 187 super(TwitterPage, self).__init__( |
207 url='https://twitter.com/katyperry', | 188 url='https://twitter.com/katyperry', |
208 page_set=page_set, name='Twitter') | 189 page_set=page_set, name='Twitter') |
209 | 190 |
210 def RunNavigateSteps(self, action_runner): | 191 def RunNavigateSteps(self, action_runner): |
211 action_runner.NavigateToPage(self) | 192 action_runner.NavigateToPage(self) |
212 action_runner.RunAction(WaitAction({'seconds':2})) | 193 action_runner.Wait(2) |
213 | 194 |
214 class ESPNPage(ToughPinchZoomCasesPage): | 195 class ESPNPage(ToughPinchZoomCasesPage): |
215 | 196 |
216 """ Why: #1 sports """ | 197 """ Why: #1 sports """ |
217 | 198 |
218 def __init__(self, page_set): | 199 def __init__(self, page_set): |
219 super(ESPNPage, self).__init__( | 200 super(ESPNPage, self).__init__( |
220 url='http://espn.go.com/nba', | 201 url='http://espn.go.com/nba', |
221 page_set=page_set, name='ESPN') | 202 page_set=page_set, name='ESPN') |
222 | 203 |
(...skipping 13 matching lines...) Expand all Loading... |
236 | 217 |
237 """ Why: #1 games according to Alexa (with actual games in it) """ | 218 """ Why: #1 games according to Alexa (with actual games in it) """ |
238 | 219 |
239 def __init__(self, page_set): | 220 def __init__(self, page_set): |
240 super(YahooGamePage, self).__init__( | 221 super(YahooGamePage, self).__init__( |
241 url='http://games.yahoo.com', | 222 url='http://games.yahoo.com', |
242 page_set=page_set) | 223 page_set=page_set) |
243 | 224 |
244 def RunNavigateSteps(self, action_runner): | 225 def RunNavigateSteps(self, action_runner): |
245 action_runner.NavigateToPage(self) | 226 action_runner.NavigateToPage(self) |
246 action_runner.RunAction(WaitAction({'seconds':2})) | 227 action_runner.Wait(2) |
247 | 228 |
248 | 229 |
249 class YahooAnswersPage(ToughPinchZoomCasesPage): | 230 class YahooAnswersPage(ToughPinchZoomCasesPage): |
250 | 231 |
251 """ Why: #1 Alexa reference """ | 232 """ Why: #1 Alexa reference """ |
252 | 233 |
253 def __init__(self, page_set): | 234 def __init__(self, page_set): |
254 super(YahooAnswersPage, self).__init__( | 235 super(YahooAnswersPage, self).__init__( |
255 url='http://answers.yahoo.com', | 236 url='http://answers.yahoo.com', |
256 page_set=page_set) | 237 page_set=page_set) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 286 |
306 self.AddPage(YahooGamePage(self)) | 287 self.AddPage(YahooGamePage(self)) |
307 | 288 |
308 # Why: #1 Alexa recreation | 289 # Why: #1 Alexa recreation |
309 self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self)) | 290 self.AddPage(ToughPinchZoomCasesPage('http://booking.com', self)) |
310 | 291 |
311 self.AddPage(YahooAnswersPage(self)) | 292 self.AddPage(YahooAnswersPage(self)) |
312 | 293 |
313 # Why: #1 Alexa sports | 294 # Why: #1 Alexa sports |
314 self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) | 295 self.AddPage(ToughPinchZoomCasesPage('http://sports.yahoo.com/', self)) |
OLD | NEW |