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 system_health_story | 6 from page_sets.system_health import system_health_story |
7 | 7 |
8 from page_sets.login_helpers import google_login | 8 from page_sets.login_helpers import google_login |
9 from page_sets.login_helpers import pandora_login | 9 from page_sets.login_helpers import pandora_login |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 return int(minutes * 60 + seconds) | 51 return int(minutes * 60 + seconds) |
52 | 52 |
53 | 53 |
54 ################################################################################ | 54 ################################################################################ |
55 # Audio stories. | 55 # Audio stories. |
56 ################################################################################ | 56 ################################################################################ |
57 | 57 |
58 | 58 |
59 @benchmark.Disabled('all') # crbug.com/649392 | 59 @benchmark.Disabled('all') # crbug.com/649392 |
60 class GooglePlayMusicDesktopStory(_MediaStory): | 60 class GooglePlayMusicDesktopStory(_MediaStory): |
| 61 """Browse the songs list in music.google.com, then play a song.""" |
61 NAME = 'play:media:google_play_music' | 62 NAME = 'play:media:google_play_music' |
62 URL = 'https://music.google.com' | 63 URL = 'https://music.google.com' |
63 | 64 |
64 PLAY_SELECTOR = '.x-scope.paper-fab-0' | 65 PLAY_SELECTOR = '.x-scope.paper-fab-0' |
65 STOP_SELECTOR = '.style-scope.sj-play-button' | 66 STOP_SELECTOR = '.style-scope.sj-play-button' |
66 TIME_SELECTOR = '#time-container-current' | 67 TIME_SELECTOR = '#time-container-current' |
67 SEARCH_SELECTOR = '.title.fade-out.tooltip' | 68 SEARCH_SELECTOR = '.title.fade-out.tooltip' |
68 NAVIGATE_SELECTOR = '.description.tooltip.fade-out' | 69 NAVIGATE_SELECTOR = '.description.tooltip.fade-out' |
69 | 70 |
70 def _Login(self, action_runner): | 71 def _Login(self, action_runner): |
71 google_login.LoginGoogleAccount(action_runner, 'googletest', | 72 google_login.LoginGoogleAccount(action_runner, 'googletest', |
72 self.credentials_path) | 73 self.credentials_path) |
73 | 74 |
74 def _NavigateToMedia(self, action_runner): | 75 def _NavigateToMedia(self, action_runner): |
75 # Clicks on Today's top hits. | 76 # Clicks on Today's top hits. |
76 action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. | 77 action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. |
77 self._WaitForAndClickElementBySelector(action_runner, self.SEARCH_SELECTOR) | 78 self._WaitForAndClickElementBySelector(action_runner, self.SEARCH_SELECTOR) |
78 # Clicks on playlist. | 79 # Clicks on playlist. |
79 action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. | 80 action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. |
80 self._WaitForAndClickElementBySelector(action_runner, | 81 self._WaitForAndClickElementBySelector(action_runner, |
81 self.NAVIGATE_SELECTOR) | 82 self.NAVIGATE_SELECTOR) |
82 | 83 |
83 | 84 |
84 @benchmark.Disabled('win') # crbug.com/649392 | 85 @benchmark.Disabled('win') # crbug.com/649392 |
85 class SoundCloudDesktopStory(_MediaStory): | 86 class SoundCloudDesktopStory(_MediaStory): |
| 87 """Load soundcloud.com, search for "Smooth Jazz", then play a song.""" |
86 NAME = 'play:media:soundcloud' | 88 NAME = 'play:media:soundcloud' |
87 URL = 'https://soundcloud.com' | 89 URL = 'https://soundcloud.com' |
88 | 90 |
89 PLAY_SELECTOR = '.sc-button-play.playButton.sc-button.sc-button-xlarge' | 91 PLAY_SELECTOR = '.sc-button-play.playButton.sc-button.sc-button-xlarge' |
90 STOP_SELECTOR = '.playControl.playControls__icon.sc-ir.playing' | 92 STOP_SELECTOR = '.playControl.playControls__icon.sc-ir.playing' |
91 TIME_SELECTOR = '.playbackTimeline__timePassed>span[aria-hidden=true]' | 93 TIME_SELECTOR = '.playbackTimeline__timePassed>span[aria-hidden=true]' |
92 SEARCH_SELECTOR = '.headerSearch' | 94 SEARCH_SELECTOR = '.headerSearch' |
93 SEARCH_QUERY = 'SSmooth Jazz' # First S for some reason gets ommited. | 95 SEARCH_QUERY = 'SSmooth Jazz' # First S for some reason gets ommited. |
94 | 96 |
95 def _NavigateToMedia(self, action_runner): | 97 def _NavigateToMedia(self, action_runner): |
96 self._WaitForAndClickElementBySelector(action_runner, self.SEARCH_SELECTOR) | 98 self._WaitForAndClickElementBySelector(action_runner, self.SEARCH_SELECTOR) |
97 action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. | 99 action_runner.Wait(1) # Add 1 second wait to make the browsing realistic. |
98 action_runner.EnterText(self.SEARCH_QUERY) | 100 action_runner.EnterText(self.SEARCH_QUERY) |
99 action_runner.PressKey('Return') | 101 action_runner.PressKey('Return') |
100 | 102 |
101 | 103 |
102 @decorators.Disabled('all') # crbug.com/649392 | 104 @decorators.Disabled('all') # crbug.com/649392 |
103 class PandoraDesktopStory(_MediaStory): | 105 class PandoraDesktopStory(_MediaStory): |
| 106 """Load pandora.com, then play a song.""" |
104 NAME = 'play:media:pandora' | 107 NAME = 'play:media:pandora' |
105 URL = 'https://pandora.com' | 108 URL = 'https://pandora.com' |
106 | 109 |
107 PLAY_SELECTOR = None | 110 PLAY_SELECTOR = None |
108 STOP_SELECTOR = '.pauseButton' | 111 STOP_SELECTOR = '.pauseButton' |
109 TIME_SELECTOR = '.elapsedTime' | 112 TIME_SELECTOR = '.elapsedTime' |
110 SEARCH_SELECTOR = '.searchInput' | 113 SEARCH_SELECTOR = '.searchInput' |
111 | 114 |
112 def _Login(self, action_runner): | 115 def _Login(self, action_runner): |
113 pandora_login.LoginAccount(action_runner, 'pandora', self.credentials_path) | 116 pandora_login.LoginAccount(action_runner, 'pandora', self.credentials_path) |
114 | 117 |
115 def _NavigateToMedia(self, action_runner): | 118 def _NavigateToMedia(self, action_runner): |
116 pass # Audio autoplays on Pandora, no need to search. | 119 pass # Audio autoplays on Pandora, no need to search. |
OLD | NEW |