示例#1
0
def play_likes_playlist():
    PlayListPage.click_on_search()
    SearchPage.click_likes()
    tracks = SearchPage.get_playlist_content()
    SearchPage.swipe_to_play_this_playlist()
    SearchPage.play_this_playlist()
    return tracks
示例#2
0
def play_x_rdio_playlist(int_x='5'):
    PlayListPage.click_on_search()
    SearchPage.click_search_result_x(int_x)
    tracks = SearchPage.get_playlist_content()
    SearchPage.swipe_to_play_this_playlist()
    SearchPage.play_this_playlist()
    return tracks
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_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_radio_stream_not_counted():
    skip_count = PlayListPage.get_skips_left()
    search_string = "KQED"
    PlayListPage.click_on_search()
    SearchPage.search_track(search_string)
    SearchPage.choose_filter("radio")
    SearchPage.click_first_result()
    assert PlayListPage.get_skips_left(
    ) == skip_count, "Radio stream should NOT remove 'skip' from count"
示例#6
0
def search_dialogue():
    PlayListPage.click_on_search()
    yield
    while not PlayListPage.is_this_a_play_list_page():
        if Properties.if_ios():
            SearchPage.click_back()
        else:
            SearchPage.back()
        time.sleep(1)
示例#7
0
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"
示例#8
0
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"
示例#9
0
def test_play_on_separately(first_cone, second_cone, first_cone_tuned,
                            second_cone_tuned):
    if not first_cone.comms_remote.is_clustered(
    ) and not second_cone.comms_remote.is_clustered():
        ConesPage.link_cones(first_cone.get_name(), second_cone.get_name())
    ConesPage.unlink_cones_by_unlink_group(first_cone.get_name())
    ConesPage.choose_by_name(first_cone.get_name())
    PlayListPage.play()
    ConesPage.choose_by_name(second_cone.get_name())
    PlayListPage.play()
    assert first_cone_tuned.is_playing(), "First cone is not playing"
    assert second_cone_tuned.is_playing(), "Second cone is not playing"
    assert first_cone_tuned.get_json_status_track(
    ) is not second_cone_tuned.get_json_status_track(
    ), "Cones play the same track"
示例#10
0
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 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"
示例#13
0
def test_equalizer_change(first_cone, first_cone_tuned):
    PlayListPage.click_on_cones_list()
    ConesPage.cones_settings_click(first_cone.get_name())
    assert ConeSettingsPage.get_cone_name() == first_cone.get_name(
    ), "Wrong cone settings page"
    new_state = "Classical"
    ConeSettingsPage.set_equalizer(new_state)
    ConeSettingsPage.back()
    ConeSettingsPage.wait_for_equalizer_state(new_state)
    assert ConeSettingsPage.get_eq_status(
    ) == new_state, "Wrong eq state in app"
    assert first_cone_tuned.get_gain(
    ) == EqualizerGains.CLASSICAL, "Wrong eq state in cone"
    new_state = "Acoustic"
    ConeSettingsPage.set_equalizer(new_state)
    ConeSettingsPage.back()
    ConeSettingsPage.wait_for_equalizer_state(new_state)
    assert ConeSettingsPage.get_eq_status(
    ) == new_state, "Wrong eq state in app"
    assert first_cone_tuned.get_gain(
    ) == EqualizerGains.ACOUSTIC, "Wrong eq state in cone"
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_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
示例#16
0
def test_play_on_cluster(first_cone, second_cone, first_cone_tuned,
                         second_cone_tuned):
    if not first_cone.comms_remote.is_clustered(
    ) and not second_cone.comms_remote.is_clustered():
        ConesPage.link_cones(first_cone.get_name(), second_cone.get_name())
    assert ConesPage.is_master() and ConesPage.is_slave(
    ), "Cones are not clustered in UI"
    ConesPage.choose_by_name(first_cone.get_name())
    PlayListPage.play()
    assert first_cone.comms_remote.is_clustered(
    ) and second_cone.comms_remote.is_clustered(), "Cones are not clustered"
    assert first_cone_tuned.is_playing(), "First cone is not playing"
    assert second_cone_tuned.is_paused(), "Second cone is not paused"
    ConesPage.choose_by_name(second_cone.get_name())
    PlayListPage.pause()
    assert not PlayListPage.is_playing(), "Paused"
    assert first_cone_tuned.is_paused(), "First cone is playing"
    PlayListPage.play()
    assert PlayListPage.is_playing(), "Playing"
    assert first_cone_tuned.is_playing(), "First cone is not playing"
    assert second_cone_tuned.is_paused(), "Second cone is not paused"
def test_volume_change(first_cone_tuned, exit_volume_dialogue):
    first_cone_tuned.set_zero_volume()
    PlayListPage.click_on_change_volume()
    current_volume = 0
    assert first_cone_tuned.get_volume() == 0, "error of changing for cone's volume on the device"
    for i in range(1, 10):
        expected_volume = first_cone_tuned.get_expected_volume_after_changing(0, i)
        PlayListPage.increase_volume_by_application_button()
        current_volume = first_cone_tuned.get_volume()
        assert math_utils.in_range(current_volume, expected_volume, 0.01), "change in volume doesn't affect the cone"
    for i in range(1, 2):
        expected_volume = first_cone_tuned.get_expected_volume_after_changing(current_volume, -1)
        PlayListPage.decrease_volume_by_application_button()
        current_volume = first_cone_tuned.get_volume()
        assert math_utils.in_range(current_volume, expected_volume, 0.01), "change in volume doesn't affect the cone"
 def __swipe_from():
     if PlayListPage.return_play_pause_button().is_presented(15):
         if Properties.if_ios():
             if ConesPage.return_settings_button().is_visible(3):
                 locator = ConesPage.return_settings_button()
             else:
                 locator = ConesPage.return_done_button()
         else:
             locator = ConesPage.return_user_name_button()
         if locator.is_visible(5):
             # Cones page can disappear
             time.sleep(3)
             if locator.is_visible(3):
                 return
             ConesPage.swipe_right()
             time.sleep(3)
         else:
             ConesPage.swipe_right()
             time.sleep(3)
     else:
         raise RuntimeError(
             "Right SWIPE problem - unable to find  play/pause button")
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"
示例#20
0
def test_pause(first_cone_tuned):
    PlayListPage.pause()
    assert not PlayListPage.is_playing(), "Wrong app playing status"
    assert first_cone_tuned.is_paused(), "Wrong cone playing status"
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"
示例#22
0
def exit_volume_dialogue():
    yield
    PlayListPage.tap_on_screen_center()
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