Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: tools/perf/page_sets/system_health/browsing_stories.py

Issue 2787103003: Add System health stories for Emerging market (Closed)
Patch Set: Fixes. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 53
54 ############################################################################## 54 ##############################################################################
55 # News browsing stories. 55 # News browsing stories.
56 ############################################################################## 56 ##############################################################################
57 57
58 58
59 class _NewsBrowsingStory(_BrowsingStory): 59 class _ArticleBrowsingStory(_BrowsingStory):
60 """Abstract base class for news user stories. 60 """Abstract base class for user stories browsing news / shopping articles.
61 61
62 A news story imitates browsing a news website: 62 An article browsing story imitates browsing a articles:
63 1. Load the main page. 63 1. Load the main page.
64 2. Open and scroll the first news item. 64 2. Open and scroll the first article.
65 3. Go back to the main page and scroll it. 65 3. Go back to the main page and scroll it.
66 4. Open and scroll the second news item. 66 4. Open and scroll the second article.
67 5. Go back to the main page and scroll it. 67 5. Go back to the main page and scroll it.
68 6. etc. 68 6. etc.
69 """ 69 """
70 70
71 ITEM_READ_TIME_IN_SECONDS = 3 71 ITEM_READ_TIME_IN_SECONDS = 3
72 ITEM_SCROLL_REPEAT = 2 72 ITEM_SCROLL_REPEAT = 2
73 ITEMS_TO_VISIT = 4 73 ITEMS_TO_VISIT = 4
74 MAIN_PAGE_SCROLL_REPEAT = 0 74 MAIN_PAGE_SCROLL_REPEAT = 0
75 ABSTRACT_STORY = True 75 ABSTRACT_STORY = True
76 76
77 def _DidLoadDocument(self, action_runner): 77 def _DidLoadDocument(self, action_runner):
78 for i in xrange(self.ITEMS_TO_VISIT): 78 for i in xrange(self.ITEMS_TO_VISIT):
79 self._NavigateToItem(action_runner, i) 79 self._NavigateToItem(action_runner, i)
80 self._ReadNewsItem(action_runner) 80 self._ReadNextArticle(action_runner)
81 self._NavigateBack(action_runner) 81 self._NavigateBack(action_runner)
82 self._ScrollMainPage(action_runner) 82 self._ScrollMainPage(action_runner)
83 83
84 def _ReadNewsItem(self, action_runner): 84 def _ReadNextArticle(self, action_runner):
85 action_runner.tab.WaitForDocumentReadyStateToBeComplete() 85 action_runner.tab.WaitForDocumentReadyStateToBeComplete()
86 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) 86 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0)
87 action_runner.RepeatableBrowserDrivenScroll( 87 action_runner.RepeatableBrowserDrivenScroll(
88 repeat_count=self.ITEM_SCROLL_REPEAT) 88 repeat_count=self.ITEM_SCROLL_REPEAT)
89 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) 89 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0)
90 90
91 def _ScrollMainPage(self, action_runner): 91 def _ScrollMainPage(self, action_runner):
92 action_runner.tab.WaitForDocumentReadyStateToBeComplete() 92 action_runner.tab.WaitForDocumentReadyStateToBeComplete()
93 action_runner.RepeatableBrowserDrivenScroll( 93 action_runner.RepeatableBrowserDrivenScroll(
94 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) 94 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT)
95 95
96 96
97 class CnnStory(_NewsBrowsingStory): 97 class CnnStory(_ArticleBrowsingStory):
98 """The second top website in http://www.alexa.com/topsites/category/News""" 98 """The second top website in http://www.alexa.com/topsites/category/News"""
99 NAME = 'browse:news:cnn' 99 NAME = 'browse:news:cnn'
100 URL = 'http://edition.cnn.com/' 100 URL = 'http://edition.cnn.com/'
101 ITEM_SELECTOR = '.cd__content > h3 > a' 101 ITEM_SELECTOR = '.cd__content > h3 > a'
102 ITEMS_TO_VISIT = 2 102 ITEMS_TO_VISIT = 2
103 TAGS = [story_tags.JAVASCRIPT_HEAVY] 103 TAGS = [story_tags.JAVASCRIPT_HEAVY]
104 104
105 105
106 class FacebookMobileStory(_NewsBrowsingStory): 106 class FacebookMobileStory(_ArticleBrowsingStory):
107 NAME = 'browse:social:facebook' 107 NAME = 'browse:social:facebook'
108 URL = 'https://www.facebook.com/rihanna' 108 URL = 'https://www.facebook.com/rihanna'
109 ITEM_SELECTOR = 'article ._5msj' 109 ITEM_SELECTOR = 'article ._5msj'
110 # We scroll further than usual so that Facebook fetches enough items 110 # We scroll further than usual so that Facebook fetches enough items
111 # (crbug.com/631022) 111 # (crbug.com/631022)
112 MAIN_PAGE_SCROLL_REPEAT = 1 112 MAIN_PAGE_SCROLL_REPEAT = 1
113 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 113 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
114 114
115 115
116 class FacebookDesktopStory(_NewsBrowsingStory): 116 class FacebookDesktopStory(_ArticleBrowsingStory):
117 NAME = 'browse:social:facebook' 117 NAME = 'browse:social:facebook'
118 URL = 'https://www.facebook.com/rihanna' 118 URL = 'https://www.facebook.com/rihanna'
119 ITEM_SELECTOR = '._4-eo' 119 ITEM_SELECTOR = '._4-eo'
120 IS_SINGLE_PAGE_APP = True 120 IS_SINGLE_PAGE_APP = True
121 # Web-page-replay does not work for this website: 121 # Web-page-replay does not work for this website:
122 # https://github.com/chromium/web-page-replay/issues/79. 122 # https://github.com/chromium/web-page-replay/issues/79.
123 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS 123 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS
124 124
125 125
126 class FlipboardMobileStory(_NewsBrowsingStory): 126 class FlipboardMobileStory(_ArticleBrowsingStory):
127 NAME = 'browse:news:flipboard' 127 NAME = 'browse:news:flipboard'
128 URL = 'https://flipboard.com/explore' 128 URL = 'https://flipboard.com/explore'
129 IS_SINGLE_PAGE_APP = True 129 IS_SINGLE_PAGE_APP = True
130 ITEM_SELECTOR = '.grad-top' 130 ITEM_SELECTOR = '.grad-top'
131 ITEM_SCROLL_REPEAT = 4 131 ITEM_SCROLL_REPEAT = 4
132 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 132 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
133 133
134 @classmethod 134 @classmethod
135 def ShouldDisable(cls, possible_browser): 135 def ShouldDisable(cls, possible_browser):
136 return possible_browser.platform.IsSvelte() # crbug.com/668097 136 return possible_browser.platform.IsSvelte() # crbug.com/668097
137 137
138 138
139 class FlipboardDesktopStory(_NewsBrowsingStory): 139 class FlipboardDesktopStory(_ArticleBrowsingStory):
140 NAME = 'browse:news:flipboard' 140 NAME = 'browse:news:flipboard'
141 URL = 'https://flipboard.com/explore' 141 URL = 'https://flipboard.com/explore'
142 IS_SINGLE_PAGE_APP = True 142 IS_SINGLE_PAGE_APP = True
143 ITEM_SELECTOR = '.cover-image' 143 ITEM_SELECTOR = '.cover-image'
144 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 144 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
145 145
146 146
147 # crbug.com/657665 for win and mac 147 # crbug.com/657665 for win and mac
148 @decorators.Disabled('win', 'mac') 148 @decorators.Disabled('win', 'mac')
149 class HackerNewsStory(_NewsBrowsingStory): 149 class HackerNewsStory(_ArticleBrowsingStory):
150 NAME = 'browse:news:hackernews' 150 NAME = 'browse:news:hackernews'
151 URL = 'https://news.ycombinator.com' 151 URL = 'https://news.ycombinator.com'
152 ITEM_SELECTOR = '.athing .title > a' 152 ITEM_SELECTOR = '.athing .title > a'
153 153
154 154
155 class NytimesMobileStory(_NewsBrowsingStory): 155 class NytimesMobileStory(_ArticleBrowsingStory):
156 """The third top website in http://www.alexa.com/topsites/category/News""" 156 """The third top website in http://www.alexa.com/topsites/category/News"""
157 NAME = 'browse:news:nytimes' 157 NAME = 'browse:news:nytimes'
158 URL = 'http://mobile.nytimes.com' 158 URL = 'http://mobile.nytimes.com'
159 ITEM_SELECTOR = '.sfgAsset-link' 159 ITEM_SELECTOR = '.sfgAsset-link'
160 # Visiting more items causes OOM. 160 # Visiting more items causes OOM.
161 ITEMS_TO_VISIT = 2 161 ITEMS_TO_VISIT = 2
162 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 162 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
163 163
164 164
165 class NytimesDesktopStory(_NewsBrowsingStory): 165 class NytimesDesktopStory(_ArticleBrowsingStory):
166 """The third top website in http://www.alexa.com/topsites/category/News""" 166 """The third top website in http://www.alexa.com/topsites/category/News"""
167 NAME = 'browse:news:nytimes' 167 NAME = 'browse:news:nytimes'
168 URL = 'http://www.nytimes.com' 168 URL = 'http://www.nytimes.com'
169 ITEM_SELECTOR = '.story-heading > a' 169 ITEM_SELECTOR = '.story-heading > a'
170 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 170 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
171 171
172 172
173 # Desktop qq.com opens a news item in a separate tab, for which the back button 173 # Desktop qq.com opens a news item in a separate tab, for which the back button
174 # does not work. 174 # does not work.
175 class QqMobileStory(_NewsBrowsingStory): 175 class QqMobileStory(_ArticleBrowsingStory):
176 NAME = 'browse:news:qq' 176 NAME = 'browse:news:qq'
177 URL = 'http://news.qq.com' 177 URL = 'http://news.qq.com'
178 ITEM_SELECTOR = '.list .full a' 178 ITEM_SELECTOR = '.list .full a'
179 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 179 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
180 TAGS = [story_tags.INTERNATIONAL] 180 TAGS = [story_tags.INTERNATIONAL]
181 181
182 182
183 class RedditDesktopStory(_NewsBrowsingStory): 183 class RedditDesktopStory(_ArticleBrowsingStory):
184 """The top website in http://www.alexa.com/topsites/category/News""" 184 """The top website in http://www.alexa.com/topsites/category/News"""
185 NAME = 'browse:news:reddit' 185 NAME = 'browse:news:reddit'
186 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' 186 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week'
187 ITEM_SELECTOR = '.thing .title > a' 187 ITEM_SELECTOR = '.thing .title > a'
188 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 188 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
189 189
190 190
191 class RedditMobileStory(_NewsBrowsingStory): 191 class RedditMobileStory(_ArticleBrowsingStory):
192 """The top website in http://www.alexa.com/topsites/category/News""" 192 """The top website in http://www.alexa.com/topsites/category/News"""
193 NAME = 'browse:news:reddit' 193 NAME = 'browse:news:reddit'
194 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' 194 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week'
195 IS_SINGLE_PAGE_APP = True 195 IS_SINGLE_PAGE_APP = True
196 ITEM_SELECTOR = '.PostHeader__post-title-line' 196 ITEM_SELECTOR = '.PostHeader__post-title-line'
197 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 197 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
198 198
199 199
200 class TwitterMobileStory(_NewsBrowsingStory): 200 class TwitterMobileStory(_ArticleBrowsingStory):
201 NAME = 'browse:social:twitter' 201 NAME = 'browse:social:twitter'
202 URL = 'https://www.twitter.com/nasa' 202 URL = 'https://www.twitter.com/nasa'
203 ITEM_SELECTOR = '.Tweet-text' 203 ITEM_SELECTOR = '.Tweet-text'
204 CONTAINER_SELECTOR = '.NavigationSheet' 204 CONTAINER_SELECTOR = '.NavigationSheet'
205 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 205 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
206 206
207 207
208 @decorators.Disabled('win') # crbug.com/662971 208 @decorators.Disabled('win') # crbug.com/662971
209 class TwitterDesktopStory(_NewsBrowsingStory): 209 class TwitterDesktopStory(_ArticleBrowsingStory):
210 NAME = 'browse:social:twitter' 210 NAME = 'browse:social:twitter'
211 URL = 'https://www.twitter.com/nasa' 211 URL = 'https://www.twitter.com/nasa'
212 IS_SINGLE_PAGE_APP = True 212 IS_SINGLE_PAGE_APP = True
213 ITEM_SELECTOR = '.tweet-text' 213 ITEM_SELECTOR = '.tweet-text'
214 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 214 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
215 215
216 216
217 class WashingtonPostMobileStory(_NewsBrowsingStory): 217 class WashingtonPostMobileStory(_ArticleBrowsingStory):
218 """Progressive website""" 218 """Progressive website"""
219 NAME = 'browse:news:washingtonpost' 219 NAME = 'browse:news:washingtonpost'
220 URL = 'https://www.washingtonpost.com/pwa' 220 URL = 'https://www.washingtonpost.com/pwa'
221 IS_SINGLE_PAGE_APP = True 221 IS_SINGLE_PAGE_APP = True
222 ITEM_SELECTOR = '.hed > a' 222 ITEM_SELECTOR = '.hed > a'
223 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 223 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
224 _CLOSE_BUTTON_SELECTOR = '.close' 224 _CLOSE_BUTTON_SELECTOR = '.close'
225 225
226 def _DidLoadDocument(self, action_runner): 226 def _DidLoadDocument(self, action_runner):
227 # Close the popup window. On Nexus 9 (and probably other tables) the popup 227 # Close the popup window. On Nexus 9 (and probably other tables) the popup
228 # window does not have a "Close" button, instead it has only a "Send link 228 # window does not have a "Close" button, instead it has only a "Send link
229 # to phone" button. So on tablets we run with the popup window open. The 229 # to phone" button. So on tablets we run with the popup window open. The
230 # popup is transparent, so this is mostly an aesthetical issue. 230 # popup is transparent, so this is mostly an aesthetical issue.
231 has_button = action_runner.EvaluateJavaScript( 231 has_button = action_runner.EvaluateJavaScript(
232 '!!document.querySelector({{ selector }})', 232 '!!document.querySelector({{ selector }})',
233 selector=self._CLOSE_BUTTON_SELECTOR) 233 selector=self._CLOSE_BUTTON_SELECTOR)
234 if has_button: 234 if has_button:
235 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) 235 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR)
236 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) 236 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner)
237 237
238 238
239 ############################################################################## 239 ##############################################################################
240 # Search browsing stories. 240 # Search browsing stories.
241 ############################################################################## 241 ##############################################################################
242 242
243 243
244 @decorators.Disabled('win') # crbug.com/673775 244 @decorators.Disabled('win') # crbug.com/673775
245 class GoogleDesktopStory(_NewsBrowsingStory): 245 class GoogleDesktopStory(_ArticleBrowsingStory):
246 """ 246 """
247 A typical google search story: 247 A typical google search story:
248 _ Start at https://www.google.com/search?q=flower 248 _ Start at https://www.google.com/search?q=flower
249 _ Click on the wikipedia link & navigate to 249 _ Click on the wikipedia link & navigate to
250 https://en.wikipedia.org/wiki/Flower 250 https://en.wikipedia.org/wiki/Flower
251 _ Scroll down the wikipedia page about flower. 251 _ Scroll down the wikipedia page about flower.
252 _ Back to the search main page. 252 _ Back to the search main page.
253 _ Refine the search query to 'flower delivery'. 253 _ Refine the search query to 'flower delivery'.
254 _ Scroll down the page. 254 _ Scroll down the page.
255 _ Click the next page result of 'flower delivery'. 255 _ Click the next page result of 'flower delivery'.
(...skipping 30 matching lines...) Expand all
286 286
287 # Scroll down & click next search result page. 287 # Scroll down & click next search result page.
288 action_runner.Wait(2) 288 action_runner.Wait(2)
289 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR) 289 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR)
290 action_runner.Wait(2) 290 action_runner.Wait(2)
291 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR) 291 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR)
292 action_runner.Wait(2) 292 action_runner.Wait(2)
293 action_runner.ScrollPage() 293 action_runner.ScrollPage()
294 294
295 295
296 class GoogleIndiaDesktopStory(_NewsBrowsingStory): 296 class GoogleIndiaDesktopStory(_ArticleBrowsingStory):
297 """ 297 """
298 A typical google search story in India: 298 A typical google search story in India:
299 1. Start at https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2` 299 1. Start at https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2`
300 2. Scroll down the page. 300 2. Scroll down the page.
301 3. Refine the query & click search box, which navigates to 301 3. Refine the query & click search box, which navigates to
302 https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2&rct=j#q=%E0%A4 %AB%E0%A5%82%E0%A4%B2+%E0%A4%B5%E0%A4%BF%E0%A4%A4%E0%A4%B0%E0%A4%A3 302 https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2&rct=j#q=%E0%A4 %AB%E0%A5%82%E0%A4%B2+%E0%A4%B5%E0%A4%BF%E0%A4%A4%E0%A4%B0%E0%A4%A3
303 4. Scroll down the page. 303 4. Scroll down the page.
304 5. Click the next page result 304 5. Click the next page result
305 6. Scroll the search result page. 305 6. Scroll the search result page.
306 306
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 inner_save_function = 'document.querySelector(".nameAndIcons")' 480 inner_save_function = 'document.querySelector(".nameAndIcons")'
481 action_runner.WaitForElement(element_function=inner_save_function) 481 action_runner.WaitForElement(element_function=inner_save_function)
482 action_runner.ClickElement(element_function=inner_save_function) 482 action_runner.ClickElement(element_function=inner_save_function)
483 action_runner.Wait(1) # Wait to make navigation realistic. 483 action_runner.Wait(1) # Wait to make navigation realistic.
484 484
485 # Close selection. 485 # Close selection.
486 x_element_function = ('document.querySelector(' 486 x_element_function = ('document.querySelector('
487 '".Button.borderless.close.visible")') 487 '".Button.borderless.close.visible")')
488 action_runner.ClickElement(element_function=x_element_function) 488 action_runner.ClickElement(element_function=x_element_function)
489 action_runner.Wait(1) # Wait to make navigation realistic. 489 action_runner.Wait(1) # Wait to make navigation realistic.
490
491
492 ##############################################################################
493 # Emerging market browsing stories.
494 ##############################################################################
495
496
497 class MobileNewTabPageStory(system_health_story.SystemHealthStory):
498 """Story that loads new tab page and opens menu."""
499
500 NAME = 'browse:chrome:newtab'
501 URL = 'chrome://newtab'
502
503 def RunPageInteractions(self, action_runner):
504 package = action_runner.tab.browser.GetBrowserInfo().package_name
505 platform = action_runner.tab.browser.platform
506 menu_button = package+':id/menu_button'
perezju 2017/04/04 09:23:38 I think we should add an "app_ui" property to the
ssid 2017/04/04 20:59:49 Done.
507 platform.system_ui.WaitForUiNode(resource_id=menu_button)
508 menu_button = platform.system_ui.GetUiNode(resource_id=menu_button)
509 menu_button.Tap()
510 platform.system_ui.WaitForUiNode(resource_id=package+':id/menu_item_text')
511
512 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
513 TAGS = [story_tags.EMERGING_MARKET]
514
515
516 class _ArticleBrowsingStoryEM(_ArticleBrowsingStory):
perezju 2017/04/04 09:23:38 I don't think we need this class. It's better to a
ssid 2017/04/04 20:59:49 Done.
517 """Abstract class for browsing stories for emerging markets."""
518 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
519 ABSTRACT_STORY = True
520 TAGS = [story_tags.EMERGING_MARKET]
521
522
523 class BrowseFlipKart(_ArticleBrowsingStoryEM):
524 NAME = 'browse:shopping:flipkart'
525 URL = 'https://flipkart.com/search?q=Mobile%20phone'
526 ITEM_SELECTOR = '.mEOukM'
527 BACK_SELECTOR = '._3NH1qf'
528 ITEMS_TO_VISIT = 4
529 IS_SINGLE_PAGE_APP = True
530
531 def _NavigateBack(self, action_runner):
532 action_runner.ClickElement(selector=self.BACK_SELECTOR)
533
534
535 class BrowseLazada(_ArticleBrowsingStoryEM):
536 NAME = 'browse:shopping:lazada'
537 URL = 'https://www.lazada.co.id/catalog/?q=Wrist+watch'
538 ITEM_SELECTOR = '.merchandise__link'
539 ITEMS_TO_VISIT = 1
540
541
542 class BrowseTOI(_ArticleBrowsingStoryEM):
543 NAME='browse:news:toi'
544 URL='http://m.timesofindia.com'
545 ITEMS_TO_VISIT = 3
546 ITEM_SELECTOR = '[onerror=\\"this.style.display=\'none\'\\"]'
547
548
549 class GoogleMapsMobileStory(_ArticleBrowsingStory):
550 NAME = 'browse:tools:maps'
551 URL='https://maps.google.co.in/'
mythria 2017/04/05 09:30:15 Is there any reason we start with maps.google.co.i
ssid 2017/04/07 22:18:34 Initially i added .co.in when I didn't have the se
552 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
553 TAGS = [story_tags.EMERGING_MARKET]
554
555 _MAPS_SEARCH_BOX_SELECTOR = '.ml-searchbox-placeholder'
556 _MAPS_ZOOM_IN_SELECTOR = '[aria-label="Zoom in"]'
mythria 2017/04/05 09:30:15 I think this is not required.
ssid 2017/04/07 22:18:34 Done.
557 _RESTAURANTS_LOADED = '.ml-panes-categorical-list-results'
558 _SEARCH_NEW_AREA_SELECTOR = '.ml-reissue-search-button-inner'
559 _RESTAURANTS_LINK = '.ml-entity-list-item-info'
560 _DIRECTIONS_LINK = '[class="ml-button ml-inner-button-directions-fab"]'
561 _LOCATION_LINK = '.suggest-query'
562 _LOCATION_INPUT = 'input[aria-label="Choose starting point"]'
563 _DIRECTIONS_LOADED = '[class="ml-fab-inner ml-button ml-button-navigation-fab" ]'
perezju 2017/04/04 09:23:38 Do sync with Mythri, I think she was also working
ssid 2017/04/04 20:59:49 Yes I had made this similar to the new Maps benchm
mythria 2017/04/05 09:30:15 Thanks for doing this. I was also working on the a
ssid 2017/04/07 22:18:34 Acknowledged.
564
565 def RunPageInteractions(self, action_runner):
566 # Click on the search box.
567 action_runner.WaitForElement(selector=self._MAPS_SEARCH_BOX_SELECTOR)
568 action_runner.ClickElement(selector=self._MAPS_SEARCH_BOX_SELECTOR)
569
570 # Submit search query.
571 action_runner.EnterText('restaurants near me')
572 action_runner.PressKey('Return')
573 action_runner.WaitForElement(selector=self._RESTAURANTS_LOADED)
574 action_runner.WaitForNetworkQuiescence()
575 action_runner.Wait(3) # User looking t restaurants
mythria 2017/04/05 09:30:15 It would be great, if we could add some scrolling
576
577 # Open the restaurant list and select the first.
578 self._ClickLink(self._RESTAURANTS_LOADED, action_runner)
579 action_runner.WaitForElement(selector=self._RESTAURANTS_LINK)
580 action_runner.Wait(3) # User reads about restaurant
581 self._ClickLink(self.__RESTAURANTS_LINK, action_runner)
582 action_runner.ScrollPage()
583 action_runner.Wait(1) # Reading review
584
585 # Open directions to the restaurant from Google.
586 self._ClickLink(self._DIRECTIONS_LINK, action_runner)
587 action_runner.Wait(0.5)
588 action_runner.EnterText('Google Mountain View')
589 action_runner.PressKey('Return')
590 action_runner.WaitForElement(selector=self._DIRECTIONS_LOADED)
591 action_runner.PinchPage(scale_factor=3)
592 action_runner.WaitForNetworkQuiescence()
593 action_runner.Wait(2) # Seeing direction
594
595 def _ClickLink(self, selector, action_runner):
596 action_runner.WaitForElement(selector=selector)
597 action_runner.ClickElement(selector=selector)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698