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

Unified Diff: tools/perf/page_sets/system_health/single_page_stories.py

Issue 2148843002: [system-health] Add full Google Search story to the System Health story sets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/system_health/single_page_stories.py
diff --git a/tools/perf/page_sets/system_health/single_page_stories.py b/tools/perf/page_sets/system_health/single_page_stories.py
index efd8e09f518ee37179a8bda1a48e65cefaa26db3..0cc092194a26a0e3395456c0617e65e6b6cebe6a 100644
--- a/tools/perf/page_sets/system_health/single_page_stories.py
+++ b/tools/perf/page_sets/system_health/single_page_stories.py
@@ -86,7 +86,48 @@ def IterAllStoryClasses():
class LoadGoogleStory(_SinglePageStory):
NAME = 'load:search:google'
- URL = 'https://www.google.com/#hl=en&q=science'
+ URL = 'https://www.google.co.uk/'
+
+
+class SearchGoogleStory(_SinglePageStory):
petrcermak 2016/07/13 15:47:15 I'll move this to a separate file (search_stories.
+ NAME = 'search:search:google'
petrcermak 2016/07/13 15:47:15 I'm still not completely sure about the names: 1.
nednguyen 2016/07/13 16:03:24 This seems like it a type of browsing stories so s
petrcermak 2016/07/14 13:20:15 Done.
nednguyen 2016/07/14 13:25:17 Now that I know search is a major activity that pe
+ URL = 'https://www.google.co.uk/'
+
+ _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]'
+ _RESULT_SELECTOR = '.r > a[href*="wikipedia"]'
+
+ def _DidLoadDocument(self, action_runner):
+ # Click on the search box.
+ action_runner.Wait(1)
+ action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR)
+ action_runner.TapElement(selector=self._SEARCH_BOX_SELECTOR)
+
+ # Submit search query.
+ action_runner.Wait(1)
+ action_runner.EnterText('what is science')
+ action_runner.Wait(0.5)
+ action_runner.PressKey('Return')
+
+ # Scroll to the Wikipedia result.
+ action_runner.Wait(1)
+ action_runner.tab.WaitForDocumentReadyStateToBeComplete()
+ action_runner.WaitForElement(selector=self._RESULT_SELECTOR)
+ # TODO(petrcermak): Turn this into a proper Telemetry API (ScrollToElement).
+ result_visible_expression = ('''
+ (function() {
+ var resultElem = document.querySelector(\'%s\');
+ var boundingRect = resultElem.getBoundingClientRect();
+ return boundingRect.bottom >= window.innerHeight
+ })()''' % self._RESULT_SELECTOR)
+ while action_runner.EvaluateJavaScript(result_visible_expression):
petrcermak 2016/07/13 15:47:15 Note that we can't a single RepeatableBrowserDrive
+ action_runner.RepeatableBrowserDrivenScroll(y_scroll_distance_ratio=0.75,
+ prevent_fling=False)
+ action_runner.Wait(0.2)
+
+ # Click on the Wikipedia result.
+ action_runner.Wait(1)
+ action_runner.TapElement(selector=self._RESULT_SELECTOR)
+ action_runner.tab.WaitForDocumentReadyStateToBeComplete()
class LoadBaiduStory(_SinglePageStory):
« 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