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 Top25Page(page_module.Page): | 10 class Top25Page(page_module.Page): |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 """ Why: top google property; a google tab is often open """ | 30 """ Why: top google property; a google tab is often open """ |
31 | 31 |
32 def __init__(self, page_set): | 32 def __init__(self, page_set): |
33 super(GoogleWebSearchPage, self).__init__( | 33 super(GoogleWebSearchPage, self).__init__( |
34 url='https://www.google.com/#hl=en&q=barack+obama', | 34 url='https://www.google.com/#hl=en&q=barack+obama', |
35 page_set=page_set) | 35 page_set=page_set) |
36 | 36 |
37 def RunNavigateSteps(self, action_runner): | 37 def RunNavigateSteps(self, action_runner): |
38 action_runner.NavigateToPage(self) | 38 action_runner.NavigateToPage(self) |
39 action_runner.RunAction(WaitAction( | 39 action_runner.WaitForElement(text='Next') |
40 { | |
41 'text' : 'Next', | |
42 'condition': 'element' | |
43 })) | |
44 | 40 |
45 def RunStressMemory(self, action_runner): | 41 def RunStressMemory(self, action_runner): |
46 action_runner.RunAction(ScrollAction()) | 42 action_runner.RunAction(ScrollAction()) |
47 action_runner.RunAction(ClickElementAction( | 43 action_runner.RunAction(ClickElementAction( |
48 { | 44 { |
49 'text' : 'Next', | 45 'text' : 'Next', |
50 'wait_until': { | 46 'wait_until': { |
51 'condition': 'href_change' | 47 'condition': 'href_change' |
52 } | 48 } |
53 })) | 49 })) |
54 action_runner.RunAction(WaitAction( | 50 action_runner.WaitForElement(text='Next') |
55 { | |
56 'text' : 'Next', | |
57 'condition': 'element' | |
58 })) | |
59 action_runner.RunAction(ScrollAction()) | 51 action_runner.RunAction(ScrollAction()) |
60 action_runner.RunAction(ClickElementAction( | 52 action_runner.RunAction(ClickElementAction( |
61 { | 53 { |
62 'text' : 'Next', | 54 'text' : 'Next', |
63 'wait_until': { | 55 'wait_until': { |
64 'condition': 'href_change' | 56 'condition': 'href_change' |
65 } | 57 } |
66 })) | 58 })) |
67 action_runner.RunAction(WaitAction( | 59 action_runner.WaitForElement(text='Next') |
68 { | |
69 'text' : 'Next', | |
70 'condition': 'element' | |
71 })) | |
72 action_runner.RunAction(ScrollAction()) | 60 action_runner.RunAction(ScrollAction()) |
73 action_runner.RunAction(ClickElementAction( | 61 action_runner.RunAction(ClickElementAction( |
74 { | 62 { |
75 'text' : 'Next', | 63 'text' : 'Next', |
76 'wait_until': { | 64 'wait_until': { |
77 'condition': 'href_change' | 65 'condition': 'href_change' |
78 } | 66 } |
79 })) | 67 })) |
80 action_runner.RunAction(WaitAction( | 68 action_runner.WaitForElement(text='Previous') |
81 { | |
82 'text' : 'Previous', | |
83 'condition': 'element' | |
84 })) | |
85 action_runner.RunAction(ScrollAction()) | 69 action_runner.RunAction(ScrollAction()) |
86 action_runner.RunAction(ClickElementAction( | 70 action_runner.RunAction(ClickElementAction( |
87 { | 71 { |
88 'text' : 'Previous', | 72 'text' : 'Previous', |
89 'wait_until': { | 73 'wait_until': { |
90 'condition': 'href_change' | 74 'condition': 'href_change' |
91 } | 75 } |
92 })) | 76 })) |
93 action_runner.RunAction(WaitAction( | 77 action_runner.WaitForElement(text='Previous') |
94 { | |
95 'text' : 'Previous', | |
96 'condition': 'element' | |
97 })) | |
98 action_runner.RunAction(ScrollAction()) | 78 action_runner.RunAction(ScrollAction()) |
99 action_runner.RunAction(ClickElementAction( | 79 action_runner.RunAction(ClickElementAction( |
100 { | 80 { |
101 'text' : 'Previous', | 81 'text' : 'Previous', |
102 'wait_until': { | 82 'wait_until': { |
103 'condition': 'href_change' | 83 'condition': 'href_change' |
104 } | 84 } |
105 })) | 85 })) |
106 action_runner.RunAction(WaitAction( | 86 action_runner.WaitForElement(text='Previous') |
107 { | |
108 'text' : 'Previous', | |
109 'condition': 'element' | |
110 })) | |
111 action_runner.RunAction(ScrollAction()) | 87 action_runner.RunAction(ScrollAction()) |
112 action_runner.RunAction(ClickElementAction( | 88 action_runner.RunAction(ClickElementAction( |
113 { | 89 { |
114 'text' : 'Previous', | 90 'text' : 'Previous', |
115 'wait_until': { | 91 'wait_until': { |
116 'condition': 'href_change' | 92 'condition': 'href_change' |
117 } | 93 } |
118 })) | 94 })) |
119 action_runner.RunAction(WaitAction( | 95 action_runner.WaitForElement(text='Images') |
120 { | |
121 'text' : 'Images', | |
122 'condition': 'element' | |
123 })) | |
124 action_runner.RunAction(ScrollAction()) | 96 action_runner.RunAction(ScrollAction()) |
125 action_runner.RunAction(ClickElementAction( | 97 action_runner.RunAction(ClickElementAction( |
126 { | 98 { |
127 'text' : 'Images', | 99 'text' : 'Images', |
128 'wait_until': { | 100 'wait_until': { |
129 'condition': 'href_change' | 101 'condition': 'href_change' |
130 } | 102 } |
131 })) | 103 })) |
132 action_runner.RunAction(WaitAction( | 104 action_runner.WaitForElement(text='Images') |
133 { | |
134 'text' : 'Images', | |
135 'condition': 'element' | |
136 })) | |
137 | 105 |
138 | 106 |
139 class GmailPage(Top25Page): | 107 class GmailPage(Top25Page): |
140 | 108 |
141 """ Why: productivity, top google properties """ | 109 """ Why: productivity, top google properties """ |
142 | 110 |
143 def __init__(self, page_set): | 111 def __init__(self, page_set): |
144 super(GmailPage, self).__init__( | 112 super(GmailPage, self).__init__( |
145 url='https://mail.google.com/mail/', | 113 url='https://mail.google.com/mail/', |
146 page_set=page_set) | 114 page_set=page_set) |
147 | 115 |
148 self.credentials = 'google' | 116 self.credentials = 'google' |
149 | 117 |
150 def RunNavigateSteps(self, action_runner): | 118 def RunNavigateSteps(self, action_runner): |
151 action_runner.NavigateToPage(self) | 119 action_runner.NavigateToPage(self) |
152 action_runner.RunAction(WaitAction( | 120 action_runner.WaitForJavaScriptCondition( |
153 { | 121 'window.gmonkey !== undefined &&' |
154 'javascript': ('window.gmonkey !== undefined &&' | 122 'document.getElementById("gb") !== null') |
155 'document.getElementById("gb") !== null') | |
156 })) | |
157 | 123 |
158 def RunStressMemory(self, action_runner): | 124 def RunStressMemory(self, action_runner): |
159 action_runner.RunAction(ClickElementAction( | 125 action_runner.RunAction(ClickElementAction( |
160 { | 126 { |
161 'wait_until': { | 127 'wait_until': { |
162 'condition': 'href_change' | 128 'condition': 'href_change' |
163 }, | 129 }, |
164 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]' | 130 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]' |
165 })) | 131 })) |
166 action_runner.RunAction(ClickElementAction( | 132 action_runner.RunAction(ClickElementAction( |
(...skipping 22 matching lines...) Expand all Loading... |
189 | 155 |
190 def __init__(self, page_set): | 156 def __init__(self, page_set): |
191 super(GoogleCalendarPage, self).__init__( | 157 super(GoogleCalendarPage, self).__init__( |
192 url='https://www.google.com/calendar/', | 158 url='https://www.google.com/calendar/', |
193 page_set=page_set) | 159 page_set=page_set) |
194 | 160 |
195 self.credentials = 'google' | 161 self.credentials = 'google' |
196 | 162 |
197 def RunNavigateSteps(self, action_runner): | 163 def RunNavigateSteps(self, action_runner): |
198 action_runner.NavigateToPage(self) | 164 action_runner.NavigateToPage(self) |
199 action_runner.RunAction(WaitAction( | 165 action_runner.Wait(2) |
200 { | 166 action_runner.WaitForElement('div[class~="navForward"]') |
201 'seconds': 2 | |
202 })) | |
203 action_runner.RunAction(WaitAction( | |
204 { | |
205 'condition': 'element', | |
206 'selector': 'div[class~="navForward"]' | |
207 })) | |
208 action_runner.ExecuteJavaScript(''' | 167 action_runner.ExecuteJavaScript(''' |
209 (function() { | 168 (function() { |
210 var elem = document.createElement('meta'); | 169 var elem = document.createElement('meta'); |
211 elem.name='viewport'; | 170 elem.name='viewport'; |
212 elem.content='initial-scale=1'; | 171 elem.content='initial-scale=1'; |
213 document.body.appendChild(elem); | 172 document.body.appendChild(elem); |
214 })();''') | 173 })();''') |
215 action_runner.RunAction(WaitAction( | 174 action_runner.Wait(1) |
216 { | |
217 'seconds': 1 | |
218 })) | |
219 | 175 |
220 def RunStressMemory(self, action_runner): | 176 def RunStressMemory(self, action_runner): |
221 action_runner.RunAction(ClickElementAction( | 177 action_runner.RunAction(ClickElementAction( |
222 { | 178 { |
223 'selector': 'div[class~="navForward"]' | 179 'selector': 'div[class~="navForward"]' |
224 })) | 180 })) |
225 action_runner.RunAction(WaitAction( | 181 action_runner.Wait(2) |
226 { | 182 action_runner.WaitForElement('div[class~="navForward"]') |
227 'seconds': 2 | |
228 })) | |
229 action_runner.RunAction(WaitAction( | |
230 { | |
231 'condition': 'element', | |
232 'selector': 'div[class~="navForward"]' | |
233 })) | |
234 action_runner.RunAction(ClickElementAction( | 183 action_runner.RunAction(ClickElementAction( |
235 { | 184 { |
236 'selector': 'div[class~="navForward"]' | 185 'selector': 'div[class~="navForward"]' |
237 })) | 186 })) |
238 action_runner.RunAction(WaitAction( | 187 action_runner.Wait(2) |
239 { | 188 action_runner.WaitForElement('div[class~="navForward"]') |
240 'seconds': 2 | |
241 })) | |
242 action_runner.RunAction(WaitAction( | |
243 { | |
244 'condition': 'element', | |
245 'selector': 'div[class~="navForward"]' | |
246 })) | |
247 action_runner.RunAction(ClickElementAction( | 189 action_runner.RunAction(ClickElementAction( |
248 { | 190 { |
249 'selector': 'div[class~="navForward"]' | 191 'selector': 'div[class~="navForward"]' |
250 })) | 192 })) |
251 action_runner.RunAction(WaitAction( | 193 action_runner.Wait(2) |
252 { | 194 action_runner.WaitForElement('div[class~="navForward"]') |
253 'seconds': 2 | |
254 })) | |
255 action_runner.RunAction(WaitAction( | |
256 { | |
257 'condition': 'element', | |
258 'selector': 'div[class~="navForward"]' | |
259 })) | |
260 action_runner.RunAction(ClickElementAction( | 195 action_runner.RunAction(ClickElementAction( |
261 { | 196 { |
262 'selector': 'div[class~="navForward"]' | 197 'selector': 'div[class~="navForward"]' |
263 })) | 198 })) |
264 action_runner.RunAction(WaitAction( | 199 action_runner.Wait(2) |
265 { | 200 action_runner.WaitForElement('div[class~="navBack"]') |
266 'seconds': 2 | |
267 })) | |
268 action_runner.RunAction(WaitAction( | |
269 { | |
270 'condition': 'element', | |
271 'selector': 'div[class~="navBack"]' | |
272 })) | |
273 action_runner.RunAction(ClickElementAction( | 201 action_runner.RunAction(ClickElementAction( |
274 { | 202 { |
275 'selector': 'div[class~="navBack"]' | 203 'selector': 'div[class~="navBack"]' |
276 })) | 204 })) |
277 action_runner.RunAction(WaitAction( | 205 action_runner.Wait(2) |
278 { | 206 action_runner.WaitForElement('div[class~="navBack"]') |
279 'seconds': 2 | |
280 })) | |
281 action_runner.RunAction(WaitAction( | |
282 { | |
283 'condition': 'element', | |
284 'selector': 'div[class~="navBack"]' | |
285 })) | |
286 action_runner.RunAction(ClickElementAction( | 207 action_runner.RunAction(ClickElementAction( |
287 { | 208 { |
288 'selector': 'div[class~="navBack"]' | 209 'selector': 'div[class~="navBack"]' |
289 })) | 210 })) |
290 action_runner.RunAction(WaitAction( | 211 action_runner.Wait(2) |
291 { | 212 action_runner.WaitForElement('div[class~="navBack"]') |
292 'seconds': 2 | |
293 })) | |
294 action_runner.RunAction(WaitAction( | |
295 { | |
296 'condition': 'element', | |
297 'selector': 'div[class~="navBack"]' | |
298 })) | |
299 action_runner.RunAction(ClickElementAction( | 213 action_runner.RunAction(ClickElementAction( |
300 { | 214 { |
301 'selector': 'div[class~="navBack"]' | 215 'selector': 'div[class~="navBack"]' |
302 })) | 216 })) |
303 action_runner.RunAction(WaitAction( | 217 action_runner.Wait(2) |
304 { | 218 action_runner.WaitForElement('div[class~="navBack"]') |
305 'seconds': 2 | |
306 })) | |
307 action_runner.RunAction(WaitAction( | |
308 { | |
309 'condition': 'element', | |
310 'selector': 'div[class~="navBack"]' | |
311 })) | |
312 action_runner.RunAction(ClickElementAction( | 219 action_runner.RunAction(ClickElementAction( |
313 { | 220 { |
314 'selector': 'div[class~="navBack"]' | 221 'selector': 'div[class~="navBack"]' |
315 })) | 222 })) |
316 action_runner.RunAction(WaitAction( | 223 action_runner.Wait(2) |
317 { | 224 action_runner.WaitForElement('div[class~="navBack"]') |
318 'seconds': 2 | |
319 })) | |
320 action_runner.RunAction(WaitAction( | |
321 { | |
322 'condition': 'element', | |
323 'selector': 'div[class~="navBack"]' | |
324 })) | |
325 | 225 |
326 def RunSmoothness(self, action_runner): | 226 def RunSmoothness(self, action_runner): |
327 action_runner.RunAction(ScrollAction( | 227 action_runner.RunAction(ScrollAction( |
328 { | 228 { |
329 'scrollable_element_function': ''' | 229 'scrollable_element_function': ''' |
330 function(callback) { | 230 function(callback) { |
331 callback(document.getElementById('scrolltimedeventswk')); | 231 callback(document.getElementById('scrolltimedeventswk')); |
332 }''' | 232 }''' |
333 })) | 233 })) |
334 | 234 |
(...skipping 18 matching lines...) Expand all Loading... |
353 super(GoogleDocPage, self).__init__( | 253 super(GoogleDocPage, self).__init__( |
354 # pylint: disable=C0301 | 254 # pylint: disable=C0301 |
355 url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3mfT
pAPUSX3_s4/view', | 255 url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3mfT
pAPUSX3_s4/view', |
356 page_set=page_set, | 256 page_set=page_set, |
357 name='Docs (1 open document tab)') | 257 name='Docs (1 open document tab)') |
358 | 258 |
359 self.credentials = 'google' | 259 self.credentials = 'google' |
360 | 260 |
361 def RunNavigateSteps(self, action_runner): | 261 def RunNavigateSteps(self, action_runner): |
362 action_runner.NavigateToPage(self) | 262 action_runner.NavigateToPage(self) |
363 action_runner.RunAction(WaitAction( | 263 action_runner.Wait(2) |
364 { | 264 action_runner.WaitForJavaScriptCondition( |
365 'seconds': 2 | 265 'document.getElementsByClassName("kix-appview-editor").length') |
366 })) | |
367 action_runner.RunAction(WaitAction( | |
368 { | |
369 'javascript': | |
370 'document.getElementsByClassName("kix-appview-editor").length' | |
371 })) | |
372 | 266 |
373 def RunSmoothness(self, action_runner): | 267 def RunSmoothness(self, action_runner): |
374 action_runner.RunAction(ScrollAction( | 268 action_runner.RunAction(ScrollAction( |
375 { | 269 { |
376 'scrollable_element_function': ''' | 270 'scrollable_element_function': ''' |
377 function(callback) { | 271 function(callback) { |
378 callback(document.getElementsByClassName('kix-appview-editor')[0]); | 272 callback(document.getElementsByClassName('kix-appview-editor')[0]); |
379 }''' | 273 }''' |
380 })) | 274 })) |
381 | 275 |
382 | 276 |
383 class GooglePlusPage(Top25Page): | 277 class GooglePlusPage(Top25Page): |
384 | 278 |
385 """ Why: social; top google property; Public profile; infinite scrolls """ | 279 """ Why: social; top google property; Public profile; infinite scrolls """ |
386 | 280 |
387 def __init__(self, page_set): | 281 def __init__(self, page_set): |
388 super(GooglePlusPage, self).__init__( | 282 super(GooglePlusPage, self).__init__( |
389 url='https://plus.google.com/110031535020051778989/posts', | 283 url='https://plus.google.com/110031535020051778989/posts', |
390 page_set=page_set) | 284 page_set=page_set) |
391 | 285 |
392 self.credentials = 'google' | 286 self.credentials = 'google' |
393 | 287 |
394 def RunNavigateSteps(self, action_runner): | 288 def RunNavigateSteps(self, action_runner): |
395 action_runner.NavigateToPage(self) | 289 action_runner.NavigateToPage(self) |
396 action_runner.RunAction(WaitAction( | 290 action_runner.WaitForElement(text='Home') |
397 { | |
398 'text' : 'Home', | |
399 'condition': 'element' | |
400 })) | |
401 | 291 |
402 def RunStressMemory(self, action_runner): | 292 def RunStressMemory(self, action_runner): |
403 action_runner.RunAction(ClickElementAction( | 293 action_runner.RunAction(ClickElementAction( |
404 { | 294 { |
405 'text' : 'Home' | 295 'text' : 'Home' |
406 })) | 296 })) |
407 action_runner.RunAction(WaitAction( | 297 action_runner.Wait(2) |
408 { | 298 action_runner.WaitForElement(text='Profile') |
409 'seconds': 2 | |
410 })) | |
411 action_runner.RunAction(WaitAction( | |
412 { | |
413 'text' : 'Profile', | |
414 'condition': 'element' | |
415 })) | |
416 action_runner.RunAction(ClickElementAction( | 299 action_runner.RunAction(ClickElementAction( |
417 { | 300 { |
418 'text' : 'Profile' | 301 'text' : 'Profile' |
419 })) | 302 })) |
420 action_runner.RunAction(WaitAction( | 303 action_runner.Wait(2) |
421 { | 304 action_runner.WaitForElement(text='Explore') |
422 'seconds': 2 | |
423 })) | |
424 action_runner.RunAction(WaitAction( | |
425 { | |
426 'text' : 'Explore', | |
427 'condition': 'element' | |
428 })) | |
429 action_runner.RunAction(ClickElementAction( | 305 action_runner.RunAction(ClickElementAction( |
430 { | 306 { |
431 'text' : 'Explore' | 307 'text' : 'Explore' |
432 })) | 308 })) |
433 action_runner.RunAction(WaitAction( | 309 action_runner.Wait(2) |
434 { | 310 action_runner.WaitForElement(text='Events') |
435 'seconds': 2 | |
436 })) | |
437 action_runner.RunAction(WaitAction( | |
438 { | |
439 'text' : 'Events', | |
440 'condition': 'element' | |
441 })) | |
442 action_runner.RunAction(ClickElementAction( | 311 action_runner.RunAction(ClickElementAction( |
443 { | 312 { |
444 'text' : 'Events' | 313 'text' : 'Events' |
445 })) | 314 })) |
446 action_runner.RunAction(WaitAction( | 315 action_runner.Wait(2) |
447 { | 316 action_runner.WaitForElement(text='Communities') |
448 'seconds': 2 | |
449 })) | |
450 action_runner.RunAction(WaitAction( | |
451 { | |
452 'text' : 'Communities', | |
453 'condition': 'element' | |
454 })) | |
455 action_runner.RunAction(ClickElementAction( | 317 action_runner.RunAction(ClickElementAction( |
456 { | 318 { |
457 'text' : 'Communities' | 319 'text' : 'Communities' |
458 })) | 320 })) |
459 action_runner.RunAction(WaitAction( | 321 action_runner.Wait(2) |
460 { | 322 action_runner.WaitForElement(text='Home') |
461 'seconds': 2 | |
462 })) | |
463 action_runner.RunAction(WaitAction( | |
464 { | |
465 'text' : 'Home', | |
466 'condition': 'element' | |
467 })) | |
468 | 323 |
469 def RunSmoothness(self, action_runner): | 324 def RunSmoothness(self, action_runner): |
470 action_runner.RunAction(ScrollAction( | 325 action_runner.RunAction(ScrollAction( |
471 { | 326 { |
472 "scroll_is_infinite": True | 327 "scroll_is_infinite": True |
473 })) | 328 })) |
474 | 329 |
475 | 330 |
476 class YoutubePage(Top25Page): | 331 class YoutubePage(Top25Page): |
477 | 332 |
478 """ Why: #3 (Alexa global) """ | 333 """ Why: #3 (Alexa global) """ |
479 | 334 |
480 def __init__(self, page_set): | 335 def __init__(self, page_set): |
481 super(YoutubePage, self).__init__( | 336 super(YoutubePage, self).__init__( |
482 url='http://www.youtube.com', | 337 url='http://www.youtube.com', |
483 page_set=page_set) | 338 page_set=page_set) |
484 | 339 |
485 self.credentials = 'google' | 340 self.credentials = 'google' |
486 | 341 |
487 def RunNavigateSteps(self, action_runner): | 342 def RunNavigateSteps(self, action_runner): |
488 action_runner.NavigateToPage(self) | 343 action_runner.NavigateToPage(self) |
489 action_runner.RunAction(WaitAction( | 344 action_runner.Wait(2) |
490 { | |
491 'seconds': 2 | |
492 })) | |
493 | 345 |
494 | 346 |
495 class BlogspotPage(Top25Page): | 347 class BlogspotPage(Top25Page): |
496 | 348 |
497 """ Why: #11 (Alexa global), google property; some blogger layouts have | 349 """ Why: #11 (Alexa global), google property; some blogger layouts have |
498 infinite scroll but more interesting """ | 350 infinite scroll but more interesting """ |
499 | 351 |
500 def __init__(self, page_set): | 352 def __init__(self, page_set): |
501 super(BlogspotPage, self).__init__( | 353 super(BlogspotPage, self).__init__( |
502 url='http://googlewebmastercentral.blogspot.com/', | 354 url='http://googlewebmastercentral.blogspot.com/', |
503 page_set=page_set, | 355 page_set=page_set, |
504 name='Blogger') | 356 name='Blogger') |
505 | 357 |
506 def RunNavigateSteps(self, action_runner): | 358 def RunNavigateSteps(self, action_runner): |
507 action_runner.NavigateToPage(self) | 359 action_runner.NavigateToPage(self) |
508 action_runner.RunAction(WaitAction( | 360 action_runner.WaitForElement(text='accessibility') |
509 { | |
510 'text' : 'accessibility', | |
511 'condition': 'element' | |
512 })) | |
513 | 361 |
514 def RunStressMemory(self, action_runner): | 362 def RunStressMemory(self, action_runner): |
515 action_runner.RunAction(ClickElementAction({'text' : 'accessibility'})) | 363 action_runner.RunAction(ClickElementAction({'text' : 'accessibility'})) |
516 action_runner.WaitForNavigate() | 364 action_runner.WaitForNavigate() |
517 action_runner.RunAction(ScrollAction()) | 365 action_runner.RunAction(ScrollAction()) |
518 action_runner.RunAction(ClickElementAction({'text' : 'advanced'})) | 366 action_runner.RunAction(ClickElementAction({'text' : 'advanced'})) |
519 action_runner.WaitForNavigate() | 367 action_runner.WaitForNavigate() |
520 action_runner.RunAction(ScrollAction()) | 368 action_runner.RunAction(ScrollAction()) |
521 action_runner.RunAction(ClickElementAction({'text' : 'beginner'})) | 369 action_runner.RunAction(ClickElementAction({'text' : 'beginner'})) |
522 action_runner.WaitForNavigate() | 370 action_runner.WaitForNavigate() |
523 action_runner.RunAction(ScrollAction()) | 371 action_runner.RunAction(ScrollAction()) |
524 action_runner.RunAction(ClickElementAction({'text' : 'Home'})) | 372 action_runner.RunAction(ClickElementAction({'text' : 'Home'})) |
525 action_runner.WaitForNavigate() | 373 action_runner.WaitForNavigate() |
526 | 374 |
527 | 375 |
528 class WordpressPage(Top25Page): | 376 class WordpressPage(Top25Page): |
529 | 377 |
530 """ Why: #18 (Alexa global), Picked an interesting post """ | 378 """ Why: #18 (Alexa global), Picked an interesting post """ |
531 | 379 |
532 def __init__(self, page_set): | 380 def __init__(self, page_set): |
533 super(WordpressPage, self).__init__( | 381 super(WordpressPage, self).__init__( |
534 # pylint: disable=C0301 | 382 # pylint: disable=C0301 |
535 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', | 383 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', |
536 page_set=page_set, | 384 page_set=page_set, |
537 name='Wordpress') | 385 name='Wordpress') |
538 | 386 |
539 def RunNavigateSteps(self, action_runner): | 387 def RunNavigateSteps(self, action_runner): |
540 action_runner.NavigateToPage(self) | 388 action_runner.NavigateToPage(self) |
541 action_runner.RunAction(WaitAction( | 389 action_runner.WaitForElement( |
542 { | 390 # pylint: disable=C0301 |
543 'condition': 'element', | 391 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sig
ht/"]') |
544 'selector': | |
545 # pylint: disable=C0301 | |
546 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' | |
547 })) | |
548 | 392 |
549 def RunStressMemory(self, action_runner): | 393 def RunStressMemory(self, action_runner): |
550 action_runner.RunAction(ScrollAction()) | 394 action_runner.RunAction(ScrollAction()) |
551 action_runner.RunAction(ClickElementAction( | 395 action_runner.RunAction(ClickElementAction( |
552 {'selector': | 396 {'selector': |
553 # pylint: disable=C0301 | 397 # pylint: disable=C0301 |
554 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' | 398 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' |
555 })) | 399 })) |
556 action_runner.WaitForNavigate() | 400 action_runner.WaitForNavigate() |
557 action_runner.RunAction(ScrollAction()) | 401 action_runner.RunAction(ScrollAction()) |
(...skipping 11 matching lines...) Expand all Loading... |
569 | 413 |
570 def __init__(self, page_set): | 414 def __init__(self, page_set): |
571 super(FacebookPage, self).__init__( | 415 super(FacebookPage, self).__init__( |
572 url='http://www.facebook.com/barackobama', | 416 url='http://www.facebook.com/barackobama', |
573 page_set=page_set, | 417 page_set=page_set, |
574 name='Facebook') | 418 name='Facebook') |
575 self.credentials = 'facebook' | 419 self.credentials = 'facebook' |
576 | 420 |
577 def RunNavigateSteps(self, action_runner): | 421 def RunNavigateSteps(self, action_runner): |
578 action_runner.NavigateToPage(self) | 422 action_runner.NavigateToPage(self) |
579 action_runner.RunAction(WaitAction( | 423 action_runner.WaitForElement(text='About') |
580 { | |
581 'text' : 'About', | |
582 'condition': 'element' | |
583 })) | |
584 | 424 |
585 def RunStressMemory(self, action_runner): | 425 def RunStressMemory(self, action_runner): |
586 action_runner.RunAction(ClickElementAction({'text' : 'About'})) | 426 action_runner.RunAction(ClickElementAction({'text' : 'About'})) |
587 action_runner.WaitForNavigate() | 427 action_runner.WaitForNavigate() |
588 action_runner.RunAction(ClickElementAction( | 428 action_runner.RunAction(ClickElementAction( |
589 { | 429 { |
590 'text' : 'The Audacity of Hope', | 430 'text' : 'The Audacity of Hope', |
591 })) | 431 })) |
592 action_runner.WaitForNavigate() | 432 action_runner.WaitForNavigate() |
593 action_runner.RunAction(ClickElementAction( | 433 action_runner.RunAction(ClickElementAction( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 """ Why: #8 (Alexa global),Picked an interesting page """ | 485 """ Why: #8 (Alexa global),Picked an interesting page """ |
646 | 486 |
647 def __init__(self, page_set): | 487 def __init__(self, page_set): |
648 super(TwitterPage, self).__init__( | 488 super(TwitterPage, self).__init__( |
649 url='https://twitter.com/katyperry', | 489 url='https://twitter.com/katyperry', |
650 page_set=page_set, | 490 page_set=page_set, |
651 name='Twitter') | 491 name='Twitter') |
652 | 492 |
653 def RunNavigateSteps(self, action_runner): | 493 def RunNavigateSteps(self, action_runner): |
654 action_runner.NavigateToPage(self) | 494 action_runner.NavigateToPage(self) |
655 action_runner.RunAction(WaitAction( | 495 action_runner.Wait(2) |
656 { | |
657 'seconds': 2 | |
658 })) | |
659 | 496 |
660 def RunSmoothness(self, action_runner): | 497 def RunSmoothness(self, action_runner): |
661 action_runner.RunAction(ScrollAction( | 498 action_runner.RunAction(ScrollAction( |
662 { | 499 { |
663 'scroll_is_infinite': True | 500 'scroll_is_infinite': True |
664 })) | 501 })) |
665 | 502 |
666 | 503 |
667 class PinterestPage(Top25Page): | 504 class PinterestPage(Top25Page): |
668 | 505 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 551 |
715 """ Why: #1 games according to Alexa (with actual games in it) """ | 552 """ Why: #1 games according to Alexa (with actual games in it) """ |
716 | 553 |
717 def __init__(self, page_set): | 554 def __init__(self, page_set): |
718 super(YahooGamesPage, self).__init__( | 555 super(YahooGamesPage, self).__init__( |
719 url='http://games.yahoo.com', | 556 url='http://games.yahoo.com', |
720 page_set=page_set) | 557 page_set=page_set) |
721 | 558 |
722 def RunNavigateSteps(self, action_runner): | 559 def RunNavigateSteps(self, action_runner): |
723 action_runner.NavigateToPage(self) | 560 action_runner.NavigateToPage(self) |
724 action_runner.RunAction(WaitAction( | 561 action_runner.Wait(2) |
725 { | |
726 'seconds': 2 | |
727 })) | |
728 | 562 |
729 | 563 |
730 class Top25PageSet(page_set_module.PageSet): | 564 class Top25PageSet(page_set_module.PageSet): |
731 | 565 |
732 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ | 566 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ |
733 | 567 |
734 def __init__(self): | 568 def __init__(self): |
735 super(Top25PageSet, self).__init__( | 569 super(Top25PageSet, self).__init__( |
736 credentials_path='data/credentials.json', | 570 credentials_path='data/credentials.json', |
737 user_agent_type='desktop', | 571 user_agent_type='desktop', |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 # Why: #1 Alexa reference | 604 # Why: #1 Alexa reference |
771 'http://answers.yahoo.com', | 605 'http://answers.yahoo.com', |
772 # Why: #1 Alexa sports | 606 # Why: #1 Alexa sports |
773 'http://sports.yahoo.com/', | 607 'http://sports.yahoo.com/', |
774 # Why: top tech blog | 608 # Why: top tech blog |
775 'http://techcrunch.com' | 609 'http://techcrunch.com' |
776 ] | 610 ] |
777 | 611 |
778 for url in other_urls: | 612 for url in other_urls: |
779 self.AddPage(Top25Page(url, self)) | 613 self.AddPage(Top25Page(url, self)) |
OLD | NEW |