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

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

Issue 2217113002: [system-health] Re-enable full Google Search story on mobile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/system_health/loading_stories.py ('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
(Empty)
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
3 # found in the LICENSE file.
4
5 from page_sets.system_health import platforms
6 from page_sets.system_health import system_health_story
7
8
9 class SearchGoogleStory(system_health_story.SystemHealthStory):
10 NAME = 'search:portal:google'
11 URL = 'https://www.google.co.uk/'
12 # Tap simulation doesn't fully work on Windows. http://crbug.com/634343
13 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
14
15 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]'
16 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]'
17
18 def _DidLoadDocument(self, action_runner):
19 # Click on the search box.
20 action_runner.Wait(1)
21 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR)
22 action_runner.TapElement(selector=self._SEARCH_BOX_SELECTOR)
23
24 # Submit search query.
25 action_runner.Wait(1)
26 action_runner.EnterText('what is science')
27 action_runner.Wait(0.5)
28 action_runner.PressKey('Return')
29
30 # Scroll to the Wikipedia result.
31 action_runner.WaitForElement(selector=self._RESULT_SELECTOR)
32 action_runner.Wait(1)
33 # TODO(petrcermak): Turn this into a proper Telemetry API (ScrollToElement).
34 result_visible_expression = ('''
35 (function() {
36 var resultElem = document.querySelector(\'%s\');
37 var boundingRect = resultElem.getBoundingClientRect();
38 return boundingRect.bottom >= window.innerHeight
39 })()''' % self._RESULT_SELECTOR)
40 while action_runner.EvaluateJavaScript(result_visible_expression):
41 action_runner.RepeatableBrowserDrivenScroll(y_scroll_distance_ratio=0.75,
42 prevent_fling=False)
43 action_runner.Wait(0.2)
44
45 # Click on the Wikipedia result.
46 action_runner.Wait(1)
47 action_runner.TapElement(selector=self._RESULT_SELECTOR)
48 action_runner.tab.WaitForDocumentReadyStateToBeComplete()
OLDNEW
« 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