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

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

Issue 2888133002: Modify list_system_health_stories to generate_system_health_csv (Closed)
Patch Set: Address Juan's nits Created 3 years, 7 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 # 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 story_tags 6 from page_sets.system_health import story_tags
7 from page_sets.system_health import system_health_story 7 from page_sets.system_health import system_health_story
8 8
9 from telemetry import decorators 9 from telemetry import decorators
10 10
11 from devil.android.sdk import keyevent # pylint: disable=import-error 11 from devil.android.sdk import keyevent # pylint: disable=import-error
12 12
13 13
14 # TODO(ssid): Rename the search stories to browse stories crbug.com/708300. 14 # TODO(ssid): Rename the search stories to browse stories crbug.com/708300.
15 class SearchGoogleStory(system_health_story.SystemHealthStory): 15 class SearchGoogleStory(system_health_story.SystemHealthStory):
16 """ A typical Google search user story.
17 Issue the search query "what is science" in the search box and press Enter.
18 Wait for the search result page to be loaded, then scroll to the Wikipedia
19 result.
20 Navigate to wikipedia page by clicking on the result and wait for it to be
21 fully loaded.
22 """
16 NAME = 'search:portal:google' 23 NAME = 'search:portal:google'
17 URL = 'https://www.google.co.uk/' 24 URL = 'https://www.google.co.uk/'
18 TAGS = [story_tags.EMERGING_MARKET] 25 TAGS = [story_tags.EMERGING_MARKET]
19 26
20 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' 27 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]'
21 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' 28 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]'
22 29
23 def _DidLoadDocument(self, action_runner): 30 def _DidLoadDocument(self, action_runner):
24 # Click on the search box. 31 # Click on the search box.
25 action_runner.Wait(1) 32 action_runner.Wait(1)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER) 74 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER)
68 75
69 action_runner.WaitForNavigate() 76 action_runner.WaitForNavigate()
70 action_runner.ScrollPage(use_touch=True, distance=500) 77 action_runner.ScrollPage(use_touch=True, distance=500)
71 78
72 79
73 @decorators.Disabled('android-webview') # Webview does not have new tab page. 80 @decorators.Disabled('android-webview') # Webview does not have new tab page.
74 class MobileNewTabPageStory(system_health_story.SystemHealthStory): 81 class MobileNewTabPageStory(system_health_story.SystemHealthStory):
75 """Story that loads new tab page and performs searches. 82 """Story that loads new tab page and performs searches.
76 83
77 For each of the search queries in |_SEARCH_TEXTS| below, this story does: 84 Given a list of typical search queries, this story does for each of them:
78 - enter the search query on the new tab page search box 85 - enter the search query on the new tab page search box
79 - read results 86 - read results
80 - navigates back to new tab page 87 - navigates back to new tab page
81 """ 88 """
82
83 NAME = 'browse:chrome:newtab' 89 NAME = 'browse:chrome:newtab'
84 URL = 'chrome://newtab' 90 URL = 'chrome://newtab'
85 _SEARCH_TEXTS = ['does google know everything', 91 _SEARCH_TEXTS = ['does google know everything',
86 'most famous paintings', 92 'most famous paintings',
87 'current weather', 93 'current weather',
88 'best movies 2016', 94 'best movies 2016',
89 'how to tie a tie'] 95 'how to tie a tie']
90 96
91 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 97 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
92 TAGS = [story_tags.EMERGING_MARKET] 98 TAGS = [story_tags.EMERGING_MARKET]
93 99
94 def _DidLoadDocument(self, action_runner): 100 def _DidLoadDocument(self, action_runner):
95 app_ui = action_runner.tab.browser.GetAppUi() 101 app_ui = action_runner.tab.browser.GetAppUi()
96 platform = action_runner.tab.browser.platform 102 platform = action_runner.tab.browser.platform
97 for keyword in self._SEARCH_TEXTS: 103 for keyword in self._SEARCH_TEXTS:
98 app_ui.WaitForUiNode(resource_id='search_box').Tap() 104 app_ui.WaitForUiNode(resource_id='search_box').Tap()
99 platform.android_action_runner.InputText(keyword) 105 platform.android_action_runner.InputText(keyword)
100 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER) 106 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER)
101 action_runner.WaitForNavigate() 107 action_runner.WaitForNavigate()
102 action_runner.Wait(1.5) # Read results 108 action_runner.Wait(1.5) # Read results
103 action_runner.ScrollPage(use_touch=True) 109 action_runner.ScrollPage(use_touch=True)
104 action_runner.NavigateBack() 110 action_runner.NavigateBack()
105 action_runner.WaitForNavigate() 111 action_runner.WaitForNavigate()
106 112
107 app_ui.WaitForUiNode(resource_id='menu_button').Tap() 113 app_ui.WaitForUiNode(resource_id='menu_button').Tap()
108 app_ui.WaitForUiNode(resource_id='menu_item_text') 114 app_ui.WaitForUiNode(resource_id='menu_item_text')
OLDNEW
« no previous file with comments | « tools/perf/page_sets/system_health/multi_tab_stories.py ('k') | tools/perf/page_sets/system_health/system_health_story.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698