def test_link_second_as_master(first_cone, second_cone, first_cone_tuned, second_cone_tuned): # UnLink cones check first = first_cone.get_name() second = second_cone.get_name() if first_cone.get_comms_remote().is_clustered(): ConesPage.unlink_cones(first, second) assert first_cone.get_comms_remote().wait_for_unclustering( ), "Preparation step failed" ConesPage.link_cones(second, first) assert first_cone.get_comms_remote().wait_for_clustering( ), "Clustering failed" assert first_cone.comms_remote.is_slave(), "First cone is not Slave" assert second_cone.comms_remote.is_master(), "Second cone is not Master"
def test_unlink_from_cone_settings(first_cone, first_cone_tuned, second_cone, second_cone_tuned, cone_settings_exit): 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.cones_settings_click(first_cone.get_name()) ConeSettingsPage.link_click(second_cone.get_name()) 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"
def test_link_from_cone_settings(first_cone, first_cone_tuned, second_cone, second_cone_tuned, cone_settings_exit): # Link cones check first = first_cone.get_name() second = second_cone.get_name() if first_cone.get_comms_remote().is_clustered(): ConesPage.unlink_cones(first, second) assert first_cone.get_comms_remote().wait_for_unclustering( ), "Preparation step failed" ConesPage.cones_settings_click(first_cone.get_name()) ConeSettingsPage.link_click(second_cone.get_name()) assert first_cone.get_comms_remote().is_clustered( ), "Cone " + first + " not clustered" assert second_cone.get_comms_remote().is_clustered( ), "Cone " + second + " not clustered"
def test_multicone_link(first_cone, second_cone): # Link cones check first = first_cone.get_name() second = second_cone.get_name() if first_cone.get_comms_remote().is_clustered(): ConesPage.unlink_cones(first, second) assert first_cone.get_comms_remote().wait_for_clustering_state_change( True, 10), "Preparation step failed" ConesPage.link_cones(first, second) first_cone.get_comms_remote().wait_for_clustering_state_change(False, 10) assert first_cone.get_comms_remote().is_clustered( ), "Cone " + first + " not clustered" assert second_cone.get_comms_remote().is_clustered( ), "Cone " + second + " not clustered"
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_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_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"
def test_equalizer_change(first_cone, first_cone_tuned): ConesPage.cones_settings_click(first_cone.get_name()) assert ConeSettingsPage.get_cone_name() == first_cone.get_name(), "Wrong cone settings page" new_state = "Classical" old_cone_eq = first_cone_tuned.get_gain() ConeSettingsPage.set_equalizer(new_state) for i in range(10): if not (first_cone_tuned.get_gain() == old_cone_eq): break time.sleep(1) # create app check when bug fixed # 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" old_cone_eq = first_cone_tuned.get_gain() ConeSettingsPage.set_equalizer(new_state) for i in range(10): if not (first_cone_tuned.get_gain() == old_cone_eq): break time.sleep(1) # create app check when bug fixed # 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_dummy_test(first_cone, second_cone): # Todo Dummy test should be removed after Clustering in Client works after log in. ConesPage.swipe_down() first = first_cone.get_comms_client().get_device_id() second = second_cone.get_comms_client().get_device_id() cones = Properties.get_cones() size = cones.get_size() master = None slave = None if first_cone.get_comms_remote().is_slave(): second_cone.get_comms_remote().uncluster() if second_cone.get_comms_remote().is_slave(): first_cone.get_comms_remote().uncluster() for i in range(size): if cones.get_by_number(i).get_comms_remote().is_master(): master = cones.get_by_number(i) if cones.get_by_number(i).get_comms_remote().is_slave(): slave = cones.get_by_number(i) if master is None: first_cone.get_comms_remote().cluster(first, second) return master.get_comms_remote().uncluster2( master.get_comms_client().get_device_id(), slave.get_comms_client().get_device_id())
def test_link_cone(first_cone, second_cone, first_cone_tuned, second_cone_tuned): if first_cone.comms_remote.is_clustered( ) and second_cone.comms_remote.is_clustered(): ConesPage.unlink_cones_by_unlink_group(first_cone.get_name()) 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" assert first_cone.comms_remote.is_master(), "First cone is not Master" assert second_cone.comms_remote.is_slave(), "Second cone is not Slave"
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_choose_cone(first_cone): ConesPage.choose_by_name(first_cone.get_name())
def cone_settings_exit(): yield ConeSettingsPage.back_click() ConesPage.done_click()