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 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 class BlankAboutBlankStory(system_health_story.SystemHealthStory): |
| 15 class SearchGoogleStory(system_health_story.SystemHealthStory): | 15 """Story that loads the about:blank page.""" |
|
perezju
2017/05/22 15:50:25
This story now moved to browsing_stories.py
| |
| 16 """ A typical Google search user story. | 16 NAME = 'load:chrome:blank' |
| 17 Issue the search query "what is science" in the search box and press Enter. | 17 URL = 'about:blank' |
| 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 """ | |
| 23 NAME = 'search:portal:google' | |
| 24 URL = 'https://www.google.co.uk/' | |
| 25 TAGS = [story_tags.EMERGING_MARKET] | |
| 26 | |
| 27 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' | |
| 28 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' | |
| 29 | 18 |
| 30 def _DidLoadDocument(self, action_runner): | 19 def _DidLoadDocument(self, action_runner): |
| 31 # Click on the search box. | 20 # Request a RAF and wait for it to be processed to ensure that the metric |
| 32 action_runner.Wait(1) | 21 # Startup.FirstWebContents.NonEmptyPaint2 is recorded. |
| 33 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR) | 22 action_runner.ExecuteJavaScript( |
| 34 action_runner.TapElement(selector=self._SEARCH_BOX_SELECTOR) | 23 """ |
| 35 | 24 window.__hasRunRAF = false; |
| 36 # Submit search query. | 25 requestAnimationFrame(function() { |
| 37 action_runner.Wait(1) | 26 window.__hasRunRAF = true; |
| 38 action_runner.EnterText('what is science') | 27 }); |
| 39 action_runner.Wait(0.5) | 28 """ |
| 40 action_runner.PressKey('Return') | 29 ) |
| 41 | 30 action_runner.WaitForJavaScriptCondition("window.__hasRunRAF") |
| 42 # Scroll to the Wikipedia result. | |
| 43 action_runner.WaitForElement(selector=self._RESULT_SELECTOR) | |
| 44 action_runner.Wait(1) | |
| 45 action_runner.ScrollPageToElement(selector=self._RESULT_SELECTOR) | |
| 46 | |
| 47 # Click on the Wikipedia result. | |
| 48 action_runner.Wait(1) | |
| 49 action_runner.TapElement(selector=self._RESULT_SELECTOR) | |
| 50 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | |
| 51 | 31 |
| 52 | 32 |
| 53 @decorators.Disabled('android-webview') # Webview does not have omnibox | 33 @decorators.Disabled('android-webview') # Webview does not have omnibox |
| 54 class SearchOmniboxStory(system_health_story.SystemHealthStory): | 34 class SearchOmniboxStory(system_health_story.SystemHealthStory): |
| 55 """Story that peforms search by using omnibox search provider | 35 """Story that peforms search by using omnibox search provider |
| 56 | 36 |
| 57 Loads a website and enters a search query on omnibox and navigates to default | 37 Loads a website and enters a search query on omnibox and navigates to default |
| 58 search provider (google). | 38 search provider (google). |
| 59 """ | 39 """ |
| 60 NAME = 'browse:chrome:omnibox' | 40 NAME = 'browse:chrome:omnibox' |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 platform.android_action_runner.InputText(keyword) | 85 platform.android_action_runner.InputText(keyword) |
| 106 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER) | 86 platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER) |
| 107 action_runner.WaitForNavigate() | 87 action_runner.WaitForNavigate() |
| 108 action_runner.Wait(1.5) # Read results | 88 action_runner.Wait(1.5) # Read results |
| 109 action_runner.ScrollPage(use_touch=True) | 89 action_runner.ScrollPage(use_touch=True) |
| 110 action_runner.NavigateBack() | 90 action_runner.NavigateBack() |
| 111 action_runner.WaitForNavigate() | 91 action_runner.WaitForNavigate() |
| 112 | 92 |
| 113 app_ui.WaitForUiNode(resource_id='menu_button').Tap() | 93 app_ui.WaitForUiNode(resource_id='menu_button').Tap() |
| 114 app_ui.WaitForUiNode(resource_id='menu_item_text') | 94 app_ui.WaitForUiNode(resource_id='menu_item_text') |
| OLD | NEW |