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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 def RunNavigateSteps(self, action_runner): | 506 def RunNavigateSteps(self, action_runner): |
507 action_runner.NavigateToPage(self) | 507 action_runner.NavigateToPage(self) |
508 action_runner.RunAction(WaitAction( | 508 action_runner.RunAction(WaitAction( |
509 { | 509 { |
510 'text' : 'accessibility', | 510 'text' : 'accessibility', |
511 'condition': 'element' | 511 'condition': 'element' |
512 })) | 512 })) |
513 | 513 |
514 def RunStressMemory(self, action_runner): | 514 def RunStressMemory(self, action_runner): |
515 action_runner.RunAction(ClickElementAction( | 515 action_runner.RunAction(ClickElementAction({'text' : 'accessibility'})) |
516 { | 516 action_runner.WaitForNavigate() |
517 'text' : 'accessibility', | |
518 'wait_until': { | |
519 'condition': 'navigate' | |
520 } | |
521 })) | |
522 action_runner.RunAction(ScrollAction()) | 517 action_runner.RunAction(ScrollAction()) |
523 action_runner.RunAction(ClickElementAction( | 518 action_runner.RunAction(ClickElementAction({'text' : 'advanced'})) |
524 { | 519 action_runner.WaitForNavigate() |
525 'text' : 'advanced', | |
526 'wait_until': { | |
527 'condition': 'navigate' | |
528 } | |
529 })) | |
530 action_runner.RunAction(ScrollAction()) | 520 action_runner.RunAction(ScrollAction()) |
531 action_runner.RunAction(ClickElementAction( | 521 action_runner.RunAction(ClickElementAction({'text' : 'beginner'})) |
532 { | 522 action_runner.WaitForNavigate() |
533 'text' : 'beginner', | |
534 'wait_until': { | |
535 'condition': 'navigate' | |
536 } | |
537 })) | |
538 action_runner.RunAction(ScrollAction()) | 523 action_runner.RunAction(ScrollAction()) |
539 action_runner.RunAction(ClickElementAction( | 524 action_runner.RunAction(ClickElementAction({'text' : 'Home'})) |
540 { | 525 action_runner.WaitForNavigate() |
541 'text' : 'Home', | |
542 'wait_until': { | |
543 'condition': 'navigate' | |
544 } | |
545 })) | |
546 | 526 |
547 | 527 |
548 class WordpressPage(Top25Page): | 528 class WordpressPage(Top25Page): |
549 | 529 |
550 """ Why: #18 (Alexa global), Picked an interesting post """ | 530 """ Why: #18 (Alexa global), Picked an interesting post """ |
551 | 531 |
552 def __init__(self, page_set): | 532 def __init__(self, page_set): |
553 super(WordpressPage, self).__init__( | 533 super(WordpressPage, self).__init__( |
554 # pylint: disable=C0301 | 534 # pylint: disable=C0301 |
555 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', | 535 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', |
556 page_set=page_set, | 536 page_set=page_set, |
557 name='Wordpress') | 537 name='Wordpress') |
558 | 538 |
559 def RunNavigateSteps(self, action_runner): | 539 def RunNavigateSteps(self, action_runner): |
560 action_runner.NavigateToPage(self) | 540 action_runner.NavigateToPage(self) |
561 action_runner.RunAction(WaitAction( | 541 action_runner.RunAction(WaitAction( |
562 { | 542 { |
563 'condition': 'element', | 543 'condition': 'element', |
564 'selector': | 544 'selector': |
565 # pylint: disable=C0301 | 545 # pylint: disable=C0301 |
566 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' | 546 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' |
567 })) | 547 })) |
568 | 548 |
569 def RunStressMemory(self, action_runner): | 549 def RunStressMemory(self, action_runner): |
570 action_runner.RunAction(ScrollAction()) | 550 action_runner.RunAction(ScrollAction()) |
571 action_runner.RunAction(ClickElementAction( | 551 action_runner.RunAction(ClickElementAction( |
572 { | 552 {'selector': |
573 'wait_until': { | |
574 'condition': 'navigate' | |
575 }, | |
576 'selector': | |
577 # pylint: disable=C0301 | 553 # pylint: disable=C0301 |
578 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' | 554 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-s
ight/"]' |
579 })) | 555 })) |
| 556 action_runner.WaitForNavigate() |
580 action_runner.RunAction(ScrollAction()) | 557 action_runner.RunAction(ScrollAction()) |
581 action_runner.RunAction(ClickElementAction( | 558 action_runner.RunAction(ClickElementAction({'text' : 'Features'})) |
582 { | 559 action_runner.WaitForNavigate() |
583 'text' : 'Features', | |
584 'wait_until': { | |
585 'condition': 'navigate' | |
586 } | |
587 })) | |
588 action_runner.RunAction(ScrollAction()) | 560 action_runner.RunAction(ScrollAction()) |
589 action_runner.RunAction(ClickElementAction( | 561 action_runner.RunAction(ClickElementAction({'text' : 'News'})) |
590 { | 562 action_runner.WaitForNavigate() |
591 'text' : 'News', | |
592 'wait_until': { | |
593 'condition': 'navigate' | |
594 } | |
595 })) | |
596 action_runner.RunAction(ScrollAction()) | 563 action_runner.RunAction(ScrollAction()) |
597 | 564 |
598 | 565 |
599 class FacebookPage(Top25Page): | 566 class FacebookPage(Top25Page): |
600 | 567 |
601 """ Why: top social,Public profile """ | 568 """ Why: top social,Public profile """ |
602 | 569 |
603 def __init__(self, page_set): | 570 def __init__(self, page_set): |
604 super(FacebookPage, self).__init__( | 571 super(FacebookPage, self).__init__( |
605 url='http://www.facebook.com/barackobama', | 572 url='http://www.facebook.com/barackobama', |
606 page_set=page_set, | 573 page_set=page_set, |
607 name='Facebook') | 574 name='Facebook') |
608 self.credentials = 'facebook' | 575 self.credentials = 'facebook' |
609 | 576 |
610 def RunNavigateSteps(self, action_runner): | 577 def RunNavigateSteps(self, action_runner): |
611 action_runner.NavigateToPage(self) | 578 action_runner.NavigateToPage(self) |
612 action_runner.RunAction(WaitAction( | 579 action_runner.RunAction(WaitAction( |
613 { | 580 { |
614 'text' : 'About', | 581 'text' : 'About', |
615 'condition': 'element' | 582 'condition': 'element' |
616 })) | 583 })) |
617 | 584 |
618 def RunStressMemory(self, action_runner): | 585 def RunStressMemory(self, action_runner): |
| 586 action_runner.RunAction(ClickElementAction({'text' : 'About'})) |
| 587 action_runner.WaitForNavigate() |
| 588 action_runner.RunAction(ClickElementAction( |
| 589 { |
| 590 'text' : 'The Audacity of Hope', |
| 591 })) |
| 592 action_runner.WaitForNavigate() |
| 593 action_runner.RunAction(ClickElementAction( |
| 594 { |
| 595 'text' : 'Back to Barack Obama\'s Timeline', |
| 596 })) |
| 597 action_runner.WaitForNavigate() |
619 action_runner.RunAction(ClickElementAction( | 598 action_runner.RunAction(ClickElementAction( |
620 { | 599 { |
621 'text' : 'About', | 600 'text' : 'About', |
622 'wait_until': { | |
623 'condition': 'navigate' | |
624 } | |
625 })) | 601 })) |
626 action_runner.RunAction(ClickElementAction( | 602 action_runner.WaitForNavigate() |
627 { | |
628 'text' : 'The Audacity of Hope', | |
629 'wait_until': { | |
630 'condition': 'navigate' | |
631 } | |
632 })) | |
633 action_runner.RunAction(ClickElementAction( | |
634 { | |
635 'text' : 'Back to Barack Obama\'s Timeline', | |
636 'wait_until': { | |
637 'condition': 'navigate' | |
638 } | |
639 })) | |
640 action_runner.RunAction(ClickElementAction( | |
641 { | |
642 'text' : 'About', | |
643 'wait_until': { | |
644 'condition': 'navigate' | |
645 } | |
646 })) | |
647 action_runner.RunAction(ClickElementAction( | 603 action_runner.RunAction(ClickElementAction( |
648 { | 604 { |
649 'text' : 'Elected to U.S. Senate', | 605 'text' : 'Elected to U.S. Senate', |
650 'wait_until': { | |
651 'condition': 'navigate' | |
652 } | |
653 })) | 606 })) |
| 607 action_runner.WaitForNavigate() |
654 action_runner.RunAction(ClickElementAction( | 608 action_runner.RunAction(ClickElementAction( |
655 { | 609 { |
656 'text' : 'Home', | 610 'text' : 'Home', |
657 'wait_until': { | |
658 'condition': 'navigate' | |
659 } | |
660 })) | 611 })) |
| 612 action_runner.WaitForNavigate() |
661 | 613 |
662 def RunSmoothness(self, action_runner): | 614 def RunSmoothness(self, action_runner): |
663 action_runner.RunAction(ScrollAction( | 615 action_runner.RunAction(ScrollAction( |
664 { | 616 { |
665 'scroll_is_infinite': True | 617 'scroll_is_infinite': True |
666 })) | 618 })) |
667 | 619 |
668 | 620 |
669 class LinkedinPage(Top25Page): | 621 class LinkedinPage(Top25Page): |
670 | 622 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 # Why: #1 Alexa reference | 770 # Why: #1 Alexa reference |
819 'http://answers.yahoo.com', | 771 'http://answers.yahoo.com', |
820 # Why: #1 Alexa sports | 772 # Why: #1 Alexa sports |
821 'http://sports.yahoo.com/', | 773 'http://sports.yahoo.com/', |
822 # Why: top tech blog | 774 # Why: top tech blog |
823 'http://techcrunch.com' | 775 'http://techcrunch.com' |
824 ] | 776 ] |
825 | 777 |
826 for url in other_urls: | 778 for url in other_urls: |
827 self.AddPage(Top25Page(url, self)) | 779 self.AddPage(Top25Page(url, self)) |
OLD | NEW |