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

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

Issue 2607793002: [System health] Add google india search story (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « tools/perf/page_sets/data/system_health_desktop_039.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 # encoding: utf-8
1 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # 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
3 # found in the LICENSE file. 4 # found in the LICENSE file.
4 5
5 from page_sets.system_health import platforms 6 from page_sets.system_health import platforms
6 from page_sets.system_health import system_health_story 7 from page_sets.system_health import system_health_story
7 8
8 from page_sets.login_helpers import pinterest_login 9 from page_sets.login_helpers import pinterest_login
9 10
10 from telemetry import decorators 11 from telemetry import decorators
12 from telemetry.util import js_template
11 13
12 14
13 class _BrowsingStory(system_health_story.SystemHealthStory): 15 class _BrowsingStory(system_health_story.SystemHealthStory):
14 """Abstract base class for browsing stories. 16 """Abstract base class for browsing stories.
15 17
16 A browsing story visits items on the main page. Subclasses provide 18 A browsing story visits items on the main page. Subclasses provide
17 CSS selector to identify the items and implement interaction using 19 CSS selector to identify the items and implement interaction using
18 the helper methods of this class. 20 the helper methods of this class.
19 """ 21 """
20 22
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 284
283 # Scroll down & click next search result page. 285 # Scroll down & click next search result page.
284 action_runner.Wait(2) 286 action_runner.Wait(2)
285 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR) 287 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR)
286 action_runner.Wait(2) 288 action_runner.Wait(2)
287 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR) 289 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR)
288 action_runner.Wait(2) 290 action_runner.Wait(2)
289 action_runner.ScrollPage() 291 action_runner.ScrollPage()
290 292
291 293
294 class GoogleIndiaDesktopStory(_NewsBrowsingStory):
295 """
296 A typical google search story in India:
297 _ Start at https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2`
rnephew (Reviews Here) 2017/01/03 17:03:11 Any reason these are underscores? Just want to mak
nednguyen 2017/01/03 17:19:24 Oops, no reason at all. It's me being silly. :P D
298 _ Scroll down the page.
299 _ Refine the query & click search box, which navigates to
300 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
301 _ Scroll down the page.
302 _ Click the next page result
303 _ Scroll the search page.
304
305 """
306 NAME = 'browse:search:google_india'
307 URL = 'https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2'
308 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]'
309 _SEARCH_BUTTON_SELECTOR = 'button[aria-label="Google Search"]'
310 _SEARCH_PAGE_2_SELECTOR = 'a[aria-label=\'Page 2\']'
311 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
312
313 def _DidLoadDocument(self, action_runner):
314 action_runner.Wait(2)
315 action_runner.ScrollPage()
316 action_runner.Wait(2)
317
318 action_runner.ScrollPage(direction='up')
319
320 # Refine search query in the search box.
321 action_runner.ExecuteJavaScript(
rnephew (Reviews Here) 2017/01/03 17:03:11 I assume this is entering text into the search tex
nednguyen 2017/01/03 17:19:24 Correct. This text not being English makes it impo
322 js_template.Render(
323 'document.querySelector({{ selector }}).value += "वितरण";',
324 selector=self._SEARCH_BOX_SELECTOR))
325 action_runner.Wait(2)
326 action_runner.ClickElement(selector=self._SEARCH_BUTTON_SELECTOR)
327
328 # Scroll down & click next search result page.
329 action_runner.Wait(2)
330 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR)
331 action_runner.Wait(2)
332 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR)
333 action_runner.Wait(2)
334 action_runner.ScrollPage()
335
336
292 ############################################################################## 337 ##############################################################################
293 # Media browsing stories. 338 # Media browsing stories.
294 ############################################################################## 339 ##############################################################################
295 340
296 341
297 class _MediaBrowsingStory(_BrowsingStory): 342 class _MediaBrowsingStory(_BrowsingStory):
298 """Abstract base class for media user stories 343 """Abstract base class for media user stories
299 344
300 A media story imitates browsing a website with photo or video content: 345 A media story imitates browsing a website with photo or video content:
301 1. Load a page showing a media item 346 1. Load a page showing a media item
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 inner_save_function = 'document.querySelector(".nameAndIcons")' 472 inner_save_function = 'document.querySelector(".nameAndIcons")'
428 action_runner.WaitForElement(element_function=inner_save_function) 473 action_runner.WaitForElement(element_function=inner_save_function)
429 action_runner.ClickElement(element_function=inner_save_function) 474 action_runner.ClickElement(element_function=inner_save_function)
430 action_runner.Wait(1) # Wait to make navigation realistic. 475 action_runner.Wait(1) # Wait to make navigation realistic.
431 476
432 # Close selection. 477 # Close selection.
433 x_element_function = ('document.querySelector(' 478 x_element_function = ('document.querySelector('
434 '".Button.borderless.close.visible")') 479 '".Button.borderless.close.visible")')
435 action_runner.ClickElement(element_function=x_element_function) 480 action_runner.ClickElement(element_function=x_element_function)
436 action_runner.Wait(1) # Wait to make navigation realistic. 481 action_runner.Wait(1) # Wait to make navigation realistic.
OLDNEW
« no previous file with comments | « tools/perf/page_sets/data/system_health_desktop_039.wpr.sha1 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698