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

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: 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 | « no previous file | 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 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
258
259 def _DidLoadDocument(self, action_runner):
260 # Click on flower Wikipedia link.
261 action_runner.Wait(2)
262 action_runner.ClickElement(
263 text='Flower - Wikipedia')
perezju 2016/12/07 11:12:06 nit: should fit in one line?
nednguyen 2016/12/07 17:42:21 Done.
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(1)
276
277 # Submit search query.
278 action_runner.Wait(1)
perezju 2016/12/07 11:12:06 remove this and make the previous a Wait(2) ?
nednguyen 2016/12/07 17:42:21 Done.
279 action_runner.EnterText(' delivery')
280 action_runner.Wait(0.5)
281 action_runner.PressKey('Return')
282
283 # Scroll down & click next search result page.
284 action_runner.Wait(2)
285 action_runner.ScrollPageToElement(selector='a[aria-label=\'Page 2\']')
perezju 2016/12/07 11:12:06 1) I think you should be able to write this as sel
286 action_runner.Wait(2)
287 action_runner.ClickElement(selector='a[aria-label=\'Page 2\']')
288 action_runner.Wait(2)
289 action_runner.ScrollPage()
290
291
292 ##############################################################################
236 # Media browsing stories. 293 # Media browsing stories.
237 ############################################################################## 294 ##############################################################################
238 295
239 296
240 class _MediaBrowsingStory(_BrowsingStory): 297 class _MediaBrowsingStory(_BrowsingStory):
241 """Abstract base class for media user stories 298 """Abstract base class for media user stories
242 299
243 A media story imitates browsing a website with photo or video content: 300 A media story imitates browsing a website with photo or video content:
244 1. Load a page showing a media item 301 1. Load a page showing a media item
245 2. Click on the next link to go to the next media item 302 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")' 427 inner_save_function = 'document.querySelector(".nameAndIcons")'
371 action_runner.WaitForElement(element_function=inner_save_function) 428 action_runner.WaitForElement(element_function=inner_save_function)
372 action_runner.ClickElement(element_function=inner_save_function) 429 action_runner.ClickElement(element_function=inner_save_function)
373 action_runner.Wait(1) # Wait to make navigation realistic. 430 action_runner.Wait(1) # Wait to make navigation realistic.
374 431
375 # Close selection. 432 # Close selection.
376 x_element_function = ('document.querySelector(' 433 x_element_function = ('document.querySelector('
377 '".Button.borderless.close.visible")') 434 '".Button.borderless.close.visible")')
378 action_runner.ClickElement(element_function=x_element_function) 435 action_runner.ClickElement(element_function=x_element_function)
379 action_runner.Wait(1) # Wait to make navigation realistic. 436 action_runner.Wait(1) # Wait to make navigation realistic.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698