Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 system_health_story | 5 from page_sets.system_health import system_health_story |
| 6 from page_sets.system_health import platforms | |
| 6 | 7 |
| 7 | 8 |
| 8 class SearchGoogleStory(system_health_story.SystemHealthStory): | 9 class SearchGoogleStory(system_health_story.SystemHealthStory): |
| 9 NAME = 'search:portal:google' | 10 NAME = 'search:portal:google' |
| 10 URL = 'https://www.google.co.uk/' | 11 URL = 'https://www.google.co.uk/' |
| 11 | 12 |
| 12 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' | 13 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' |
| 13 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' | 14 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' |
| 14 | 15 |
| 15 def _DidLoadDocument(self, action_runner): | 16 def _DidLoadDocument(self, action_runner): |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 26 | 27 |
| 27 # Scroll to the Wikipedia result. | 28 # Scroll to the Wikipedia result. |
| 28 action_runner.WaitForElement(selector=self._RESULT_SELECTOR) | 29 action_runner.WaitForElement(selector=self._RESULT_SELECTOR) |
| 29 action_runner.Wait(1) | 30 action_runner.Wait(1) |
| 30 action_runner.ScrollPageToElement(selector=self._RESULT_SELECTOR) | 31 action_runner.ScrollPageToElement(selector=self._RESULT_SELECTOR) |
| 31 | 32 |
| 32 # Click on the Wikipedia result. | 33 # Click on the Wikipedia result. |
| 33 action_runner.Wait(1) | 34 action_runner.Wait(1) |
| 34 action_runner.TapElement(selector=self._RESULT_SELECTOR) | 35 action_runner.TapElement(selector=self._RESULT_SELECTOR) |
| 35 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 36 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 37 | |
| 38 class SearchOmniboxStory(system_health_story.SystemHealthStory): | |
| 39 NAME = 'search:google:omnibox' | |
| 40 URL = 'https://www.google.co.in' | |
| 41 | |
| 42 def RunPageInteractions(self, action_runner): | |
| 43 platform = action_runner.tab.browser.platform | |
| 44 package = action_runner.tab.browser.GetBrowserInfo().package_name | |
| 45 platform.system_ui.WaitForUiNode(resource_id=package+':id/url_bar') | |
| 46 url_bar = platform.system_ui.GetUiNode(resource_id=package+':id/url_bar') | |
| 47 url_bar.Tap() | |
| 48 action_runner.Wait(1) | |
| 49 # Enter system input as action_runner input does not work for browser | |
| 50 # activity. | |
| 51 platform.device.RunShellCommand(['input', 'text', 'drake'], | |
|
nednguyen
2017/03/31 08:56:55
Hmhh, this should be using https://github.com/cata
ssid
2017/04/04 03:43:48
Sorry I did not notice we have different action ru
perezju
2017/04/04 09:23:38
I've filed https://github.com/catapult-project/cat
| |
| 52 check_return=True) | |
| 53 action_runner.Wait(0.5) | |
| 54 platform.device.RunShellCommand(['input', 'keyevent', '66'], | |
| 55 check_return=True) | |
| 56 | |
| 57 action_runner.WaitForNavigate(15) | |
| 58 action_runner.ScrollPage(use_touch=True, distance=500) | |
| 59 | |
| 60 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| OLD | NEW |