Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # encoding: utf-8 | 1 # encoding: utf-8 |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 from page_sets.system_health import platforms | 6 from page_sets.system_health import platforms |
| 7 from page_sets.system_health import story_tags | 7 from page_sets.system_health import story_tags |
| 8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
| 9 | 9 |
| 10 from page_sets.login_helpers import pinterest_login | 10 from page_sets.login_helpers import pinterest_login |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 if has_button: | 240 if has_button: |
| 241 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) | 241 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) |
| 242 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) | 242 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) |
| 243 | 243 |
| 244 | 244 |
| 245 ############################################################################## | 245 ############################################################################## |
| 246 # Search browsing stories. | 246 # Search browsing stories. |
| 247 ############################################################################## | 247 ############################################################################## |
| 248 | 248 |
| 249 | 249 |
| 250 @decorators.Disabled('win') # crbug.com/673775 | 250 class SearchGoogleStory(system_health_story.SystemHealthStory): |
| 251 class GoogleDesktopStory(_ArticleBrowsingStory): | 251 """ A typical Google search user story. |
|
perezju
2017/05/22 15:50:25
This story now removed. Replaced with the old "sea
nednguyen
2017/05/22 19:52:40
Why removing this instead of removing the old "sea
| |
| 252 """ | |
| 253 A typical google search story: | |
| 254 _ Start at https://www.google.com/search?q=flower | |
| 255 _ Click on the wikipedia link & navigate to | |
| 256 https://en.wikipedia.org/wiki/Flower | |
| 257 _ Scroll down the wikipedia page about flower. | |
| 258 _ Back to the search main page. | |
| 259 _ Refine the search query to 'flower delivery'. | |
| 260 _ Scroll down the page. | |
| 261 _ Click the next page result of 'flower delivery'. | |
| 262 _ Scroll the search page. | |
| 263 | 252 |
| 253 Issue the search query "what is science" in the search box and press Enter. | |
| 254 Wait for the search result page to be loaded, then scroll to the Wikipedia | |
| 255 result. | |
| 256 | |
| 257 Navigate to wikipedia page by clicking on the result and wait for it to be | |
| 258 fully loaded. | |
| 264 """ | 259 """ |
| 265 NAME = 'browse:search:google' | 260 NAME = 'browse:search:google' |
| 266 URL = 'https://www.google.com/search?q=flower' | 261 URL = 'https://www.google.co.uk/' |
| 262 TAGS = [story_tags.EMERGING_MARKET] | |
| 263 | |
| 267 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' | 264 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' |
| 268 _SEARCH_PAGE_2_SELECTOR = 'a[aria-label=\'Page 2\']' | 265 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' |
| 269 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | |
| 270 | 266 |
| 271 def _DidLoadDocument(self, action_runner): | 267 def _DidLoadDocument(self, action_runner): |
| 272 # Click on flower Wikipedia link. | |
| 273 action_runner.Wait(2) | |
| 274 action_runner.ClickElement(text='Flower - Wikipedia') | |
| 275 action_runner.WaitForNavigate() | |
| 276 | |
| 277 # Scroll the flower Wikipedia page, then navigate back. | |
| 278 action_runner.Wait(2) | |
| 279 action_runner.ScrollPage() | |
| 280 action_runner.Wait(2) | |
| 281 action_runner.NavigateBack() | |
| 282 | |
| 283 # Click on the search box. | 268 # Click on the search box. |
| 269 action_runner.Wait(1) | |
| 284 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR) | 270 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR) |
| 285 action_runner.ClickElement(selector=self._SEARCH_BOX_SELECTOR) | 271 action_runner.TapElement(selector=self._SEARCH_BOX_SELECTOR) |
| 286 action_runner.Wait(2) | |
| 287 | 272 |
| 288 # Submit search query. | 273 # Submit search query. |
| 289 action_runner.EnterText(' delivery') | 274 action_runner.Wait(1) |
| 275 action_runner.EnterText('what is science') | |
| 290 action_runner.Wait(0.5) | 276 action_runner.Wait(0.5) |
| 291 action_runner.PressKey('Return') | 277 action_runner.PressKey('Return') |
| 292 | 278 |
| 293 # Scroll down & click next search result page. | 279 # Scroll to the Wikipedia result. |
| 294 action_runner.Wait(2) | 280 action_runner.WaitForElement(selector=self._RESULT_SELECTOR) |
| 295 action_runner.ScrollPageToElement(selector=self._SEARCH_PAGE_2_SELECTOR) | 281 action_runner.Wait(1) |
| 296 action_runner.Wait(2) | 282 action_runner.ScrollPageToElement(selector=self._RESULT_SELECTOR) |
| 297 action_runner.ClickElement(selector=self._SEARCH_PAGE_2_SELECTOR) | 283 |
| 298 action_runner.Wait(2) | 284 # Click on the Wikipedia result. |
| 299 action_runner.ScrollPage() | 285 action_runner.Wait(1) |
| 286 action_runner.TapElement(selector=self._RESULT_SELECTOR) | |
| 287 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | |
| 300 | 288 |
| 301 | 289 |
| 302 class GoogleIndiaDesktopStory(_ArticleBrowsingStory): | 290 class GoogleIndiaDesktopStory(_ArticleBrowsingStory): |
| 303 """ | 291 """ |
| 304 A typical google search story in India: | 292 A typical google search story in India: |
| 305 1. Start at https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2` | 293 1. Start at https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2` |
| 306 2. Scroll down the page. | 294 2. Scroll down the page. |
| 307 3. Refine the query & click search box, which navigates to | 295 3. Refine the query & click search box, which navigates to |
| 308 https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2&rct=j#q=%E0%A4 %AB%E0%A5%82%E0%A4%B2+%E0%A4%B5%E0%A4%BF%E0%A4%A4%E0%A4%B0%E0%A4%A3 | 296 https://www.google.co.in/search?q=%E0%A4%AB%E0%A5%82%E0%A4%B2&rct=j#q=%E0%A4 %AB%E0%A5%82%E0%A4%B2+%E0%A4%B5%E0%A4%BF%E0%A4%A4%E0%A4%B0%E0%A4%A3 |
| 309 4. Scroll down the page. | 297 4. Scroll down the page. |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 779 # Reduce the speed (the current wpr is recorded with speed set to 50) when | 767 # Reduce the speed (the current wpr is recorded with speed set to 50) when |
| 780 # recording the wpr. If we scroll too fast, the data will not be recorded | 768 # recording the wpr. If we scroll too fast, the data will not be recorded |
| 781 # well. After recording reset it back to the original value to have a more | 769 # well. After recording reset it back to the original value to have a more |
| 782 # realistic scroll. | 770 # realistic scroll. |
| 783 action_runner.RepeatableBrowserDrivenScroll( | 771 action_runner.RepeatableBrowserDrivenScroll( |
| 784 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, | 772 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, |
| 785 repeat_count=3, speed=400, timeout=120) | 773 repeat_count=3, speed=400, timeout=120) |
| 786 action_runner.RepeatableBrowserDrivenScroll( | 774 action_runner.RepeatableBrowserDrivenScroll( |
| 787 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, | 775 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, |
| 788 repeat_count=3, speed=500, timeout=120) | 776 repeat_count=3, speed=500, timeout=120) |
| OLD | NEW |