[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / tools / perf / page_sets / key_silk_cases.py
blob73825ed1467bbe4d9f68b7b9498cafc640ecd953
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
3 # found in the LICENSE file.
4 from telemetry.page import page as page_module
5 from telemetry.page import shared_page_state
6 from telemetry import story
9 class KeySilkCasesPage(page_module.Page):
11 def __init__(self, url, page_set, run_no_page_interactions):
12 """ Base class for all key silk cases pages.
14 Args:
15 run_no_page_interactions: whether the page will run any interactions after
16 navigate steps.
17 """
18 super(KeySilkCasesPage, self).__init__(
19 url=url, page_set=page_set, credentials_path = 'data/credentials.json',
20 shared_page_state_class=shared_page_state.SharedMobilePageState)
21 self.archive_data_file = 'data/key_silk_cases.json'
22 self._run_no_page_interactions = run_no_page_interactions
24 def RunNavigateSteps(self, action_runner):
25 super(KeySilkCasesPage, self).RunNavigateSteps(action_runner)
26 action_runner.Wait(2)
28 def RunPageInteractions(self, action_runner):
29 # If a key silk case page wants to customize it actions, it should
30 # overrides the PerformPageInteractions method instead of this method.
31 if self._run_no_page_interactions:
32 return
33 self.PerformPageInteractions(action_runner)
35 def PerformPageInteractions(self, action_runner):
36 """ Perform interactions on page after navigate steps.
37 Override this to define custom actions to be run after navigate steps.
38 """
39 with action_runner.CreateGestureInteraction('ScrollAction'):
40 action_runner.ScrollPage()
43 class Page1(KeySilkCasesPage):
45 """ Why: Infinite scroll. Brings out all of our perf issues. """
47 def __init__(self, page_set, run_no_page_interactions):
48 super(Page1, self).__init__(
49 url='http://groupcloned.com/test/plain/list-recycle-transform.html',
50 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
52 def PerformPageInteractions(self, action_runner):
53 with action_runner.CreateGestureInteraction('ScrollAction'):
54 action_runner.ScrollElement(selector='#scrollable')
57 class Page2(KeySilkCasesPage):
59 """ Why: Brings out layer management bottlenecks. """
61 def __init__(self, page_set, run_no_page_interactions):
62 super(Page2, self).__init__(
63 url='file://key_silk_cases/list_animation_simple.html',
64 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
66 def PerformPageInteractions(self, action_runner):
67 with action_runner.CreateInteraction('SimpleAnimation'):
68 action_runner.Wait(2)
71 class Page3(KeySilkCasesPage):
73 """
74 Why: Best-known method for fake sticky. Janks sometimes. Interacts badly with
75 compositor scrolls.
76 """
78 def __init__(self, page_set, run_no_page_interactions):
79 super(Page3, self).__init__(
80 # pylint: disable=C0301
81 url='http://groupcloned.com/test/plain/sticky-using-webkit-backface-visibility.html',
82 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
84 def PerformPageInteractions(self, action_runner):
85 with action_runner.CreateGestureInteraction('ScrollAction'):
86 action_runner.ScrollElement(selector='#container')
89 class Page4(KeySilkCasesPage):
91 """
92 Why: Card expansion: only the card should repaint, but in reality lots of
93 storms happen.
94 """
96 def __init__(self, page_set, run_no_page_interactions):
97 super(Page4, self).__init__(
98 url='http://jsfiddle.net/3yDKh/15/show/',
99 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
101 def PerformPageInteractions(self, action_runner):
102 with action_runner.CreateInteraction('CardExpansionAnimation'):
103 action_runner.Wait(3)
106 class Page5(KeySilkCasesPage):
109 Why: Card expansion with animated contents, using will-change on the card
112 def __init__(self, page_set, run_no_page_interactions):
113 super(Page5, self).__init__(
114 url='http://jsfiddle.net/jx5De/14/show/',
115 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
117 self.gpu_raster = True
119 def PerformPageInteractions(self, action_runner):
120 with action_runner.CreateInteraction('CardExpansionAnimation'):
121 action_runner.Wait(4)
124 class Page6(KeySilkCasesPage):
127 Why: Card fly-in: It should be fast to animate in a bunch of cards using
128 margin-top and letting layout do the rest.
131 def __init__(self, page_set, run_no_page_interactions):
132 super(Page6, self).__init__(
133 url='http://jsfiddle.net/3yDKh/16/show/',
134 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
136 def PerformPageInteractions(self, action_runner):
137 with action_runner.CreateInteraction('CardFlyingAnimation'):
138 action_runner.Wait(3)
141 class Page7(KeySilkCasesPage):
144 Why: Image search expands a spacer div when you click an image to accomplish
145 a zoomin effect. Each image has a layer. Even so, this triggers a lot of
146 unnecessary repainting.
149 def __init__(self, page_set, run_no_page_interactions):
150 super(Page7, self).__init__(
151 url='http://jsfiddle.net/R8DX9/4/show/',
152 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
154 def PerformPageInteractions(self, action_runner):
155 with action_runner.CreateInteraction('ZoominAnimation'):
156 action_runner.Wait(3)
159 class Page8(KeySilkCasesPage):
162 Why: Swipe to dismiss of an element that has a fixed-position child that is
163 its pseudo-sticky header. Brings out issues with layer creation and
164 repainting.
167 def __init__(self, page_set, run_no_page_interactions):
168 super(Page8, self).__init__(
169 url='http://jsfiddle.net/rF9Gh/7/show/',
170 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
172 def PerformPageInteractions(self, action_runner):
173 with action_runner.CreateInteraction('SwipeToDismissAnimation'):
174 action_runner.Wait(3)
177 class Page9(KeySilkCasesPage):
180 Why: Horizontal and vertical expansion of a card that is cheap to layout but
181 costly to rasterize.
184 def __init__(self, page_set, run_no_page_interactions):
185 super(Page9, self).__init__(
186 url='http://jsfiddle.net/TLXLu/3/show/',
187 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
189 self.gpu_raster = True
191 def PerformPageInteractions(self, action_runner):
192 with action_runner.CreateInteraction('CardExpansionAnimation'):
193 action_runner.Wait(4)
196 class Page10(KeySilkCasesPage):
199 Why: Vertical Expansion of a card that is cheap to layout but costly to
200 rasterize.
203 def __init__(self, page_set, run_no_page_interactions):
204 super(Page10, self).__init__(
205 url='http://jsfiddle.net/cKB9D/7/show/',
206 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
208 self.gpu_raster = True
210 def PerformPageInteractions(self, action_runner):
211 with action_runner.CreateInteraction('CardExpansionAnimation'):
212 action_runner.Wait(4)
215 class Page11(KeySilkCasesPage):
218 Why: Parallax effect is common on photo-viewer-like applications, overloading
219 software rasterization
222 def __init__(self, page_set, run_no_page_interactions):
223 super(Page11, self).__init__(
224 url='http://jsfiddle.net/vBQHH/11/show/',
225 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
227 self.gpu_raster = True
229 def PerformPageInteractions(self, action_runner):
230 with action_runner.CreateInteraction('ParallaxAnimation'):
231 action_runner.Wait(4)
234 class Page12(KeySilkCasesPage):
236 """ Why: Addressing paint storms during coordinated animations. """
238 def __init__(self, page_set, run_no_page_interactions):
239 super(Page12, self).__init__(
240 url='http://jsfiddle.net/ugkd4/10/show/',
241 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
243 def PerformPageInteractions(self, action_runner):
244 with action_runner.CreateInteraction('CoordinatedAnimation'):
245 action_runner.Wait(5)
248 class Page13(KeySilkCasesPage):
250 """ Why: Mask transitions are common mobile use cases. """
252 def __init__(self, page_set, run_no_page_interactions):
253 super(Page13, self).__init__(
254 url='http://jsfiddle.net/xLuvC/1/show/',
255 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
257 self.gpu_raster = True
259 def PerformPageInteractions(self, action_runner):
260 with action_runner.CreateInteraction('MaskTransitionAnimation'):
261 action_runner.Wait(4)
264 class Page14(KeySilkCasesPage):
266 """ Why: Card expansions with images and text are pretty and common. """
268 def __init__(self, page_set, run_no_page_interactions):
269 super(Page14, self).__init__(
270 url='http://jsfiddle.net/bNp2h/3/show/',
271 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
273 self.gpu_raster = True
275 def PerformPageInteractions(self, action_runner):
276 with action_runner.CreateInteraction('CardExpansionAnimation'):
277 action_runner.Wait(4)
280 class Page15(KeySilkCasesPage):
282 """ Why: Coordinated animations for expanding elements. """
284 def __init__(self, page_set, run_no_page_interactions):
285 super(Page15, self).__init__(
286 url='file://key_silk_cases/font_wipe.html',
287 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
289 def PerformPageInteractions(self, action_runner):
290 with action_runner.CreateInteraction('CoordinatedAnimation'):
291 action_runner.Wait(5)
294 class Page16(KeySilkCasesPage):
296 def __init__(self, page_set, run_no_page_interactions):
297 super(Page16, self).__init__(
298 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss',
299 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
301 def SwipeToDismiss(self, action_runner):
302 with action_runner.CreateGestureInteraction('SwipeAction'):
303 action_runner.SwipeElement(
304 left_start_ratio=0.8, top_start_ratio=0.2,
305 direction='left', distance=400, speed_in_pixels_per_second=5000,
306 element_function='document.getElementsByClassName("message")[2]')
308 def PerformPageInteractions(self, action_runner):
309 self.SwipeToDismiss(action_runner)
312 class Page17(KeySilkCasesPage):
314 def __init__(self, page_set, run_no_page_interactions):
315 super(Page17, self).__init__(
316 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars',
317 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
319 def PerformPageInteractions(self, action_runner):
320 self.StressHideyBars(action_runner)
322 def StressHideyBars(self, action_runner):
323 with action_runner.CreateGestureInteraction(
324 'ScrollAction', repeatable=True):
325 action_runner.ScrollElement(
326 selector='#messages', direction='down', speed_in_pixels_per_second=200)
327 with action_runner.CreateGestureInteraction(
328 'ScrollAction', repeatable=True):
329 action_runner.ScrollElement(
330 selector='#messages', direction='up', speed_in_pixels_per_second=200)
331 with action_runner.CreateGestureInteraction(
332 'ScrollAction', repeatable=True):
333 action_runner.ScrollElement(
334 selector='#messages', direction='down',
335 speed_in_pixels_per_second=200)
338 class Page18(KeySilkCasesPage):
340 def __init__(self, page_set, run_no_page_interactions):
341 super(Page18, self).__init__(
342 url='file://key_silk_cases/inbox_app.html?toggle_drawer',
343 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
345 def PerformPageInteractions(self, action_runner):
346 for _ in xrange(6):
347 self.ToggleDrawer(action_runner)
349 def ToggleDrawer(self, action_runner):
350 with action_runner.CreateInteraction('Action_TapAction', repeatable=True):
351 action_runner.TapElement('#menu-button')
352 action_runner.Wait(1)
355 class Page19(KeySilkCasesPage):
357 def __init__(self, page_set, run_no_page_interactions):
358 super(Page19, self).__init__(
359 url='file://key_silk_cases/inbox_app.html?slide_drawer',
360 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
362 def ToggleDrawer(self, action_runner):
363 with action_runner.CreateGestureInteraction('TapAction'):
364 action_runner.TapElement('#menu-button')
366 with action_runner.CreateInteraction('Wait'):
367 action_runner.WaitForJavaScriptCondition('''
368 document.getElementById("nav-drawer").active &&
369 document.getElementById("nav-drawer").children[0]
370 .getBoundingClientRect().left == 0''')
372 def RunNavigateSteps(self, action_runner):
373 super(Page19, self).RunNavigateSteps(action_runner)
374 action_runner.Wait(2)
375 self.ToggleDrawer(action_runner)
377 def PerformPageInteractions(self, action_runner):
378 self.SlideDrawer(action_runner)
380 def SlideDrawer(self, action_runner):
381 with action_runner.CreateInteraction('Action_SwipeAction'):
382 action_runner.SwipeElement(
383 left_start_ratio=0.8, top_start_ratio=0.2,
384 direction='left', distance=200,
385 element_function='document.getElementById("nav-drawer").children[0]')
386 action_runner.WaitForJavaScriptCondition(
387 '!document.getElementById("nav-drawer").active')
390 class Page20(KeySilkCasesPage):
392 """ Why: Shadow DOM infinite scrolling. """
394 def __init__(self, page_set, run_no_page_interactions):
395 super(Page20, self).__init__(
396 url='file://key_silk_cases/infinite_scrolling.html',
397 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
399 def PerformPageInteractions(self, action_runner):
400 with action_runner.CreateGestureInteraction('ScrollAction'):
401 action_runner.ScrollElement(
402 selector='#container', speed_in_pixels_per_second=5000)
405 class GwsExpansionPage(KeySilkCasesPage):
406 """Abstract base class for pages that expand Google knowledge panels."""
408 def NavigateWait(self, action_runner):
409 super(GwsExpansionPage, self).RunNavigateSteps(action_runner)
410 action_runner.Wait(3)
412 def ExpandKnowledgeCard(self, action_runner):
413 # expand card
414 with action_runner.CreateInteraction('Action_TapAction'):
415 action_runner.TapElement(
416 element_function='document.getElementsByClassName("vk_arc")[0]')
417 action_runner.Wait(2)
419 def ScrollKnowledgeCardToTop(self, action_runner, card_id):
420 # scroll until the knowledge card is at the top
421 action_runner.ExecuteJavaScript(
422 "document.getElementById('%s').scrollIntoView()" % card_id)
424 def PerformPageInteractions(self, action_runner):
425 self.ExpandKnowledgeCard(action_runner)
428 class GwsGoogleExpansion(GwsExpansionPage):
430 """ Why: Animating height of a complex content card is common. """
432 def __init__(self, page_set, run_no_page_interactions):
433 super(GwsGoogleExpansion, self).__init__(
434 url='http://www.google.com/#q=google',
435 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
437 def RunNavigateSteps(self, action_runner):
438 self.NavigateWait(action_runner)
439 self.ScrollKnowledgeCardToTop(action_runner, 'kno-result')
442 class GwsBoogieExpansion(GwsExpansionPage):
444 """ Why: Same case as Google expansion but text-heavy rather than image. """
446 def __init__(self, page_set, run_no_page_interactions):
447 super(GwsBoogieExpansion, self).__init__(
448 url='https://www.google.com/search?hl=en&q=define%3Aboogie',
449 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
451 def RunNavigateSteps(self, action_runner):
452 self.NavigateWait(action_runner)
453 self.ScrollKnowledgeCardToTop(action_runner, 'rso')
456 class Page22(KeySilkCasesPage):
458 def __init__(self, page_set, run_no_page_interactions):
459 super(Page22, self).__init__(
460 url='http://plus.google.com/app/basic/stream',
461 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
463 self.credentials = 'google'
465 def RunNavigateSteps(self, action_runner):
466 super(Page22, self).RunNavigateSteps(action_runner)
467 action_runner.WaitForJavaScriptCondition(
468 'document.getElementsByClassName("fHa").length > 0')
469 action_runner.Wait(2)
471 def PerformPageInteractions(self, action_runner):
472 with action_runner.CreateGestureInteraction('ScrollAction'):
473 action_runner.ScrollElement(selector='#mainContent')
476 class Page23(KeySilkCasesPage):
479 Why: Physical simulation demo that does a lot of element.style mutation
480 triggering JS and recalc slowness
483 def __init__(self, page_set, run_no_page_interactions):
484 super(Page23, self).__init__(
485 url='http://jsbin.com/UVIgUTa/38/quiet',
486 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
488 def PerformPageInteractions(self, action_runner):
489 with action_runner.CreateGestureInteraction('ScrollAction',
490 repeatable=True):
491 action_runner.ScrollPage(
492 distance_expr='window.innerHeight / 2',
493 direction='down',
494 use_touch=True)
495 with action_runner.CreateGestureInteraction('ScrollAction',
496 repeatable=True):
497 action_runner.Wait(1)
500 class Page24(KeySilkCasesPage):
503 Why: Google News: this iOS version is slower than accelerated scrolling
506 def __init__(self, page_set, run_no_page_interactions):
507 super(Page24, self).__init__(
508 url='http://mobile-news.sandbox.google.com/news/pt0?scroll',
509 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
511 def RunNavigateSteps(self, action_runner):
512 super(Page24, self).RunNavigateSteps(action_runner)
513 action_runner.WaitForJavaScriptCondition(
514 'document.getElementById(":h") != null')
515 action_runner.Wait(1)
517 def PerformPageInteractions(self, action_runner):
518 with action_runner.CreateGestureInteraction('ScrollAction'):
519 action_runner.ScrollElement(
520 element_function='document.getElementById(":5")',
521 distance=2500,
522 use_touch=True)
525 class Page25(KeySilkCasesPage):
527 def __init__(self, page_set, run_no_page_interactions):
528 super(Page25, self).__init__(
529 url='http://mobile-news.sandbox.google.com/news/pt0?swipe',
530 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
532 def RunNavigateSteps(self, action_runner):
533 super(Page25, self).RunNavigateSteps(action_runner)
534 action_runner.WaitForJavaScriptCondition(
535 'document.getElementById(":h") != null')
536 action_runner.Wait(1)
538 def PerformPageInteractions(self, action_runner):
539 with action_runner.CreateGestureInteraction('SwipeAction', repeatable=True):
540 action_runner.SwipeElement(
541 direction='left', distance=100,
542 element_function='document.getElementById(":f")')
543 with action_runner.CreateGestureInteraction('SwipeAction', repeatable=True):
544 action_runner.Wait(1)
547 class Page26(KeySilkCasesPage):
549 """ Why: famo.us twitter demo """
551 def __init__(self, page_set, run_no_page_interactions):
552 super(Page26, self).__init__(
553 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll',
554 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
556 def RunNavigateSteps(self, action_runner):
557 super(Page26, self).RunNavigateSteps(action_runner)
558 action_runner.WaitForJavaScriptCondition(
559 'document.getElementsByClassName("tweet").length > 0')
560 action_runner.Wait(1)
562 def PerformPageInteractions(self, action_runner):
563 with action_runner.CreateGestureInteraction('ScrollAction'):
564 action_runner.ScrollPage(distance=5000)
567 class SVGIconRaster(KeySilkCasesPage):
569 """ Why: Mutating SVG icons; these paint storm and paint slowly. """
571 def __init__(self, page_set, run_no_page_interactions):
572 super(SVGIconRaster, self).__init__(
573 url='http://wiltzius.github.io/shape-shifter/',
574 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
576 def RunNavigateSteps(self, action_runner):
577 super(SVGIconRaster, self).RunNavigateSteps(action_runner)
578 action_runner.WaitForJavaScriptCondition(
579 'loaded = true')
580 action_runner.Wait(1)
582 def PerformPageInteractions(self, action_runner):
583 for i in xrange(9):
584 button_func = ('document.getElementById("demo").$.'
585 'buttons.children[%d]') % i
586 with action_runner.CreateInteraction('Action_TapAction', repeatable=True):
587 action_runner.TapElement(element_function=button_func)
588 action_runner.Wait(1)
591 class UpdateHistoryState(KeySilkCasesPage):
593 """ Why: Modern apps often update history state, which currently is janky."""
595 def __init__(self, page_set, run_no_page_interactions):
596 super(UpdateHistoryState, self).__init__(
597 url='file://key_silk_cases/pushState.html',
598 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
600 def RunNavigateSteps(self, action_runner):
601 super(UpdateHistoryState, self).RunNavigateSteps(action_runner)
602 action_runner.ExecuteJavaScript('''
603 window.requestAnimationFrame(function() {
604 window.__history_state_loaded = true;
606 ''')
607 action_runner.WaitForJavaScriptCondition(
608 'window.__history_state_loaded == true;')
610 def PerformPageInteractions(self, action_runner):
611 with action_runner.CreateInteraction('animation_interaction'):
612 action_runner.Wait(5) # JS runs the animation continuously on the page
615 class SilkFinance(KeySilkCasesPage):
617 """ Why: Some effects repaint the page, possibly including plenty of text. """
619 def __init__(self, page_set, run_no_page_interactions):
620 super(SilkFinance, self).__init__(
621 url='file://key_silk_cases/silk_finance.html',
622 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
624 def PerformPageInteractions(self, action_runner):
625 with action_runner.CreateInteraction('animation_interaction'):
626 action_runner.Wait(10) # animation runs automatically
629 class PolymerTopeka(KeySilkCasesPage):
631 """ Why: Sample Polymer app. """
633 def __init__(self, page_set, run_no_page_interactions):
634 super(PolymerTopeka, self).__init__(
635 url='https://polymer-topeka.appspot.com/',
636 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
638 def PerformPageInteractions(self, action_runner):
639 profile = 'html /deep/ topeka-profile /deep/ '
640 first_name = profile + 'paper-input#first /deep/ input'
641 action_runner.WaitForElement(selector=first_name)
642 # Input First Name:
643 action_runner.ExecuteJavaScript('''
644 var fn = document.querySelector('%s');
645 fn.value = 'Chrome';
646 fn.fire('input');''' % first_name)
647 # Input Last Initial:
648 action_runner.ExecuteJavaScript('''
649 var li = document.querySelector('%s paper-input#last /deep/ input');
650 li.value = 'E';
651 li.fire('input');''' % profile)
652 with action_runner.CreateInteraction('animation_interaction'):
653 # Click the check-mark to login:
654 action_runner.ExecuteJavaScript('''
655 window.topeka_page_transitions = 0;
656 [].forEach.call(document.querySelectorAll(
657 'html /deep/ core-animated-pages'), function(p){
658 p.addEventListener(
659 'core-animated-pages-transition-end', function(e) {
660 window.topeka_page_transitions++;
663 document.querySelector('%s paper-fab').fire('tap')''' % profile)
664 # Wait for category list to animate in:
665 action_runner.WaitForJavaScriptCondition('''
666 window.topeka_page_transitions === 1''')
667 # Click a category to start a quiz:
668 action_runner.ExecuteJavaScript('''
669 document.querySelector('\
670 html /deep/ core-selector.category-list').fire(
671 'tap',1,document.querySelector('html /deep/ \
672 div.category-item.red-theme'));''')
673 # Wait for the category splash to animate in:
674 action_runner.WaitForJavaScriptCondition('''
675 window.topeka_page_transitions === 2''')
676 # Click to start the quiz:
677 action_runner.ExecuteJavaScript('''
678 document.querySelector('html /deep/ topeka-category-front-page /deep/\
679 paper-fab').fire('tap');''')
680 action_runner.WaitForJavaScriptCondition('''
681 window.topeka_page_transitions === 4''')
682 # Input a mostly correct answer:
683 action_runner.ExecuteJavaScript('''
684 document.querySelector('html /deep/ topeka-quiz-fill-blank /deep/\
685 input').value = 'arkinsaw';
686 document.querySelector('html /deep/ topeka-quiz-fill-blank /deep/\
687 input').fire('input');
688 document.querySelector('html /deep/ topeka-quizzes /deep/ \
689 paper-fab').fire('tap');''')
690 action_runner.WaitForJavaScriptCondition('''
691 window.topeka_page_transitions === 6''')
693 class Masonry(KeySilkCasesPage):
695 """ Why: Popular layout hack. """
697 def __init__(self, page_set, run_no_page_interactions):
698 super(Masonry, self).__init__(
699 url='file://key_silk_cases/masonry.html',
700 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
702 def PerformPageInteractions(self, action_runner):
703 with action_runner.CreateInteraction('animation_interaction'):
704 action_runner.ExecuteJavaScript('window.brick()')
705 action_runner.WaitForJavaScriptCondition('window.done')
708 class KeySilkCasesPageSet(story.StorySet):
710 """ Pages hand-picked for project Silk. """
712 def __init__(self, run_no_page_interactions=False):
713 super(KeySilkCasesPageSet, self).__init__(
714 archive_data_file='data/key_silk_cases.json',
715 cloud_storage_bucket=story.PARTNER_BUCKET)
717 self.AddStory(Page1(self, run_no_page_interactions))
718 self.AddStory(Page2(self, run_no_page_interactions))
719 self.AddStory(Page3(self, run_no_page_interactions))
720 self.AddStory(Page4(self, run_no_page_interactions))
721 self.AddStory(Page5(self, run_no_page_interactions))
722 self.AddStory(Page6(self, run_no_page_interactions))
723 self.AddStory(Page7(self, run_no_page_interactions))
724 self.AddStory(Page8(self, run_no_page_interactions))
725 self.AddStory(Page9(self, run_no_page_interactions))
726 self.AddStory(Page10(self, run_no_page_interactions))
727 self.AddStory(Page11(self, run_no_page_interactions))
728 self.AddStory(Page12(self, run_no_page_interactions))
729 self.AddStory(Page13(self, run_no_page_interactions))
730 self.AddStory(Page14(self, run_no_page_interactions))
731 self.AddStory(Page15(self, run_no_page_interactions))
732 self.AddStory(Page16(self, run_no_page_interactions))
733 self.AddStory(Page17(self, run_no_page_interactions))
734 self.AddStory(Page18(self, run_no_page_interactions))
735 # Missing frames during tap interaction; crbug.com/446332
736 # self.AddStory(Page19(self, run_no_page_interactions))
737 self.AddStory(Page20(self, run_no_page_interactions))
738 self.AddStory(GwsGoogleExpansion(self, run_no_page_interactions))
739 self.AddStory(GwsBoogieExpansion(self, run_no_page_interactions))
740 # Times out on Windows; crbug.com/338838
741 # self.AddStory(Page22(self, run_no_page_interactions))
742 self.AddStory(Page23(self, run_no_page_interactions))
743 self.AddStory(Page24(self, run_no_page_interactions))
744 self.AddStory(Page25(self, run_no_page_interactions))
745 self.AddStory(Page26(self, run_no_page_interactions))
746 self.AddStory(SVGIconRaster(self, run_no_page_interactions))
747 self.AddStory(UpdateHistoryState(self, run_no_page_interactions))
748 self.AddStory(SilkFinance(self, run_no_page_interactions))
749 # Flaky interaction steps on Android; crbug.com/507865
750 # self.AddStory(PolymerTopeka(self, run_no_page_interactions))
751 self.AddStory(Masonry(self, run_no_page_interactions))
753 for page in self:
754 assert (page.__class__.RunPageInteractions ==
755 KeySilkCasesPage.RunPageInteractions), (
756 'Pages in this page set must not override KeySilkCasesPage\' '
757 'RunPageInteractions method.')