| 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 KeySilkCasesPage(page_module.Page): | 10 class KeySilkCasesPage(page_module.Page): |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 def __init__(self, page_set): | 276 def __init__(self, page_set): |
| 277 super(Page16, self).__init__( | 277 super(Page16, self).__init__( |
| 278 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', | 278 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', |
| 279 page_set=page_set) | 279 page_set=page_set) |
| 280 | 280 |
| 281 def RunNavigateSteps(self, action_runner): | 281 def RunNavigateSteps(self, action_runner): |
| 282 action_runner.NavigateToPage(self) | 282 action_runner.NavigateToPage(self) |
| 283 action_runner.Wait(2) | 283 action_runner.Wait(2) |
| 284 | 284 |
| 285 def SwipeToDismiss(self, action_runner): | 285 def SwipeToDismiss(self, action_runner): |
| 286 action_runner.RunAction(SwipeAction( | 286 interaction = action_runner.BeginInteraction( |
| 287 { | 287 'Gesture_SwipeAction', is_smooth=True) |
| 288 'left_start_percentage': 0.8, | 288 action_runner.SwipeElement( |
| 289 'distance': 200, | 289 left_start_percentage=0.8, top_start_percentage=0.2, |
| 290 'direction': 'left', | 290 direction='left', distance=200, speed=5000, |
| 291 'top_start_percentage': 0.2, | 291 element_function='document.getElementsByClassName("message")[2]') |
| 292 'element_function': ''' | 292 interaction.End() |
| 293 function(callback) { | |
| 294 callback(document.getElementsByClassName('message')[2]); | |
| 295 }''', | |
| 296 'speed': 5000 | |
| 297 })) | |
| 298 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 293 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
| 299 action_runner.WaitForJavaScriptCondition( | 294 action_runner.WaitForJavaScriptCondition( |
| 300 'document.getElementsByClassName("message").length < 18') | 295 'document.getElementsByClassName("message").length < 18') |
| 301 interaction.End() | 296 interaction.End() |
| 302 | 297 |
| 303 def RunSmoothness(self, action_runner): | 298 def RunSmoothness(self, action_runner): |
| 304 self.SwipeToDismiss(action_runner) | 299 self.SwipeToDismiss(action_runner) |
| 305 | 300 |
| 306 | 301 |
| 307 class Page17(KeySilkCasesPage): | 302 class Page17(KeySilkCasesPage): |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 387 |
| 393 def RunNavigateSteps(self, action_runner): | 388 def RunNavigateSteps(self, action_runner): |
| 394 action_runner.NavigateToPage(self) | 389 action_runner.NavigateToPage(self) |
| 395 action_runner.Wait(2) | 390 action_runner.Wait(2) |
| 396 self.ToggleDrawer(action_runner) | 391 self.ToggleDrawer(action_runner) |
| 397 | 392 |
| 398 def RunSmoothness(self, action_runner): | 393 def RunSmoothness(self, action_runner): |
| 399 self.SlideDrawer(action_runner) | 394 self.SlideDrawer(action_runner) |
| 400 | 395 |
| 401 def SlideDrawer(self, action_runner): | 396 def SlideDrawer(self, action_runner): |
| 402 action_runner.RunAction(SwipeAction( | 397 interaction = action_runner.BeginInteraction( |
| 403 { | 398 'Action_SwipeAction', is_smooth=True) |
| 404 'left_start_percentage': 0.8, | 399 action_runner.SwipeElement( |
| 405 'distance': 200, | 400 left_start_percentage=0.8, top_start_percentage=0.2, |
| 406 'direction': 'left', | 401 direction='left', distance=200, |
| 407 'top_start_percentage': 0.2, | 402 element_function='document.getElementById("nav-drawer").children[0]') |
| 408 'element_function': ''' | 403 action_runner.WaitForJavaScriptCondition( |
| 409 function(callback) { | 404 '!document.getElementById("nav-drawer").active') |
| 410 callback(document.getElementById('nav-drawer').children[0]); | 405 interaction.End() |
| 411 }''', | |
| 412 'wait_after' : { | |
| 413 'javascript': '!document.getElementById("nav-drawer").active' | |
| 414 } | |
| 415 })) | |
| 416 | 406 |
| 417 | 407 |
| 418 class Page20(KeySilkCasesPage): | 408 class Page20(KeySilkCasesPage): |
| 419 | 409 |
| 420 """ Why: Shadow DOM infinite scrolling. """ | 410 """ Why: Shadow DOM infinite scrolling. """ |
| 421 | 411 |
| 422 def __init__(self, page_set): | 412 def __init__(self, page_set): |
| 423 super(Page20, self).__init__( | 413 super(Page20, self).__init__( |
| 424 url='file://key_silk_cases/infinite_scrolling.html', | 414 url='file://key_silk_cases/infinite_scrolling.html', |
| 425 page_set=page_set) | 415 page_set=page_set) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', | 549 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', |
| 560 page_set=page_set) | 550 page_set=page_set) |
| 561 | 551 |
| 562 def RunNavigateSteps(self, action_runner): | 552 def RunNavigateSteps(self, action_runner): |
| 563 action_runner.NavigateToPage(self) | 553 action_runner.NavigateToPage(self) |
| 564 action_runner.WaitForJavaScriptCondition( | 554 action_runner.WaitForJavaScriptCondition( |
| 565 'document.getElementById(":h") != null') | 555 'document.getElementById(":h") != null') |
| 566 action_runner.Wait(1) | 556 action_runner.Wait(1) |
| 567 | 557 |
| 568 def RunSmoothness(self, action_runner): | 558 def RunSmoothness(self, action_runner): |
| 569 action_runner.RunAction(SwipeAction( | 559 interaction = action_runner.BeginInteraction( |
| 570 { | 560 'Gesture_SwipeAction', is_smooth=True) |
| 571 'distance': 100, | 561 action_runner.SwipeElement( |
| 572 'direction': "left", | 562 direction='left', distance=100, |
| 573 'element_function': ''' | 563 element_function='document.getElementById(":f")') |
| 574 function(callback) { | 564 interaction.End() |
| 575 callback(document.getElementById(':f')); | |
| 576 }''' | |
| 577 })) | |
| 578 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 565 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
| 579 action_runner.Wait(1) | 566 action_runner.Wait(1) |
| 580 interaction.End() | 567 interaction.End() |
| 581 | 568 |
| 582 | 569 |
| 583 class Page26(KeySilkCasesPage): | 570 class Page26(KeySilkCasesPage): |
| 584 | 571 |
| 585 """ Why: famo.us twitter demo """ | 572 """ Why: famo.us twitter demo """ |
| 586 | 573 |
| 587 def __init__(self, page_set): | 574 def __init__(self, page_set): |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 self.AddPage(Page17(self)) | 619 self.AddPage(Page17(self)) |
| 633 self.AddPage(Page18(self)) | 620 self.AddPage(Page18(self)) |
| 634 self.AddPage(Page19(self)) | 621 self.AddPage(Page19(self)) |
| 635 self.AddPage(Page20(self)) | 622 self.AddPage(Page20(self)) |
| 636 self.AddPage(Page21(self)) | 623 self.AddPage(Page21(self)) |
| 637 self.AddPage(Page22(self)) | 624 self.AddPage(Page22(self)) |
| 638 self.AddPage(Page23(self)) | 625 self.AddPage(Page23(self)) |
| 639 self.AddPage(Page24(self)) | 626 self.AddPage(Page24(self)) |
| 640 self.AddPage(Page25(self)) | 627 self.AddPage(Page25(self)) |
| 641 self.AddPage(Page26(self)) | 628 self.AddPage(Page26(self)) |
| OLD | NEW |