예제 #1
0
    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)
예제 #3
0
    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()
예제 #4
0
    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')
예제 #5
0
    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')
예제 #6
0
    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_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()
예제 #8
0
    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()