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

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

Issue 2552303002: [tools/perf] Add google search browsing story (Closed)
Patch Set: Address Juan's comment & add WPR recording Created 4 years 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
« no previous file with comments | « tools/perf/page_sets/data/system_health_desktop_037.wpr.sha1 ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 4
5 from page_sets.system_health import platforms 5 from page_sets.system_health import platforms
6 from page_sets.system_health import system_health_story 6 from page_sets.system_health import system_health_story
7 7
8 from page_sets.login_helpers import pinterest_login 8 from page_sets.login_helpers import pinterest_login
9 9
10 from telemetry import decorators 10 from telemetry import decorators
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 # to phone" button. So on tablets we run with the popup window open. The 226 # to phone" button. So on tablets we run with the popup window open. The
227 # popup is transparent, so this is mostly an aesthetical issue. 227 # popup is transparent, so this is mostly an aesthetical issue.
228 has_button = action_runner.EvaluateJavaScript( 228 has_button = action_runner.EvaluateJavaScript(
229 '!!document.querySelector("%s")' % self._CLOSE_BUTTON_SELECTOR) 229 '!!document.querySelector("%s")' % self._CLOSE_BUTTON_SELECTOR)
230 if has_button: 230 if has_button:
231 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) 231 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR)
232 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) 232 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner)
233 233
234 234
235 ############################################################################## 235 ##############################################################################
236 # Search browsing stories.
237 ##############################################################################
238
239
240 class GoogleDesktopStory(_NewsBrowsingStory):
241 """
242 A typical google search story:
243 _ Start at https://www.google.com/search?q=flower
244 _ Click on the wikipedia link & navigate to
245 https://en.wikipedia.org/wiki/Flower
246 _ Scroll down the wikipedia page about flower.
247 _ Back to the search main page.
248 _ Refine the search query to 'flower delivery'.
249 _ Scroll down the page.
250 _ Click the next page result of 'flower delivery'.
251 _ Scroll the search page.
252
253 """
254 NAME = 'browse:search:google'
255 URL = 'https://www.google.com/search?q=flower'
256 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]'
257 _SEARCH_PAGE_2_SELECTOR = 'a[aria-label=\'Page 2\']'
perezju 2016/12/08 10:01:28 nit: for consistency, can this be 'a[aria-label="P
nednguyen 2016/12/08 12:09:37 No, the escaping is not right. If I use '"', it th
258 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
259
260 def _DidLoadDocument(self, action_runner):
261 # Click on flower Wikipedia link.
262 action_runner.Wait(2)
263 action_runner.ClickElement(text='Flower - Wikipedia')
264 action_runner.WaitForNavigate()
265
266 # Scroll the flower Wikipedia page, then navigate back.
267 action_runner.Wait(2)
268 action_runner.ScrollPage()
269 action_runner.Wait(2)
270 action_runner.NavigateBack()
271
272 # Click on the search box.
273 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR)
274 action_runner.ClickElement(selector=self._SEARCH_BOX_SELECTOR)
275 action_runner.Wait(2)
276
277 # Submit search query.
278 action_runner.EnterText(' delivery')
279 action_runner.Wait(0.5)
280 action_runner.PressKey('Return')
281
282 # Scroll down & click next search result page.
283 action_runner.Wait(2)
284 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR)
285 action_runner.Wait(2)
286 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR)
287 action_runner.Wait(2)
288 action_runner.ScrollPage()
289
290
291 ##############################################################################
236 # Media browsing stories. 292 # Media browsing stories.
237 ############################################################################## 293 ##############################################################################
238 294
239 295
240 class _MediaBrowsingStory(_BrowsingStory): 296 class _MediaBrowsingStory(_BrowsingStory):
241 """Abstract base class for media user stories 297 """Abstract base class for media user stories
242 298
243 A media story imitates browsing a website with photo or video content: 299 A media story imitates browsing a website with photo or video content:
244 1. Load a page showing a media item 300 1. Load a page showing a media item
245 2. Click on the next link to go to the next media item 301 2. Click on the next link to go to the next media item
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 inner_save_function = 'document.querySelector(".nameAndIcons")' 426 inner_save_function = 'document.querySelector(".nameAndIcons")'
371 action_runner.WaitForElement(element_function=inner_save_function) 427 action_runner.WaitForElement(element_function=inner_save_function)
372 action_runner.ClickElement(element_function=inner_save_function) 428 action_runner.ClickElement(element_function=inner_save_function)
373 action_runner.Wait(1) # Wait to make navigation realistic. 429 action_runner.Wait(1) # Wait to make navigation realistic.
374 430
375 # Close selection. 431 # Close selection.
376 x_element_function = ('document.querySelector(' 432 x_element_function = ('document.querySelector('
377 '".Button.borderless.close.visible")') 433 '".Button.borderless.close.visible")')
378 action_runner.ClickElement(element_function=x_element_function) 434 action_runner.ClickElement(element_function=x_element_function)
379 action_runner.Wait(1) # Wait to make navigation realistic. 435 action_runner.Wait(1) # Wait to make navigation realistic.
OLDNEW
« no previous file with comments | « tools/perf/page_sets/data/system_health_desktop_037.wpr.sha1 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698