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

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 comments 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 For each of the search queries in in the list below, this story does:
perezju 2017/05/19 13:48:29 nit: "in in" -> "in"
nednguyen 2017/05/19 15:07:50 Done.
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
88
89 List of search queries:
90 'does google know everything',
91 'most famous paintings',
92 'current weather',
93 'best movies 2016',
94 'how to tie a tie'
perezju 2017/05/19 13:48:29 I'm not very happy about duplicating this list her
nednguyen 2017/05/19 15:07:50 I removed the duplicating list for now.
81 """ 95 """
82
83 NAME = 'browse:chrome:newtab' 96 NAME = 'browse:chrome:newtab'
84 URL = 'chrome://newtab' 97 URL = 'chrome://newtab'
85 _SEARCH_TEXTS = ['does google know everything', 98 _SEARCH_TEXTS = ['does google know everything',
86 'most famous paintings', 99 'most famous paintings',
87 'current weather', 100 'current weather',
88 'best movies 2016', 101 'best movies 2016',
89 'how to tie a tie'] 102 'how to tie a tie']
90 103
91 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 104 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
92 TAGS = [story_tags.EMERGING_MARKET] 105 TAGS = [story_tags.EMERGING_MARKET]
93 106
94 def _DidLoadDocument(self, action_runner): 107 def _DidLoadDocument(self, action_runner):
95 app_ui = action_runner.tab.browser.GetAppUi() 108 app_ui = action_runner.tab.browser.GetAppUi()
96 platform = action_runner.tab.browser.platform 109 platform = action_runner.tab.browser.platform
97 for keyword in self._SEARCH_TEXTS: 110 for keyword in self._SEARCH_TEXTS:
98 app_ui.WaitForUiNode(resource_id='search_box').Tap() 111 app_ui.WaitForUiNode(resource_id='search_box').Tap()
99 platform.android_action_runner.InputText(keyword) 112 platform.android_action_runner.InputText(keyword)
100 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER) 113 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER)
101 action_runner.WaitForNavigate() 114 action_runner.WaitForNavigate()
102 action_runner.Wait(1.5) # Read results 115 action_runner.Wait(1.5) # Read results
103 action_runner.ScrollPage(use_touch=True) 116 action_runner.ScrollPage(use_touch=True)
104 action_runner.NavigateBack() 117 action_runner.NavigateBack()
105 action_runner.WaitForNavigate() 118 action_runner.WaitForNavigate()
106 119
107 app_ui.WaitForUiNode(resource_id='menu_button').Tap() 120 app_ui.WaitForUiNode(resource_id='menu_button').Tap()
108 app_ui.WaitForUiNode(resource_id='menu_item_text') 121 app_ui.WaitForUiNode(resource_id='menu_item_text')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698