| 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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
| 5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
| 6 | 6 |
| 7 | 7 |
| 8 class KeySilkCasesPage(page_module.Page): | 8 class KeySilkCasesPage(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set, run_no_page_interactions): | 10 def __init__(self, url, page_set, run_no_page_interactions): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 # overrides the PerformPageInteractions method instead of this method. | 29 # overrides the PerformPageInteractions method instead of this method. |
| 30 if self._run_no_page_interactions: | 30 if self._run_no_page_interactions: |
| 31 return | 31 return |
| 32 self.PerformPageInteractions(action_runner) | 32 self.PerformPageInteractions(action_runner) |
| 33 | 33 |
| 34 def PerformPageInteractions(self, action_runner): | 34 def PerformPageInteractions(self, action_runner): |
| 35 """ Perform interactions on page after navigate steps. | 35 """ Perform interactions on page after navigate steps. |
| 36 Override this to define custom actions to be run after navigate steps. | 36 Override this to define custom actions to be run after navigate steps. |
| 37 """ | 37 """ |
| 38 interaction = action_runner.BeginGestureInteraction( | 38 interaction = action_runner.BeginGestureInteraction( |
| 39 'ScrollAction', is_smooth=True) | 39 'ScrollAction') |
| 40 action_runner.ScrollPage() | 40 action_runner.ScrollPage() |
| 41 interaction.End() | 41 interaction.End() |
| 42 | 42 |
| 43 | 43 |
| 44 class Page1(KeySilkCasesPage): | 44 class Page1(KeySilkCasesPage): |
| 45 | 45 |
| 46 """ Why: Infinite scroll. Brings out all of our perf issues. """ | 46 """ Why: Infinite scroll. Brings out all of our perf issues. """ |
| 47 | 47 |
| 48 def __init__(self, page_set, run_no_page_interactions): | 48 def __init__(self, page_set, run_no_page_interactions): |
| 49 super(Page1, self).__init__( | 49 super(Page1, self).__init__( |
| 50 url='http://groupcloned.com/test/plain/list-recycle-transform.html', | 50 url='http://groupcloned.com/test/plain/list-recycle-transform.html', |
| 51 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 51 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 52 | 52 |
| 53 def PerformPageInteractions(self, action_runner): | 53 def PerformPageInteractions(self, action_runner): |
| 54 interaction = action_runner.BeginGestureInteraction( | 54 interaction = action_runner.BeginGestureInteraction( |
| 55 'ScrollAction', is_smooth=True) | 55 'ScrollAction') |
| 56 action_runner.ScrollElement(selector='#scrollable') | 56 action_runner.ScrollElement(selector='#scrollable') |
| 57 interaction.End() | 57 interaction.End() |
| 58 | 58 |
| 59 | 59 |
| 60 class Page2(KeySilkCasesPage): | 60 class Page2(KeySilkCasesPage): |
| 61 | 61 |
| 62 """ Why: Brings out layer management bottlenecks. """ | 62 """ Why: Brings out layer management bottlenecks. """ |
| 63 | 63 |
| 64 def __init__(self, page_set, run_no_page_interactions): | 64 def __init__(self, page_set, run_no_page_interactions): |
| 65 super(Page2, self).__init__( | 65 super(Page2, self).__init__( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 """ | 78 """ |
| 79 | 79 |
| 80 def __init__(self, page_set, run_no_page_interactions): | 80 def __init__(self, page_set, run_no_page_interactions): |
| 81 super(Page3, self).__init__( | 81 super(Page3, self).__init__( |
| 82 # pylint: disable=C0301 | 82 # pylint: disable=C0301 |
| 83 url='http://groupcloned.com/test/plain/sticky-using-webkit-backface-visibi
lity.html', | 83 url='http://groupcloned.com/test/plain/sticky-using-webkit-backface-visibi
lity.html', |
| 84 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 84 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 85 | 85 |
| 86 def PerformPageInteractions(self, action_runner): | 86 def PerformPageInteractions(self, action_runner): |
| 87 interaction = action_runner.BeginGestureInteraction( | 87 interaction = action_runner.BeginGestureInteraction( |
| 88 'ScrollAction', is_smooth=True) | 88 'ScrollAction') |
| 89 action_runner.ScrollElement(selector='#container') | 89 action_runner.ScrollElement(selector='#container') |
| 90 interaction.End() | 90 interaction.End() |
| 91 | 91 |
| 92 | 92 |
| 93 class Page4(KeySilkCasesPage): | 93 class Page4(KeySilkCasesPage): |
| 94 | 94 |
| 95 """ | 95 """ |
| 96 Why: Card expansion: only the card should repaint, but in reality lots of | 96 Why: Card expansion: only the card should repaint, but in reality lots of |
| 97 storms happen. | 97 storms happen. |
| 98 """ | 98 """ |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 class Page16(KeySilkCasesPage): | 286 class Page16(KeySilkCasesPage): |
| 287 | 287 |
| 288 def __init__(self, page_set, run_no_page_interactions): | 288 def __init__(self, page_set, run_no_page_interactions): |
| 289 super(Page16, self).__init__( | 289 super(Page16, self).__init__( |
| 290 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', | 290 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', |
| 291 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 291 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 292 | 292 |
| 293 def SwipeToDismiss(self, action_runner): | 293 def SwipeToDismiss(self, action_runner): |
| 294 interaction = action_runner.BeginGestureInteraction( | 294 interaction = action_runner.BeginGestureInteraction( |
| 295 'SwipeAction', is_smooth=True) | 295 'SwipeAction') |
| 296 action_runner.SwipeElement( | 296 action_runner.SwipeElement( |
| 297 left_start_ratio=0.8, top_start_ratio=0.2, | 297 left_start_ratio=0.8, top_start_ratio=0.2, |
| 298 direction='left', distance=400, speed_in_pixels_per_second=5000, | 298 direction='left', distance=400, speed_in_pixels_per_second=5000, |
| 299 element_function='document.getElementsByClassName("message")[2]') | 299 element_function='document.getElementsByClassName("message")[2]') |
| 300 interaction.End() | 300 interaction.End() |
| 301 | 301 |
| 302 def PerformPageInteractions(self, action_runner): | 302 def PerformPageInteractions(self, action_runner): |
| 303 self.SwipeToDismiss(action_runner) | 303 self.SwipeToDismiss(action_runner) |
| 304 | 304 |
| 305 | 305 |
| 306 class Page17(KeySilkCasesPage): | 306 class Page17(KeySilkCasesPage): |
| 307 | 307 |
| 308 def __init__(self, page_set, run_no_page_interactions): | 308 def __init__(self, page_set, run_no_page_interactions): |
| 309 super(Page17, self).__init__( | 309 super(Page17, self).__init__( |
| 310 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', | 310 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', |
| 311 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 311 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 312 | 312 |
| 313 def PerformPageInteractions(self, action_runner): | 313 def PerformPageInteractions(self, action_runner): |
| 314 self.StressHideyBars(action_runner) | 314 self.StressHideyBars(action_runner) |
| 315 | 315 |
| 316 def StressHideyBars(self, action_runner): | 316 def StressHideyBars(self, action_runner): |
| 317 interaction = action_runner.BeginGestureInteraction( | 317 interaction = action_runner.BeginGestureInteraction( |
| 318 'ScrollAction', is_smooth=True) | 318 'ScrollAction') |
| 319 action_runner.ScrollElement( | 319 action_runner.ScrollElement( |
| 320 selector='#messages', direction='down', speed_in_pixels_per_second=200) | 320 selector='#messages', direction='down', speed_in_pixels_per_second=200) |
| 321 interaction.End() | 321 interaction.End() |
| 322 interaction = action_runner.BeginGestureInteraction( | 322 interaction = action_runner.BeginGestureInteraction( |
| 323 'ScrollAction', is_smooth=True) | 323 'ScrollAction') |
| 324 action_runner.ScrollElement( | 324 action_runner.ScrollElement( |
| 325 selector='#messages', direction='up', speed_in_pixels_per_second=200) | 325 selector='#messages', direction='up', speed_in_pixels_per_second=200) |
| 326 interaction.End() | 326 interaction.End() |
| 327 interaction = action_runner.BeginGestureInteraction( | 327 interaction = action_runner.BeginGestureInteraction( |
| 328 'ScrollAction', is_smooth=True) | 328 'ScrollAction') |
| 329 action_runner.ScrollElement( | 329 action_runner.ScrollElement( |
| 330 selector='#messages', direction='down', speed_in_pixels_per_second=200) | 330 selector='#messages', direction='down', speed_in_pixels_per_second=200) |
| 331 interaction.End() | 331 interaction.End() |
| 332 | 332 |
| 333 | 333 |
| 334 class Page18(KeySilkCasesPage): | 334 class Page18(KeySilkCasesPage): |
| 335 | 335 |
| 336 def __init__(self, page_set, run_no_page_interactions): | 336 def __init__(self, page_set, run_no_page_interactions): |
| 337 super(Page18, self).__init__( | 337 super(Page18, self).__init__( |
| 338 url='file://key_silk_cases/inbox_app.html?toggle_drawer', | 338 url='file://key_silk_cases/inbox_app.html?toggle_drawer', |
| 339 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 339 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 340 | 340 |
| 341 def PerformPageInteractions(self, action_runner): | 341 def PerformPageInteractions(self, action_runner): |
| 342 for _ in xrange(6): | 342 for _ in xrange(6): |
| 343 self.ToggleDrawer(action_runner) | 343 self.ToggleDrawer(action_runner) |
| 344 | 344 |
| 345 def ToggleDrawer(self, action_runner): | 345 def ToggleDrawer(self, action_runner): |
| 346 interaction = action_runner.BeginInteraction( | 346 interaction = action_runner.BeginInteraction( |
| 347 'Action_TapAction', is_smooth=True) | 347 'Action_TapAction') |
| 348 action_runner.TapElement('#menu-button') | 348 action_runner.TapElement('#menu-button') |
| 349 action_runner.Wait(1) | 349 action_runner.Wait(1) |
| 350 interaction.End() | 350 interaction.End() |
| 351 | 351 |
| 352 | 352 |
| 353 class Page19(KeySilkCasesPage): | 353 class Page19(KeySilkCasesPage): |
| 354 | 354 |
| 355 def __init__(self, page_set, run_no_page_interactions): | 355 def __init__(self, page_set, run_no_page_interactions): |
| 356 super(Page19, self).__init__( | 356 super(Page19, self).__init__( |
| 357 url='file://key_silk_cases/inbox_app.html?slide_drawer', | 357 url='file://key_silk_cases/inbox_app.html?slide_drawer', |
| 358 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 358 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 359 | 359 |
| 360 def ToggleDrawer(self, action_runner): | 360 def ToggleDrawer(self, action_runner): |
| 361 interaction = action_runner.BeginGestureInteraction( | 361 interaction = action_runner.BeginGestureInteraction( |
| 362 'TapAction', is_smooth=True) | 362 'TapAction') |
| 363 action_runner.TapElement('#menu-button') | 363 action_runner.TapElement('#menu-button') |
| 364 interaction.End() | 364 interaction.End() |
| 365 | 365 |
| 366 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 366 interaction = action_runner.BeginInteraction('Wait') |
| 367 action_runner.WaitForJavaScriptCondition(''' | 367 action_runner.WaitForJavaScriptCondition(''' |
| 368 document.getElementById("nav-drawer").active && | 368 document.getElementById("nav-drawer").active && |
| 369 document.getElementById("nav-drawer").children[0] | 369 document.getElementById("nav-drawer").children[0] |
| 370 .getBoundingClientRect().left == 0''') | 370 .getBoundingClientRect().left == 0''') |
| 371 interaction.End() | 371 interaction.End() |
| 372 | 372 |
| 373 def RunNavigateSteps(self, action_runner): | 373 def RunNavigateSteps(self, action_runner): |
| 374 super(Page19, self).RunNavigateSteps(action_runner) | 374 super(Page19, self).RunNavigateSteps(action_runner) |
| 375 action_runner.Wait(2) | 375 action_runner.Wait(2) |
| 376 self.ToggleDrawer(action_runner) | 376 self.ToggleDrawer(action_runner) |
| 377 | 377 |
| 378 def PerformPageInteractions(self, action_runner): | 378 def PerformPageInteractions(self, action_runner): |
| 379 self.SlideDrawer(action_runner) | 379 self.SlideDrawer(action_runner) |
| 380 | 380 |
| 381 def SlideDrawer(self, action_runner): | 381 def SlideDrawer(self, action_runner): |
| 382 interaction = action_runner.BeginInteraction( | 382 interaction = action_runner.BeginInteraction( |
| 383 'Action_SwipeAction', is_smooth=True) | 383 'Action_SwipeAction') |
| 384 action_runner.SwipeElement( | 384 action_runner.SwipeElement( |
| 385 left_start_ratio=0.8, top_start_ratio=0.2, | 385 left_start_ratio=0.8, top_start_ratio=0.2, |
| 386 direction='left', distance=200, | 386 direction='left', distance=200, |
| 387 element_function='document.getElementById("nav-drawer").children[0]') | 387 element_function='document.getElementById("nav-drawer").children[0]') |
| 388 action_runner.WaitForJavaScriptCondition( | 388 action_runner.WaitForJavaScriptCondition( |
| 389 '!document.getElementById("nav-drawer").active') | 389 '!document.getElementById("nav-drawer").active') |
| 390 interaction.End() | 390 interaction.End() |
| 391 | 391 |
| 392 | 392 |
| 393 class Page20(KeySilkCasesPage): | 393 class Page20(KeySilkCasesPage): |
| 394 | 394 |
| 395 """ Why: Shadow DOM infinite scrolling. """ | 395 """ Why: Shadow DOM infinite scrolling. """ |
| 396 | 396 |
| 397 def __init__(self, page_set, run_no_page_interactions): | 397 def __init__(self, page_set, run_no_page_interactions): |
| 398 super(Page20, self).__init__( | 398 super(Page20, self).__init__( |
| 399 url='file://key_silk_cases/infinite_scrolling.html', | 399 url='file://key_silk_cases/infinite_scrolling.html', |
| 400 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 400 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 401 | 401 |
| 402 def PerformPageInteractions(self, action_runner): | 402 def PerformPageInteractions(self, action_runner): |
| 403 interaction = action_runner.BeginGestureInteraction( | 403 interaction = action_runner.BeginGestureInteraction( |
| 404 'ScrollAction', is_smooth=True) | 404 'ScrollAction') |
| 405 action_runner.ScrollElement( | 405 action_runner.ScrollElement( |
| 406 selector='#container', speed_in_pixels_per_second=5000) | 406 selector='#container', speed_in_pixels_per_second=5000) |
| 407 interaction.End() | 407 interaction.End() |
| 408 | 408 |
| 409 | 409 |
| 410 class GwsExpansionPage(KeySilkCasesPage): | 410 class GwsExpansionPage(KeySilkCasesPage): |
| 411 """Abstract base class for pages that expand Google knowledge panels.""" | 411 """Abstract base class for pages that expand Google knowledge panels.""" |
| 412 | 412 |
| 413 def NavigateWait(self, action_runner): | 413 def NavigateWait(self, action_runner): |
| 414 super(GwsExpansionPage, self).RunNavigateSteps(action_runner) | 414 super(GwsExpansionPage, self).RunNavigateSteps(action_runner) |
| 415 action_runner.Wait(3) | 415 action_runner.Wait(3) |
| 416 | 416 |
| 417 def ExpandKnowledgeCard(self, action_runner): | 417 def ExpandKnowledgeCard(self, action_runner): |
| 418 # expand card | 418 # expand card |
| 419 interaction = action_runner.BeginInteraction( | 419 interaction = action_runner.BeginInteraction( |
| 420 'Action_TapAction', is_smooth=True) | 420 'Action_TapAction') |
| 421 action_runner.TapElement( | 421 action_runner.TapElement( |
| 422 element_function='document.getElementsByClassName("vk_arc")[0]') | 422 element_function='document.getElementsByClassName("vk_arc")[0]') |
| 423 action_runner.Wait(2) | 423 action_runner.Wait(2) |
| 424 interaction.End() | 424 interaction.End() |
| 425 | 425 |
| 426 def ScrollKnowledgeCardToTop(self, action_runner, card_id): | 426 def ScrollKnowledgeCardToTop(self, action_runner, card_id): |
| 427 # scroll until the knowledge card is at the top | 427 # scroll until the knowledge card is at the top |
| 428 action_runner.ExecuteJavaScript( | 428 action_runner.ExecuteJavaScript( |
| 429 "document.getElementById('%s').scrollIntoView()" % card_id) | 429 "document.getElementById('%s').scrollIntoView()" % card_id) |
| 430 | 430 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 self.credentials = 'google' | 470 self.credentials = 'google' |
| 471 | 471 |
| 472 def RunNavigateSteps(self, action_runner): | 472 def RunNavigateSteps(self, action_runner): |
| 473 super(Page22, self).RunNavigateSteps(action_runner) | 473 super(Page22, self).RunNavigateSteps(action_runner) |
| 474 action_runner.WaitForJavaScriptCondition( | 474 action_runner.WaitForJavaScriptCondition( |
| 475 'document.getElementsByClassName("fHa").length > 0') | 475 'document.getElementsByClassName("fHa").length > 0') |
| 476 action_runner.Wait(2) | 476 action_runner.Wait(2) |
| 477 | 477 |
| 478 def PerformPageInteractions(self, action_runner): | 478 def PerformPageInteractions(self, action_runner): |
| 479 interaction = action_runner.BeginGestureInteraction( | 479 interaction = action_runner.BeginGestureInteraction( |
| 480 'ScrollAction', is_smooth=True) | 480 'ScrollAction') |
| 481 action_runner.ScrollElement(selector='#mainContent') | 481 action_runner.ScrollElement(selector='#mainContent') |
| 482 interaction.End() | 482 interaction.End() |
| 483 | 483 |
| 484 | 484 |
| 485 class Page23(KeySilkCasesPage): | 485 class Page23(KeySilkCasesPage): |
| 486 | 486 |
| 487 """ | 487 """ |
| 488 Why: Physical simulation demo that does a lot of element.style mutation | 488 Why: Physical simulation demo that does a lot of element.style mutation |
| 489 triggering JS and recalc slowness | 489 triggering JS and recalc slowness |
| 490 """ | 490 """ |
| 491 | 491 |
| 492 def __init__(self, page_set, run_no_page_interactions): | 492 def __init__(self, page_set, run_no_page_interactions): |
| 493 super(Page23, self).__init__( | 493 super(Page23, self).__init__( |
| 494 url='http://jsbin.com/UVIgUTa/38/quiet', | 494 url='http://jsbin.com/UVIgUTa/38/quiet', |
| 495 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 495 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 496 | 496 |
| 497 def PerformPageInteractions(self, action_runner): | 497 def PerformPageInteractions(self, action_runner): |
| 498 interaction = action_runner.BeginGestureInteraction( | 498 interaction = action_runner.BeginGestureInteraction( |
| 499 'ScrollAction', is_smooth=True) | 499 'ScrollAction') |
| 500 action_runner.ScrollPage( | 500 action_runner.ScrollPage( |
| 501 distance_expr='window.innerHeight / 2', | 501 distance_expr='window.innerHeight / 2', |
| 502 direction='down', | 502 direction='down', |
| 503 use_touch=True) | 503 use_touch=True) |
| 504 interaction.End() | 504 interaction.End() |
| 505 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 505 interaction = action_runner.BeginInteraction('Wait') |
| 506 action_runner.Wait(1) | 506 action_runner.Wait(1) |
| 507 interaction.End() | 507 interaction.End() |
| 508 | 508 |
| 509 | 509 |
| 510 class Page24(KeySilkCasesPage): | 510 class Page24(KeySilkCasesPage): |
| 511 | 511 |
| 512 """ | 512 """ |
| 513 Why: Google News: this iOS version is slower than accelerated scrolling | 513 Why: Google News: this iOS version is slower than accelerated scrolling |
| 514 """ | 514 """ |
| 515 | 515 |
| 516 def __init__(self, page_set, run_no_page_interactions): | 516 def __init__(self, page_set, run_no_page_interactions): |
| 517 super(Page24, self).__init__( | 517 super(Page24, self).__init__( |
| 518 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', | 518 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', |
| 519 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 519 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 520 | 520 |
| 521 def RunNavigateSteps(self, action_runner): | 521 def RunNavigateSteps(self, action_runner): |
| 522 super(Page24, self).RunNavigateSteps(action_runner) | 522 super(Page24, self).RunNavigateSteps(action_runner) |
| 523 action_runner.WaitForJavaScriptCondition( | 523 action_runner.WaitForJavaScriptCondition( |
| 524 'document.getElementById(":h") != null') | 524 'document.getElementById(":h") != null') |
| 525 action_runner.Wait(1) | 525 action_runner.Wait(1) |
| 526 | 526 |
| 527 def PerformPageInteractions(self, action_runner): | 527 def PerformPageInteractions(self, action_runner): |
| 528 interaction = action_runner.BeginGestureInteraction( | 528 interaction = action_runner.BeginGestureInteraction( |
| 529 'ScrollAction', is_smooth=True) | 529 'ScrollAction') |
| 530 action_runner.ScrollElement( | 530 action_runner.ScrollElement( |
| 531 element_function='document.getElementById(":5")', | 531 element_function='document.getElementById(":5")', |
| 532 distance=2500, | 532 distance=2500, |
| 533 use_touch=True) | 533 use_touch=True) |
| 534 interaction.End() | 534 interaction.End() |
| 535 | 535 |
| 536 | 536 |
| 537 class Page25(KeySilkCasesPage): | 537 class Page25(KeySilkCasesPage): |
| 538 | 538 |
| 539 def __init__(self, page_set, run_no_page_interactions): | 539 def __init__(self, page_set, run_no_page_interactions): |
| 540 super(Page25, self).__init__( | 540 super(Page25, self).__init__( |
| 541 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', | 541 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', |
| 542 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 542 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 543 | 543 |
| 544 def RunNavigateSteps(self, action_runner): | 544 def RunNavigateSteps(self, action_runner): |
| 545 super(Page25, self).RunNavigateSteps(action_runner) | 545 super(Page25, self).RunNavigateSteps(action_runner) |
| 546 action_runner.WaitForJavaScriptCondition( | 546 action_runner.WaitForJavaScriptCondition( |
| 547 'document.getElementById(":h") != null') | 547 'document.getElementById(":h") != null') |
| 548 action_runner.Wait(1) | 548 action_runner.Wait(1) |
| 549 | 549 |
| 550 def PerformPageInteractions(self, action_runner): | 550 def PerformPageInteractions(self, action_runner): |
| 551 interaction = action_runner.BeginGestureInteraction( | 551 interaction = action_runner.BeginGestureInteraction( |
| 552 'SwipeAction', is_smooth=True) | 552 'SwipeAction') |
| 553 action_runner.SwipeElement( | 553 action_runner.SwipeElement( |
| 554 direction='left', distance=100, | 554 direction='left', distance=100, |
| 555 element_function='document.getElementById(":f")') | 555 element_function='document.getElementById(":f")') |
| 556 interaction.End() | 556 interaction.End() |
| 557 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 557 interaction = action_runner.BeginInteraction('Wait') |
| 558 action_runner.Wait(1) | 558 action_runner.Wait(1) |
| 559 interaction.End() | 559 interaction.End() |
| 560 | 560 |
| 561 | 561 |
| 562 class Page26(KeySilkCasesPage): | 562 class Page26(KeySilkCasesPage): |
| 563 | 563 |
| 564 """ Why: famo.us twitter demo """ | 564 """ Why: famo.us twitter demo """ |
| 565 | 565 |
| 566 def __init__(self, page_set, run_no_page_interactions): | 566 def __init__(self, page_set, run_no_page_interactions): |
| 567 super(Page26, self).__init__( | 567 super(Page26, self).__init__( |
| 568 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', | 568 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', |
| 569 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 569 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 570 | 570 |
| 571 def RunNavigateSteps(self, action_runner): | 571 def RunNavigateSteps(self, action_runner): |
| 572 super(Page26, self).RunNavigateSteps(action_runner) | 572 super(Page26, self).RunNavigateSteps(action_runner) |
| 573 action_runner.WaitForJavaScriptCondition( | 573 action_runner.WaitForJavaScriptCondition( |
| 574 'document.getElementsByClassName("tweet").length > 0') | 574 'document.getElementsByClassName("tweet").length > 0') |
| 575 action_runner.Wait(1) | 575 action_runner.Wait(1) |
| 576 | 576 |
| 577 def PerformPageInteractions(self, action_runner): | 577 def PerformPageInteractions(self, action_runner): |
| 578 interaction = action_runner.BeginGestureInteraction( | 578 interaction = action_runner.BeginGestureInteraction( |
| 579 'ScrollAction', is_smooth=True) | 579 'ScrollAction') |
| 580 action_runner.ScrollPage(distance=5000) | 580 action_runner.ScrollPage(distance=5000) |
| 581 interaction.End() | 581 interaction.End() |
| 582 | 582 |
| 583 | 583 |
| 584 class SVGIconRaster(KeySilkCasesPage): | 584 class SVGIconRaster(KeySilkCasesPage): |
| 585 | 585 |
| 586 """ Why: Mutating SVG icons; these paint storm and paint slowly. """ | 586 """ Why: Mutating SVG icons; these paint storm and paint slowly. """ |
| 587 | 587 |
| 588 def __init__(self, page_set, run_no_page_interactions): | 588 def __init__(self, page_set, run_no_page_interactions): |
| 589 super(SVGIconRaster, self).__init__( | 589 super(SVGIconRaster, self).__init__( |
| 590 url='http://wiltzius.github.io/shape-shifter/', | 590 url='http://wiltzius.github.io/shape-shifter/', |
| 591 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 591 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 592 | 592 |
| 593 def RunNavigateSteps(self, action_runner): | 593 def RunNavigateSteps(self, action_runner): |
| 594 super(SVGIconRaster, self).RunNavigateSteps(action_runner) | 594 super(SVGIconRaster, self).RunNavigateSteps(action_runner) |
| 595 action_runner.WaitForJavaScriptCondition( | 595 action_runner.WaitForJavaScriptCondition( |
| 596 'loaded = true') | 596 'loaded = true') |
| 597 action_runner.Wait(1) | 597 action_runner.Wait(1) |
| 598 | 598 |
| 599 def PerformPageInteractions(self, action_runner): | 599 def PerformPageInteractions(self, action_runner): |
| 600 for i in xrange(9): | 600 for i in xrange(9): |
| 601 button_func = ('document.getElementById("demo").$.' | 601 button_func = ('document.getElementById("demo").$.' |
| 602 'buttons.children[%d]') % i | 602 'buttons.children[%d]') % i |
| 603 interaction = action_runner.BeginInteraction( | 603 interaction = action_runner.BeginInteraction( |
| 604 'Action_TapAction', is_smooth=True) | 604 'Action_TapAction') |
| 605 action_runner.TapElement(element_function=button_func) | 605 action_runner.TapElement(element_function=button_func) |
| 606 action_runner.Wait(1) | 606 action_runner.Wait(1) |
| 607 interaction.End() | 607 interaction.End() |
| 608 | 608 |
| 609 | 609 |
| 610 class UpdateHistoryState(KeySilkCasesPage): | 610 class UpdateHistoryState(KeySilkCasesPage): |
| 611 | 611 |
| 612 """ Why: Modern apps often update history state, which currently is janky.""" | 612 """ Why: Modern apps often update history state, which currently is janky.""" |
| 613 | 613 |
| 614 def __init__(self, page_set, run_no_page_interactions): | 614 def __init__(self, page_set, run_no_page_interactions): |
| 615 super(UpdateHistoryState, self).__init__( | 615 super(UpdateHistoryState, self).__init__( |
| 616 url='file://key_silk_cases/pushState.html', | 616 url='file://key_silk_cases/pushState.html', |
| 617 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 617 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 618 | 618 |
| 619 def RunNavigateSteps(self, action_runner): | 619 def RunNavigateSteps(self, action_runner): |
| 620 super(UpdateHistoryState, self).RunNavigateSteps(action_runner) | 620 super(UpdateHistoryState, self).RunNavigateSteps(action_runner) |
| 621 action_runner.ExecuteJavaScript(''' | 621 action_runner.ExecuteJavaScript(''' |
| 622 window.requestAnimationFrame(function() { | 622 window.requestAnimationFrame(function() { |
| 623 window.__history_state_loaded = true; | 623 window.__history_state_loaded = true; |
| 624 }); | 624 }); |
| 625 ''') | 625 ''') |
| 626 action_runner.WaitForJavaScriptCondition( | 626 action_runner.WaitForJavaScriptCondition( |
| 627 'window.__history_state_loaded == true;') | 627 'window.__history_state_loaded == true;') |
| 628 | 628 |
| 629 def PerformPageInteractions(self, action_runner): | 629 def PerformPageInteractions(self, action_runner): |
| 630 interaction = action_runner.BeginInteraction('animation_interaction', | 630 interaction = action_runner.BeginInteraction('animation_interaction') |
| 631 is_smooth=True) | |
| 632 action_runner.Wait(5) # JS runs the animation continuously on the page | 631 action_runner.Wait(5) # JS runs the animation continuously on the page |
| 633 interaction.End() | 632 interaction.End() |
| 634 | 633 |
| 635 | 634 |
| 636 class SilkFinance(KeySilkCasesPage): | 635 class SilkFinance(KeySilkCasesPage): |
| 637 | 636 |
| 638 """ Why: Some effects repaint the page, possibly including plenty of text. """ | 637 """ Why: Some effects repaint the page, possibly including plenty of text. """ |
| 639 | 638 |
| 640 def __init__(self, page_set, run_no_page_interactions): | 639 def __init__(self, page_set, run_no_page_interactions): |
| 641 super(SilkFinance, self).__init__( | 640 super(SilkFinance, self).__init__( |
| 642 url='file://key_silk_cases/silk_finance.html', | 641 url='file://key_silk_cases/silk_finance.html', |
| 643 page_set=page_set, run_no_page_interactions=run_no_page_interactions) | 642 page_set=page_set, run_no_page_interactions=run_no_page_interactions) |
| 644 | 643 |
| 645 def PerformPageInteractions(self, action_runner): | 644 def PerformPageInteractions(self, action_runner): |
| 646 interaction = action_runner.BeginInteraction('animation_interaction', | 645 interaction = action_runner.BeginInteraction('animation_interaction') |
| 647 is_smooth=True) | |
| 648 action_runner.Wait(10) # animation runs automatically | 646 action_runner.Wait(10) # animation runs automatically |
| 649 interaction.End() | 647 interaction.End() |
| 650 | 648 |
| 651 | 649 |
| 652 class PolymerTopeka(KeySilkCasesPage): | 650 class PolymerTopeka(KeySilkCasesPage): |
| 653 | 651 |
| 654 """ Why: Sample Polymer app. """ | 652 """ Why: Sample Polymer app. """ |
| 655 | 653 |
| 656 def __init__(self, page_set, run_no_page_interactions): | 654 def __init__(self, page_set, run_no_page_interactions): |
| 657 super(PolymerTopeka, self).__init__( | 655 super(PolymerTopeka, self).__init__( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 self.AddUserStory(SVGIconRaster(self, run_no_page_interactions)) | 754 self.AddUserStory(SVGIconRaster(self, run_no_page_interactions)) |
| 757 self.AddUserStory(UpdateHistoryState(self, run_no_page_interactions)) | 755 self.AddUserStory(UpdateHistoryState(self, run_no_page_interactions)) |
| 758 self.AddUserStory(SilkFinance(self, run_no_page_interactions)) | 756 self.AddUserStory(SilkFinance(self, run_no_page_interactions)) |
| 759 self.AddUserStory(PolymerTopeka(self, run_no_page_interactions)) | 757 self.AddUserStory(PolymerTopeka(self, run_no_page_interactions)) |
| 760 | 758 |
| 761 for page in self: | 759 for page in self: |
| 762 assert (page.__class__.RunPageInteractions == | 760 assert (page.__class__.RunPageInteractions == |
| 763 KeySilkCasesPage.RunPageInteractions), ( | 761 KeySilkCasesPage.RunPageInteractions), ( |
| 764 'Pages in this page set must not override KeySilkCasesPage\' ' | 762 'Pages in this page set must not override KeySilkCasesPage\' ' |
| 765 'RunPageInteractions method.') | 763 'RunPageInteractions method.') |
| OLD | NEW |