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 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"