def test_music_album_mp3(self): """ https://moztrap.mozilla.org/manage/case/4031/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() self.take_screenshot() # switch to albums view list_view = music_app.tap_albums_tab() self.take_screenshot() # check that albums (at least one) are available albums = list_view.media self.assertGreater(len(albums), 0, 'The mp3 file could not be found') # select an album sublist_view = albums[0].tap_first_album() self.take_screenshot() # select play # This wait is timing out because of bug 862156 player_view = sublist_view.tap_play() # play for a short duration play_time = time.strptime('00:03', '%M:%S') Wait(self.marionette).until( lambda m: player_view.player_elapsed_time >= play_time, message='Mp3 sample did not start playing') ff_button = self.marionette.find_element(*self._player_controls_next_locator) Actions(self.marionette).tap(ff_button).perform() self.take_screenshot()
def test_music_change_rating(self): """ https://moztrap.mozilla.org/manage/case/2683/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view, and play the first one on the list list_view = music_app.tap_songs_tab() songs = list_view.media self.assertGreater(len(songs), 0, 'The ogg file could not be found') player_view = songs[0].tap_first_song() # wait until the player view is shown, then pause the play play_time = time.strptime('00:02', '%M:%S') Wait(self.marionette).until( lambda m: player_view.player_elapsed_time >= play_time) player_view.tap_play() self.assertFalse(player_view.is_player_playing(), 'The player did not stop playing') # give rating of 4 player_view.tap_star(4) player_view.tap_cover_in_player_view( ) # tap again in case the overlay disappears due to timeout Wait(self.marionette).until(lambda m: player_view.star_rating == 4) #change the rating to 1 player_view.tap_star(1) player_view.tap_cover_in_player_view( ) # tap again in case the overlay disappears due to timeout Wait(self.marionette).until(lambda m: player_view.star_rating == 1)
def test_music_change_rating(self): """ https://moztrap.mozilla.org/manage/case/2683/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view, and play the first one on the list list_view = music_app.tap_songs_tab() songs = list_view.media self.assertGreater(len(songs), 0, 'The ogg file could not be found') player_view = songs[0].tap_first_song() # wait until the player view is shown, then pause the play play_time = time.strptime('00:02', '%M:%S') Wait(self.marionette).until(lambda m: player_view.player_elapsed_time >= play_time) player_view.tap_play() self.assertFalse(player_view.is_player_playing(), 'The player did not stop playing') # give rating of 4 player_view.tap_star(4) player_view.tap_cover_in_player_view() # tap again in case the overlay disappears due to timeout Wait(self.marionette).until(lambda m: player_view.star_rating == 4) #change the rating to 1 player_view.tap_star(1) player_view.tap_cover_in_player_view() # tap again in case the overlay disappears due to timeout Wait(self.marionette).until(lambda m: player_view.star_rating == 1)
def test_music_album_mp3(self): """ https://moztrap.mozilla.org/manage/case/4031/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() self.take_screenshot() # switch to albums view list_view = music_app.tap_albums_tab() self.take_screenshot() # check that albums (at least one) are available albums = list_view.media self.assertGreater(len(albums), 0, 'The mp3 file could not be found') # select an album sublist_view = albums[0].tap_first_album() self.take_screenshot() # select play # This wait is timing out because of bug 862156 player_view = sublist_view.tap_play() # play for a short duration play_time = time.strptime('00:03', '%M:%S') Wait(self.marionette).until( lambda m: player_view.player_elapsed_time >= play_time, message='Mp3 sample did not start playing') ff_button = self.marionette.find_element( *self._player_controls_next_locator) Actions(self.marionette).tap(ff_button).perform() self.take_screenshot()
def test_music_songs_3gp(self): """https://moztrap.mozilla.org/manage/case/4031/""" music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() self.take_screenshot() # switch to songs view list_view = music_app.tap_songs_tab() # check that songs (at least one) are available songs = list_view.media self.assertGreater(len(songs), 0, 'The 3gp file could not be found') self.take_screenshot() player_view = songs[0].tap_first_song() play_time = time.strptime('00:03', '%M:%S') Wait(self.marionette).until( lambda m: player_view.player_elapsed_time >= play_time, message='3gp sample did not start playing') # validate playback self.assertTrue(player_view.is_player_playing(), 'The player is not playing') # select stop, then FF to the end of the song player_view.tap_play() ff_button = self.marionette.find_element(*self._player_controls_next_locator) Actions(self.marionette).tap(ff_button).perform() self.take_screenshot()
def test_select_songs_play_3gp_file(self): """https://moztrap.mozilla.org/manage/case/4031/""" music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view list_view = music_app.tap_songs_tab() # check that songs (at least one) are available songs = list_view.media self.assertGreater(len(songs), 0, 'The 3gp file could not be found') player_view = songs[0].tap_first_song() play_time = time.strptime('00:03', '%M:%S') self.wait_for_condition( lambda m: player_view.player_elapsed_time >= play_time, timeout=10, message='3gp sample did not start playing') # validate playback self.assertTrue(player_view.is_player_playing(), 'The player is not playing') # select stop player_view.tap_play() # validate stopped playback self.assertFalse(player_view.is_player_playing(), 'The player did not stop playing')
def test_select_songs_play_3gp_file(self): """https://moztrap.mozilla.org/manage/case/4031/""" music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view list_view = music_app.tap_songs_tab() # check that songs (at least one) are available songs = list_view.media self.assertGreater(len(songs), 0, 'The 3gp file could not be found') player_view = songs[0].tap_first_song() play_time = time.strptime('00:03', '%M:%S') self.wait_for_condition( lambda m: player_view.player_elapsed_time >= play_time, timeout=10, message='3gp sample did not start playing') # validate playback self.assertTrue(player_view.is_player_playing(), 'The player is not playing') # select stop player_view.tap_play() # validate stopped playback self.assertFalse(player_view.is_player_playing(), 'The player did not stop playing')
def test_music_share_ringtone(self): """ https://moztrap.mozilla.org/manage/case/2683/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view, and play the first one on the list list_view = music_app.tap_songs_tab() songs = list_view.media self.assertGreater(len(songs), 0, 'The ogg file could not be found') player_view = songs[0].tap_first_song() # wait until the player view is shown, then tap the share button play_time = time.strptime('00:01', '%M:%S') Wait(self.marionette).until(lambda m: player_view.player_elapsed_time >= play_time) activities = player_view.tap_share_button() ringtone = activities.share_to_ringtones() ringtone.tap_save() system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed(message="Ringtone set as default.") system.wait_for_notification_toaster_not_displayed() settings = Settings(self.marionette) settings.launch() sound = settings.open_sound() # desktop b2g doesn't have this option visible, see bug 1130538 if sound.ring_tone_selector_visible: self.assertEqual(sound.current_ring_tone, 'MUS_0001')
def test_select_album_play(self): music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() list_view = music_app.a11y_click_albums_tab() # check that albums (at least one) are available albums = list_view.media self.assertGreater(len(albums), 0, 'The mp3 file could not be found') # select an album by click sublist_view = albums[0].a11y_click_first_album() element = Wait(self.marionette).until( expected.element_present(*sublist_view._play_control_locator)) Wait(self.marionette).until(expected.element_displayed(element)) self.assertTrue(self.accessibility.is_visible(element))
def test_select_album_play(self): music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() list_view = music_app.a11y_click_albums_tab() # check that albums (at least one) are available albums = list_view.media self.assertGreater(len(albums), 0, 'The mp3 file could not be found') # select an album by click sublist_view = albums[0].a11y_click_first_album() element = Wait(self.marionette).until( expected.element_present(*sublist_view._play_control_locator)) Wait(self.marionette).until(expected.element_displayed(element)) self.assertTrue(self.accessibility.is_visible(element))
def test_music_songs_tileview_fullplay(self): """ play a song until the end in the tile view """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() self.take_screenshot() songs = TileView(self.marionette) main_song_player_view = songs.tap_main_song() play_time = time.strptime('00:20', '%M:%S') Wait(self.marionette, timeout=30).until( lambda m: main_song_player_view.player_elapsed_time >= play_time, message='song did not reach the end') music_app.wait_for_music_tiles_displayed() self.take_screenshot() # Once the song is done, it'll return to the tile view sub_song_player_view = songs.tap_sub_song(0) play_time = time.strptime('00:10', '%M:%S') Wait(self.marionette, timeout=20).until( lambda m: sub_song_player_view.player_elapsed_time >= play_time, message = 'song did not reach the end') music_app.wait_for_music_tiles_displayed() self.take_screenshot()
def test_select_artist_play(self): """ https://moztrap.mozilla.org/manage/case/4031/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to artists view list_view = music_app.tap_artists_tab() # check that artists (at least one) are available artists = list_view.media self.assertGreater(len(artists), 0, 'The mp3 file could not be found') # select an artist sublist_view = artists[0].tap_first_artist() # select play # This wait is timing out because of bug 862156 player_view = sublist_view.tap_play() # play for a short duration play_time = time.strptime('00:03', '%M:%S') self.wait_for_condition( lambda m: player_view.player_elapsed_time >= play_time, timeout=10, message='Mp3 sample did not start playing') # validate playback self.assertTrue(player_view.is_player_playing(), 'The player is not playing') # select stop player_view.tap_play() # validate stopped playback self.assertFalse(player_view.is_player_playing(), 'The player did not stop playing')
def test_music_songview_fullplay(self): """ play a song until the end in the song list view """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() import time # need to wait until the scroll bar disappears time.sleep(2) self.take_screenshot() # switch to songs view and play it from there too list_view = music_app.tap_songs_tab() music_app.wait_for_view_displayed("Songs") self.take_screenshot() songs = list_view.media from_list_player_view = songs[0].tap_first_song() play_time = time.strptime("00:20", "%M:%S") Wait(self.marionette, timeout=30).until( lambda m: from_list_player_view.player_elapsed_time >= play_time, message="song did not reach the end" ) # wait until next song kicks in (elapsed time will reset) Wait(self.marionette, timeout=30).until( lambda m: from_list_player_view.player_elapsed_time < play_time, message="next song did not start" ) # once the first song completes, it will play the next song automatically play_time = time.strptime("00:13", "%M:%S") Wait(self.marionette, timeout=20).until( lambda m: from_list_player_view.player_elapsed_time >= play_time, message="song did not reach the end" ) music_app.wait_for_view_displayed("Songs") self.take_screenshot()
def test_select_album_play(self): """ https://moztrap.mozilla.org/manage/case/3755/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to albums view list_view = music_app.tap_albums_tab() # check that albums (at least one) are available albums = list_view.media self.assertGreater(len(albums), 0, 'The mp3 file could not be found') # select an album sublist_view = albums[0].tap_first_album() # select play # This wait is timing out because of bug 862156 player_view = sublist_view.tap_play() # play for a short duration play_time = time.strptime('00:03', '%M:%S') self.wait_for_condition( lambda m: player_view.player_elapsed_time >= play_time, timeout=10, message='Mp3 sample did not start playing') # validate playback self.assertTrue(player_view.is_player_playing(), 'The player is not playing') # select stop player_view.tap_play() # validate stopped playback self.assertFalse(player_view.is_player_playing(), 'The player did not stop playing')
def test_music_songview_fullplay(self): """ play a song until the end in the song list view """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() import time # need to wait until the scroll bar disappears time.sleep(2) self.take_screenshot() # switch to songs view and play it from there too list_view = music_app.tap_songs_tab() music_app.wait_for_view_displayed('Songs') self.take_screenshot() songs = list_view.media from_list_player_view = songs[0].tap_first_song() play_time = time.strptime('00:20', '%M:%S') Wait(self.marionette, timeout=30).until( lambda m: from_list_player_view.player_elapsed_time >= play_time, message='song did not reach the end') # wait until next song kicks in (elapsed time will reset) Wait(self.marionette, timeout = 30).until( lambda m: from_list_player_view.player_elapsed_time < play_time, message='next song did not start') # once the first song completes, it will play the next song automatically play_time = time.strptime('00:13', '%M:%S') Wait(self.marionette, timeout=20).until( lambda m: from_list_player_view.player_elapsed_time >= play_time, message='song did not reach the end') music_app.wait_for_view_displayed('Songs') self.take_screenshot()