| Index: tools/perf/page_sets/system_health/browsing_stories.py
|
| diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py
|
| index 38a58b7aff0daad18e97e7ec239b4bbdd06b3bc7..e8a3c9884d36fc220b6e9c2f545134707ec1e8e1 100644
|
| --- a/tools/perf/page_sets/system_health/browsing_stories.py
|
| +++ b/tools/perf/page_sets/system_health/browsing_stories.py
|
| @@ -51,19 +51,14 @@ class _BrowsingStory(system_health_story.SystemHealthStory):
|
| self._WaitForNavigation(action_runner)
|
|
|
|
|
| -##############################################################################
|
| -# News browsing stories.
|
| -##############################################################################
|
| -
|
| -
|
| -class _NewsBrowsingStory(_BrowsingStory):
|
| - """Abstract base class for news user stories.
|
| +class _ArticleBrowsingStory(_BrowsingStory):
|
| + """Abstract base class for user stories browsing news / shopping articles.
|
|
|
| - A news story imitates browsing a news website:
|
| + An article browsing story imitates browsing a articles:
|
| 1. Load the main page.
|
| - 2. Open and scroll the first news item.
|
| + 2. Open and scroll the first article.
|
| 3. Go back to the main page and scroll it.
|
| - 4. Open and scroll the second news item.
|
| + 4. Open and scroll the second article.
|
| 5. Go back to the main page and scroll it.
|
| 6. etc.
|
| """
|
| @@ -77,11 +72,11 @@ class _NewsBrowsingStory(_BrowsingStory):
|
| def _DidLoadDocument(self, action_runner):
|
| for i in xrange(self.ITEMS_TO_VISIT):
|
| self._NavigateToItem(action_runner, i)
|
| - self._ReadNewsItem(action_runner)
|
| + self._ReadNextArticle(action_runner)
|
| self._NavigateBack(action_runner)
|
| self._ScrollMainPage(action_runner)
|
|
|
| - def _ReadNewsItem(self, action_runner):
|
| + def _ReadNextArticle(self, action_runner):
|
| action_runner.tab.WaitForDocumentReadyStateToBeComplete()
|
| action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0)
|
| action_runner.RepeatableBrowserDrivenScroll(
|
| @@ -94,7 +89,12 @@ class _NewsBrowsingStory(_BrowsingStory):
|
| repeat_count=self.MAIN_PAGE_SCROLL_REPEAT)
|
|
|
|
|
| -class CnnStory(_NewsBrowsingStory):
|
| +##############################################################################
|
| +# News browsing stories.
|
| +##############################################################################
|
| +
|
| +
|
| +class CnnStory(_ArticleBrowsingStory):
|
| """The second top website in http://www.alexa.com/topsites/category/News"""
|
| NAME = 'browse:news:cnn'
|
| URL = 'http://edition.cnn.com/'
|
| @@ -103,7 +103,7 @@ class CnnStory(_NewsBrowsingStory):
|
| TAGS = [story_tags.JAVASCRIPT_HEAVY]
|
|
|
|
|
| -class FacebookMobileStory(_NewsBrowsingStory):
|
| +class FacebookMobileStory(_ArticleBrowsingStory):
|
| NAME = 'browse:social:facebook'
|
| URL = 'https://www.facebook.com/rihanna'
|
| ITEM_SELECTOR = 'article ._5msj'
|
| @@ -111,9 +111,10 @@ class FacebookMobileStory(_NewsBrowsingStory):
|
| # (crbug.com/631022)
|
| MAIN_PAGE_SCROLL_REPEAT = 1
|
| SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
|
|
|
|
| -class FacebookDesktopStory(_NewsBrowsingStory):
|
| +class FacebookDesktopStory(_ArticleBrowsingStory):
|
| NAME = 'browse:social:facebook'
|
| URL = 'https://www.facebook.com/rihanna'
|
| ITEM_SELECTOR = '._4-eo'
|
| @@ -123,7 +124,23 @@ class FacebookDesktopStory(_NewsBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS
|
|
|
|
|
| -class FlipboardMobileStory(_NewsBrowsingStory):
|
| +class InstagramMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:social:instagram'
|
| + URL = 'https://www.instagram.com/badgalriri/'
|
| + ITEM_SELECTOR = '[class=\\"_8mlbc _vbtk2 _t5r8b\\"]'
|
| + ITEMS_TO_VISIT = 8
|
| +
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + def _WaitForNavigation(self, action_runner):
|
| + action_runner.WaitForElement(text='load more comments')
|
| +
|
| + def _NavigateBack(self, action_runner):
|
| + action_runner.NavigateBack()
|
| +
|
| +
|
| +class FlipboardMobileStory(_ArticleBrowsingStory):
|
| NAME = 'browse:news:flipboard'
|
| URL = 'https://flipboard.com/explore'
|
| IS_SINGLE_PAGE_APP = True
|
| @@ -132,7 +149,7 @@ class FlipboardMobileStory(_NewsBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
|
|
|
|
| -class FlipboardDesktopStory(_NewsBrowsingStory):
|
| +class FlipboardDesktopStory(_ArticleBrowsingStory):
|
| NAME = 'browse:news:flipboard'
|
| URL = 'https://flipboard.com/explore'
|
| IS_SINGLE_PAGE_APP = True
|
| @@ -142,13 +159,13 @@ class FlipboardDesktopStory(_NewsBrowsingStory):
|
|
|
| # crbug.com/657665 for win and mac
|
| @decorators.Disabled('win', 'mac')
|
| -class HackerNewsStory(_NewsBrowsingStory):
|
| +class HackerNewsStory(_ArticleBrowsingStory):
|
| NAME = 'browse:news:hackernews'
|
| URL = 'https://news.ycombinator.com'
|
| ITEM_SELECTOR = '.athing .title > a'
|
|
|
|
|
| -class NytimesMobileStory(_NewsBrowsingStory):
|
| +class NytimesMobileStory(_ArticleBrowsingStory):
|
| """The third top website in http://www.alexa.com/topsites/category/News"""
|
| NAME = 'browse:news:nytimes'
|
| URL = 'http://mobile.nytimes.com'
|
| @@ -158,7 +175,7 @@ class NytimesMobileStory(_NewsBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
|
|
|
|
| -class NytimesDesktopStory(_NewsBrowsingStory):
|
| +class NytimesDesktopStory(_ArticleBrowsingStory):
|
| """The third top website in http://www.alexa.com/topsites/category/News"""
|
| NAME = 'browse:news:nytimes'
|
| URL = 'http://www.nytimes.com'
|
| @@ -168,7 +185,7 @@ class NytimesDesktopStory(_NewsBrowsingStory):
|
|
|
| # Desktop qq.com opens a news item in a separate tab, for which the back button
|
| # does not work.
|
| -class QqMobileStory(_NewsBrowsingStory):
|
| +class QqMobileStory(_ArticleBrowsingStory):
|
| NAME = 'browse:news:qq'
|
| URL = 'http://news.qq.com'
|
| ITEM_SELECTOR = '.list .full a'
|
| @@ -176,7 +193,7 @@ class QqMobileStory(_NewsBrowsingStory):
|
| TAGS = [story_tags.INTERNATIONAL]
|
|
|
|
|
| -class RedditDesktopStory(_NewsBrowsingStory):
|
| +class RedditDesktopStory(_ArticleBrowsingStory):
|
| """The top website in http://www.alexa.com/topsites/category/News"""
|
| NAME = 'browse:news:reddit'
|
| URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week'
|
| @@ -184,7 +201,7 @@ class RedditDesktopStory(_NewsBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
|
|
|
|
|
| -class RedditMobileStory(_NewsBrowsingStory):
|
| +class RedditMobileStory(_ArticleBrowsingStory):
|
| """The top website in http://www.alexa.com/topsites/category/News"""
|
| NAME = 'browse:news:reddit'
|
| URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week'
|
| @@ -193,7 +210,7 @@ class RedditMobileStory(_NewsBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
|
|
|
|
| -class TwitterMobileStory(_NewsBrowsingStory):
|
| +class TwitterMobileStory(_ArticleBrowsingStory):
|
| NAME = 'browse:social:twitter'
|
| URL = 'https://www.twitter.com/nasa'
|
| ITEM_SELECTOR = '.Tweet-text'
|
| @@ -202,7 +219,7 @@ class TwitterMobileStory(_NewsBrowsingStory):
|
|
|
|
|
| @decorators.Disabled('win') # crbug.com/662971
|
| -class TwitterDesktopStory(_NewsBrowsingStory):
|
| +class TwitterDesktopStory(_ArticleBrowsingStory):
|
| NAME = 'browse:social:twitter'
|
| URL = 'https://www.twitter.com/nasa'
|
| IS_SINGLE_PAGE_APP = True
|
| @@ -210,7 +227,7 @@ class TwitterDesktopStory(_NewsBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
|
|
|
|
|
| -class WashingtonPostMobileStory(_NewsBrowsingStory):
|
| +class WashingtonPostMobileStory(_ArticleBrowsingStory):
|
| """Progressive website"""
|
| NAME = 'browse:news:washingtonpost'
|
| URL = 'https://www.washingtonpost.com/pwa'
|
| @@ -238,7 +255,7 @@ class WashingtonPostMobileStory(_NewsBrowsingStory):
|
|
|
|
|
| @decorators.Disabled('win') # crbug.com/673775
|
| -class GoogleDesktopStory(_NewsBrowsingStory):
|
| +class GoogleDesktopStory(_ArticleBrowsingStory):
|
| """
|
| A typical google search story:
|
| _ Start at https://www.google.com/search?q=flower
|
| @@ -289,7 +306,7 @@ class GoogleDesktopStory(_NewsBrowsingStory):
|
| action_runner.ScrollPage()
|
|
|
|
|
| -class GoogleIndiaDesktopStory(_NewsBrowsingStory):
|
| +class GoogleIndiaDesktopStory(_ArticleBrowsingStory):
|
| """
|
| A typical google search story in India:
|
| 1. Start at https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2`
|
| @@ -376,6 +393,7 @@ class ImgurMobileStory(_MediaBrowsingStory):
|
| ITEM_SELECTOR = '.Navbar-customAction'
|
| SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| IS_SINGLE_PAGE_APP = True
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
|
|
|
|
| # crbug.com/704197 for win and mac
|
| @@ -396,6 +414,7 @@ class YouTubeMobileStory(_MediaBrowsingStory):
|
| IS_SINGLE_PAGE_APP = True
|
| ITEM_SELECTOR_INDEX = 3
|
| TAGS = [story_tags.JAVASCRIPT_HEAVY]
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
|
|
|
|
| class YouTubeDesktopStory(_MediaBrowsingStory):
|
| @@ -420,6 +439,7 @@ class FacebookPhotosMobileStory(_MediaBrowsingStory):
|
| SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| IS_SINGLE_PAGE_APP = True
|
| ITEM_SELECTOR_INDEX = 0
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
|
|
|
|
| class FacebookPhotosDesktopStory(_MediaBrowsingStory):
|
| @@ -483,3 +503,144 @@ class PinterestDesktopStory(_MediaBrowsingStory):
|
| '".Button.borderless.close.visible")')
|
| action_runner.ClickElement(element_function=x_element_function)
|
| action_runner.Wait(1) # Wait to make navigation realistic.
|
| +
|
| +
|
| +##############################################################################
|
| +# Emerging market browsing stories.
|
| +##############################################################################
|
| +
|
| +
|
| +@decorators.Disabled('android') # crbug.com/708300.
|
| +class BrowseFlipKartMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:shopping:flipkart'
|
| + URL = 'https://flipkart.com/search?q=Sunglasses'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEM_SELECTOR = '[style=\\"background-image: none;\\"]'
|
| + BACK_SELECTOR = '._3NH1qf'
|
| + ITEMS_TO_VISIT = 4
|
| + IS_SINGLE_PAGE_APP = True
|
| +
|
| + def _WaitForNavigation(self, action_runner):
|
| + action_runner.WaitForElement(text='Details')
|
| +
|
| + def _NavigateBack(self, action_runner):
|
| + action_runner.ClickElement(selector=self.BACK_SELECTOR)
|
| + action_runner.WaitForElement(text="Sunglasses")
|
| +
|
| +
|
| +class BrowseAmazonMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:shopping:amazon'
|
| + URL = 'https://www.amazon.co.in/s/?field-keywords=Mobile'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEM_SELECTOR = '.aw-search-results'
|
| + ITEMS_TO_VISIT = 4
|
| +
|
| +
|
| +class BrowseLazadaMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:shopping:lazada'
|
| + URL = 'https://www.lazada.co.id/catalog/?q=Wrist+watch'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEM_SELECTOR = '.merchandise__link'
|
| + ITEMS_TO_VISIT = 1
|
| +
|
| +
|
| +class BrowseAvitoMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:shopping:avito'
|
| + URL = 'https://www.avito.ru/rossiya'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEM_SELECTOR = '.item-link'
|
| + ITEMS_TO_VISIT = 4
|
| +
|
| +
|
| +class BrowseTOIMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:news:toi'
|
| + URL = 'http://m.timesofindia.com'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEMS_TO_VISIT = 4
|
| + ITEM_SELECTOR = '.dummy-img'
|
| +
|
| +
|
| +class BrowseGloboMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:news:globo'
|
| + URL = 'http://www.globo.com'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEMS_TO_VISIT = 4
|
| + ITEM_SELECTOR = '.hui-premium__title'
|
| +
|
| +
|
| +class BrowseCricBuzzMobileStory(_ArticleBrowsingStory):
|
| + NAME = 'browse:news:cricbuzz'
|
| + URL = 'http://m.cricbuzz.com'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + ITEMS_TO_VISIT = 3
|
| + ITEM_SELECTOR = '.list-content'
|
| +
|
| +
|
| +
|
| +##############################################################################
|
| +# Maps browsing stories.
|
| +##############################################################################
|
| +
|
| +
|
| +class GoogleMapsMobileStory(system_health_story.SystemHealthStory):
|
| + """Story that browses google maps mobile page
|
| +
|
| + This story searches for nearby restaurants on google maps website and finds
|
| + directions to a chosen restaurant from search results.
|
| + """
|
| + NAME = 'browse:tools:maps'
|
| + URL = 'https://maps.google.com/'
|
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
|
| + TAGS = [story_tags.EMERGING_MARKET]
|
| +
|
| + _MAPS_SEARCH_BOX_SELECTOR = '.ml-searchbox-placeholder'
|
| + _RESTAURANTS_LOADED = '.ml-panes-categorical-list-results'
|
| + _SEARCH_NEW_AREA_SELECTOR = '.ml-reissue-search-button-inner'
|
| + _RESTAURANTS_LINK = '.ml-entity-list-item-info'
|
| + _DIRECTIONS_LINK = '[class="ml-button ml-inner-button-directions-fab"]'
|
| + _DIRECTIONS_LOADED = ('[class="ml-fab-inner '
|
| + 'ml-button ml-button-navigation-fab"]')
|
| + _MAP_LAYER = '.ml-map'
|
| +
|
| + def _DidLoadDocument(self, action_runner):
|
| + # Submit search query.
|
| + self._ClickLink(self._MAPS_SEARCH_BOX_SELECTOR, action_runner)
|
| + action_runner.EnterText('restaurants near me')
|
| + action_runner.PressKey('Return')
|
| + action_runner.WaitForElement(selector=self._RESTAURANTS_LOADED)
|
| + action_runner.WaitForNetworkQuiescence()
|
| + action_runner.Wait(4) # User looking at restaurants
|
| +
|
| + # Open the restaurant list and select the first.
|
| + self._ClickLink(self._RESTAURANTS_LOADED, action_runner)
|
| + action_runner.WaitForElement(selector=self._RESTAURANTS_LINK)
|
| + action_runner.Wait(3) # User reads about restaurant
|
| + self._ClickLink(self._RESTAURANTS_LINK, action_runner)
|
| + action_runner.Wait(1) # Reading description
|
| +
|
| + # Open directions to the restaurant from Google.
|
| + self._ClickLink(self._DIRECTIONS_LINK, action_runner)
|
| + action_runner.Wait(0.5)
|
| + action_runner.EnterText('Google Mountain View')
|
| + action_runner.PressKey('Return')
|
| + action_runner.WaitForElement(selector=self._DIRECTIONS_LOADED)
|
| + action_runner.WaitForNetworkQuiescence()
|
| + action_runner.Wait(2) # Seeing direction
|
| +
|
| + def _ClickLink(self, selector, action_runner):
|
| + action_runner.WaitForElement(selector=selector)
|
| + action_runner.ClickElement(selector=selector)
|
|
|