OLD | NEW |
1 # encoding: utf-8 | 1 # encoding: utf-8 |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 from page_sets.system_health import platforms | 6 from page_sets.system_health import platforms |
7 from page_sets.system_health import story_tags | 7 from page_sets.system_health import story_tags |
8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
9 | 9 |
10 from page_sets.login_helpers import pinterest_login | 10 from page_sets.login_helpers import pinterest_login |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 def _ClickLink(self, action_runner, element_function): | 44 def _ClickLink(self, action_runner, element_function): |
45 action_runner.WaitForElement(element_function=element_function) | 45 action_runner.WaitForElement(element_function=element_function) |
46 action_runner.ClickElement(element_function=element_function) | 46 action_runner.ClickElement(element_function=element_function) |
47 self._WaitForNavigation(action_runner) | 47 self._WaitForNavigation(action_runner) |
48 | 48 |
49 def _NavigateBack(self, action_runner): | 49 def _NavigateBack(self, action_runner): |
50 action_runner.NavigateBack() | 50 action_runner.NavigateBack() |
51 self._WaitForNavigation(action_runner) | 51 self._WaitForNavigation(action_runner) |
52 | 52 |
| 53 @classmethod |
| 54 def GenerateStoryDescription(cls): |
| 55 return 'Load %s and navigate to some items/articles.' % cls.URL |
| 56 |
53 | 57 |
54 class _ArticleBrowsingStory(_BrowsingStory): | 58 class _ArticleBrowsingStory(_BrowsingStory): |
55 """Abstract base class for user stories browsing news / shopping articles. | 59 """Abstract base class for user stories browsing news / shopping articles. |
56 | 60 |
57 An article browsing story imitates browsing a articles: | 61 An article browsing story imitates browsing a articles: |
58 1. Load the main page. | 62 1. Load the main page. |
59 2. Open and scroll the first article. | 63 2. Open and scroll the first article. |
60 3. Go back to the main page and scroll it. | 64 3. Go back to the main page and scroll it. |
61 4. Open and scroll the second article. | 65 4. Open and scroll the second article. |
62 5. Go back to the main page and scroll it. | 66 5. Go back to the main page and scroll it. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 @decorators.Disabled('win', 'mac') | 393 @decorators.Disabled('win', 'mac') |
390 class ImgurDesktopStory(_MediaBrowsingStory): | 394 class ImgurDesktopStory(_MediaBrowsingStory): |
391 NAME = 'browse:media:imgur' | 395 NAME = 'browse:media:imgur' |
392 URL = 'http://imgur.com/gallery/5UlBN' | 396 URL = 'http://imgur.com/gallery/5UlBN' |
393 ITEM_SELECTOR = '.navNext' | 397 ITEM_SELECTOR = '.navNext' |
394 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 398 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
395 IS_SINGLE_PAGE_APP = True | 399 IS_SINGLE_PAGE_APP = True |
396 | 400 |
397 | 401 |
398 class YouTubeMobileStory(_MediaBrowsingStory): | 402 class YouTubeMobileStory(_MediaBrowsingStory): |
| 403 """Load a typical YouTube video then navigate to a next few videos. Stop and |
| 404 watch each video for few seconds. |
| 405 """ |
399 NAME = 'browse:media:youtube' | 406 NAME = 'browse:media:youtube' |
400 URL = 'https://m.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 407 URL = 'https://m.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
401 ITEM_SELECTOR = '._mhgb > a' | 408 ITEM_SELECTOR = '._mhgb > a' |
402 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 409 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
403 IS_SINGLE_PAGE_APP = True | 410 IS_SINGLE_PAGE_APP = True |
404 ITEM_SELECTOR_INDEX = 3 | 411 ITEM_SELECTOR_INDEX = 3 |
405 TAGS = [story_tags.JAVASCRIPT_HEAVY] | 412 TAGS = [story_tags.JAVASCRIPT_HEAVY] |
406 TAGS = [story_tags.EMERGING_MARKET] | 413 TAGS = [story_tags.EMERGING_MARKET] |
407 | 414 |
408 | 415 |
409 class YouTubeDesktopStory(_MediaBrowsingStory): | 416 class YouTubeDesktopStory(_MediaBrowsingStory): |
| 417 """Load a typical YouTube video then navigate to a next few videos. Stop and |
| 418 watch each video for a few seconds. |
| 419 """ |
410 NAME = 'browse:media:youtube' | 420 NAME = 'browse:media:youtube' |
411 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 421 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
412 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' | 422 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' |
413 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 423 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
414 IS_SINGLE_PAGE_APP = True | 424 IS_SINGLE_PAGE_APP = True |
415 # A longer view time allows videos to load and play. | 425 # A longer view time allows videos to load and play. |
416 ITEM_VIEW_TIME_IN_SECONDS = 5 | 426 ITEM_VIEW_TIME_IN_SECONDS = 5 |
417 ITEMS_TO_VISIT = 8 | 427 ITEMS_TO_VISIT = 8 |
418 ITEM_SELECTOR_INDEX = 3 | 428 ITEM_SELECTOR_INDEX = 3 |
419 PLATFORM_SPECIFIC = True | 429 PLATFORM_SPECIFIC = True |
420 TAGS = [story_tags.JAVASCRIPT_HEAVY] | 430 TAGS = [story_tags.JAVASCRIPT_HEAVY] |
421 | 431 |
422 | 432 |
423 class FacebookPhotosMobileStory(_MediaBrowsingStory): | 433 class FacebookPhotosMobileStory(_MediaBrowsingStory): |
| 434 """Load a photo page from Rihanna's facebook page then navigate a few next |
| 435 photos. |
| 436 """ |
424 NAME = 'browse:media:facebook_photos' | 437 NAME = 'browse:media:facebook_photos' |
425 URL = ( | 438 URL = ( |
426 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') | 439 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') |
427 ITEM_SELECTOR = '._57-r.touchable' | 440 ITEM_SELECTOR = '._57-r.touchable' |
428 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 441 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
429 IS_SINGLE_PAGE_APP = True | 442 IS_SINGLE_PAGE_APP = True |
430 ITEM_SELECTOR_INDEX = 0 | 443 ITEM_SELECTOR_INDEX = 0 |
431 TAGS = [story_tags.EMERGING_MARKET] | 444 TAGS = [story_tags.EMERGING_MARKET] |
432 | 445 |
433 | 446 |
434 class FacebookPhotosDesktopStory(_MediaBrowsingStory): | 447 class FacebookPhotosDesktopStory(_MediaBrowsingStory): |
| 448 """Load a photo page from Rihanna's facebook page then navigate a few next |
| 449 photos. |
| 450 """ |
435 NAME = 'browse:media:facebook_photos' | 451 NAME = 'browse:media:facebook_photos' |
436 URL = ( | 452 URL = ( |
437 'https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675
/10153911739606676/?type=3&theater') | 453 'https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675
/10153911739606676/?type=3&theater') |
438 ITEM_SELECTOR = '.snowliftPager.next' | 454 ITEM_SELECTOR = '.snowliftPager.next' |
439 # Recording currently does not work. The page gets stuck in the | 455 # Recording currently does not work. The page gets stuck in the |
440 # theater viewer. | 456 # theater viewer. |
441 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS | 457 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS |
442 IS_SINGLE_PAGE_APP = True | 458 IS_SINGLE_PAGE_APP = True |
443 | 459 |
444 | 460 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 # Reduce the speed (the current wpr is recorded with speed set to 50) when | 779 # Reduce the speed (the current wpr is recorded with speed set to 50) when |
764 # recording the wpr. If we scroll too fast, the data will not be recorded | 780 # recording the wpr. If we scroll too fast, the data will not be recorded |
765 # well. After recording reset it back to the original value to have a more | 781 # well. After recording reset it back to the original value to have a more |
766 # realistic scroll. | 782 # realistic scroll. |
767 action_runner.RepeatableBrowserDrivenScroll( | 783 action_runner.RepeatableBrowserDrivenScroll( |
768 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, | 784 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, |
769 repeat_count=3, speed=400, timeout=120) | 785 repeat_count=3, speed=400, timeout=120) |
770 action_runner.RepeatableBrowserDrivenScroll( | 786 action_runner.RepeatableBrowserDrivenScroll( |
771 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, | 787 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, |
772 repeat_count=3, speed=500, timeout=120) | 788 repeat_count=3, speed=500, timeout=120) |
OLD | NEW |