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

Unified Diff: tools/perf/page_sets/system_health/searching_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: Rebase 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 | « tools/perf/page_sets/system_health/loading_stories.py ('k') | 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/searching_stories.py
diff --git a/tools/perf/page_sets/system_health/searching_stories.py b/tools/perf/page_sets/system_health/searching_stories.py
new file mode 100644
index 0000000000000000000000000000000000000000..156c614fb2bc7b0ceeac4f5a53a25f603cdefc7c
--- /dev/null
+++ b/tools/perf/page_sets/system_health/searching_stories.py
@@ -0,0 +1,45 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from page_sets.system_health import system_health_story
+
+
+class SearchGoogleStory(system_health_story.SystemHealthStory):
+ NAME = 'search:portal:google'
+ 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.WaitForElement(selector=self._RESULT_SELECTOR)
+ action_runner.Wait(1)
+ # 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):
+ 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()
« no previous file with comments | « tools/perf/page_sets/system_health/loading_stories.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698