def test_next_track_click_and_previous_element_check(play_x_rdio_playlist, first_cone_tuned): previous_track = play_x_rdio_playlist[0].track previous_artist = play_x_rdio_playlist[0].artist next_playing_track = play_x_rdio_playlist[1].track next_playing_artist = play_x_rdio_playlist[1].artist # next track in list validation assert text_utils.smart_compare( next_playing_track, PlayListPage.next_track()), "Next list wrong track" # next track check PlayListPage.play_next_artist() assert PlayListPage.wait_for_track_change( previous_track), "Track never changed" actual = PlayListPage.get_track() expected = first_cone_tuned.get_json_status_track() assert text_utils.smart_compare(actual, expected), \ "Currently playing track from cone: and application are different: " + actual + " cone: " + expected assert text_utils.smart_compare(actual, next_playing_track), \ "Wrong currently playing track on Playlist page: ->" + actual + " expected: " + next_playing_track actual = PlayListPage.get_artist() assert text_utils.smart_compare(actual, next_playing_artist), \ "Wrong currently playing artist on Playlist page: ->" + actual + " expected: " + next_playing_artist # previous track check assert PlayListPage.last_artist( ) == previous_artist, "Last artist not appeared in list" assert PlayListPage.last_track( ) == previous_track, "Last track not appeared in list"
def test_play_from_likes(play_likes_playlist, first_cone_tuned): current_artist_expected = play_likes_playlist[0].artist current_artist_actual = PlayListPage.get_track() + '\n' + PlayListPage.get_artist() assert text_utils.smart_compare(current_artist_expected, current_artist_actual), "Wrong currently playing artist on Playlist page" current_artist_actual = first_cone_tuned.get_json_status_track() + "\n" + first_cone_tuned.get_json_status_artist() assert text_utils.smart_compare(current_artist_expected, current_artist_actual), "Wrong currently playing artist on cone"
def test_play_from_likes(play_likes_playlist, first_cone_tuned): current_track = play_likes_playlist[0].track current_artist = play_likes_playlist[0].artist assert text_utils.smart_compare(current_artist, PlayListPage.get_artist( )), "Wrong currently playing artist on Playlist page" assert text_utils.smart_compare(current_track, PlayListPage.get_track( )), "Wrong currently playing track on Playlist page" assert text_utils.smart_compare(PlayListPage.get_artist(), first_cone_tuned.get_json_status_artist() ), "Wrong currently playing artist on cone" assert text_utils.smart_compare(PlayListPage.get_track(), first_cone_tuned.get_json_status_track() ), "Wrong currently playing track on cone"
def test_play_next_track(first_cone_tuned): previous_track = PlayListPage.get_track() previous_artist = PlayListPage.get_artist() # checking of the next track PlayListPage.play_next_track() assert PlayListPage.wait_for_track_change(previous_track, 10), "Track never changed" actual = PlayListPage.get_track() expected = first_cone_tuned.get_json_status_track() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected actual = PlayListPage.get_artist() expected = first_cone_tuned.get_json_status_artist() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected
def test_play_list_details(first_cone_tuned): actual = PlayListPage.get_artist() expected = first_cone_tuned.get_json_status_artist() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing artist on Playlist page, page: " + actual + " cone: " + expected actual = PlayListPage.get_track() expected = first_cone_tuned.get_json_status_track() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected assert PlayListPage.get_playing_from() == "playing from Rdio", \ "Wrong 'playing from' source on Playlist page" actual = PlayListPage.get_similar_to_text() expected = "Similar to " + first_cone_tuned.get_json_status_artist() assert text_utils.smart_compare(actual, expected), \ "Wrong 'Similar to' link text on Playlist page, page: " + actual + " expected: " + expected
def wait_for_track_change(self, old_track_name, retries=5): for i in range(retries): if not text_utils.smart_compare(old_track_name, self.get_json_status_track()): return True time.sleep(1) return False
def test_rdio_skip_limit(free_cone_tuned): PlayListPage.reset_skips_left_count() prev_track = free_cone_tuned.get_json_status_track() assert PlayListPage.get_skips_left() == 6, "Skip counter did not reset" PlayListPage.play_next_track_btn() assert not text_utils.smart_compare( free_cone_tuned.get_json_status_track(), prev_track), "Track did not skip" assert PlayListPage.get_skips_left( ) == 5, "Skip counter did not subtract 1 skip" PlayListPage.play_next_track_btn() assert PlayListPage.get_skips_left( ) == 4, "Skip counter did not subtract 1 skip" PlayListPage.play_next_track_btn() assert PlayListPage.get_skips_left( ) == 3, "Skip counter did not subtract 1 skip" PlayListPage.play_next_track_btn() assert PlayListPage.get_skips_left( ) == 2, "Skip counter did not subtract 1 skip" PlayListPage.play_next_track_btn() time.sleep(5) PlayListPage.play_next_track_btn() assert PlayListPage.get_skips_left( ) == 0, "Skip counter did not subtract 1 skip" PlayListPage.play_next_track() assert PlayListPage.is_alert_present(), "Wrong alert message" PlayListPage.alert_accept_alt() PlayListPage.play_next_set() assert PlayListPage.get_skips_left() == 6, "Skip counter did not reset"
def wait_for_equalizer_state(new_state, retries=10): for i in range(retries): if text_utils.smart_compare(new_state, ConeSettingsPage.get_eq_status()): return True time.sleep(1) return False
def wait_for_track_change(old_track, retries=10): for i in range(retries): if PlayListPage.return_current_track_input().is_visible(): if not text_utils.smart_compare(old_track, PlayListPage.get_track()): return True time.sleep(1) return False
def test_more_info_page(more_info_dialogue, first_cone_tuned): first_cone_tuned.play_track_from_id('rdio://t2748953') # track: You Never Can Tell (1964 Single Version / Mono) PlayListPage.swipe_left() # TODO: TUNE-6940, navigation away from cloud search... aka no artist bio info from wikipedia # assert MoreInfoPage.get_description().__contains__( # "Chuck" and "born October 18, 1926"), "Incorrect artist description" assert text_utils.smart_compare(MoreInfoPage.get_albums_section(), "top albums"), "No top albums section" assert MoreInfoPage.get_top_tracks_section().__contains__("top tracks"), "No top tracks section"
def test_play_from_next_list(play_likes_playlist, first_cone_tuned): previous_track = PlayListPage.get_track() # checking of the next track PlayListPage._swipe_to_next_artist() # the test failed due to radio not having a 'artist' element and _swipe_to was too big. PlayListPage.play_next_track() assert PlayListPage.wait_for_track_change(previous_track, 10), "Track never changed" actual = PlayListPage.get_track() + "\n" + PlayListPage.get_artist() expected = play_likes_playlist[1].artist assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " expected from next list: " + expected actual = PlayListPage.get_track() expected = first_cone_tuned.get_json_status_track() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected actual = PlayListPage.get_artist() expected = first_cone_tuned.get_json_status_artist() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected
def test_next_set(first_cone_tuned): prev_set = first_cone_tuned.get_set() next_set = first_cone_tuned.get_next_set() prev_track = PlayListPage.get_track() prev_artist = PlayListPage.get_artist() PlayListPage.play_next_set() PlayListPage.wait_for_track_change(prev_track) assert not text_utils.smart_compare(PlayListPage.get_track(), prev_track), "Track didn't switch" assert not text_utils.smart_compare(PlayListPage.get_artist(), prev_artist), "Artist didn't switch" actual = PlayListPage.get_track() expected = first_cone_tuned.get_json_status_track() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected actual = PlayListPage.get_track() expected = first_cone_tuned.get_json_status_track() assert text_utils.smart_compare(actual, expected), \ "Wrong currently playing track on Playlist page, page: " + actual + " cone: " + expected actual = first_cone_tuned.get_set() assert actual != prev_set, "Set not changed" assert actual == next_set, "Wrong next set"
def test_no_selectable_prev_tracks(free_cone_tuned): free_cone_tuned.next_set() time.sleep(10) current_track = free_cone_tuned.get_json_status_track() free_cone_tuned.next_track() PlayListPage._swipe_to_last_track() PlayListPage.return_prev_track_button().click() assert PlayListPage.is_alert_present( ), "Error, no alert popup for prev tracks" PlayListPage.alert_accept_alt() assert not text_utils.smart_compare( free_cone_tuned.get_json_status_track(), current_track), "Error, prev track was played"
def test_search_triggered_modal(): # add fixture to force app out of 'search' page if previous test fails PlayListPage.click_on_search() search_text = "gold on the ceiling" SearchPage.search_track(search_text) SearchPage.choose_filter('track') SearchPage.is_filter_type_exists('tracks') SearchPage.is_search_result_exists('Gold on The Ceiling') SearchPage.click_first_result() assert PlayListPage.is_alert_present( ), "Error, no alert popup for prev tracks" PlayListPage.alert_accept_alt() assert text_utils.smart_compare(PlayListPage.get_alert_text(), "You'll need an Rdio Unlimited account to request a specific song. Visit" " rdio.com to upgrade. Meanwhile, Cone will play something similar."), "Wrong " \ "alert " \ "message"
def test_multicone_unlink(first_cone, second_cone, first_cone_tuned, second_cone_tuned): # UnLink cones check first = first_cone.get_name() second = second_cone.get_name() if not first_cone.get_comms_remote().is_clustered(): ConesPage.link_cones(first, second) assert first_cone.get_comms_remote().wait_for_clustering_state_change( False, 10), "Preparation step failed" ConesPage.unlink_cones(first, second) first_cone.get_comms_remote().wait_for_clustering_state_change(True, 10) assert not first_cone.get_comms_remote().is_clustered( ), "Cone " + first + " not clustered" assert not second_cone.get_comms_remote().is_clustered( ), "Cone " + second + " not clustered" # When unclustered cones should play unicue content first = first_cone_tuned.get_json_status_artist() second = second_cone_tuned.get_json_status_artist() assert not text_utils.smart_compare(first, second), \ "Cones playing same content after unclustering"
def test_next_track_list(play_likes_playlist): PlayListPage._swipe_to_current_artist() i = 1 while i < play_likes_playlist.__len__(): assert text_utils.smart_compare(play_likes_playlist[i].artist, PlayListPage.next_track(i-1)), "Wrong tack in next tracks playlist" i = i + 1