def link_cones(name1, name2):
     if Properties.if_ios():
         first_cone = ConesPage.return_cone_by_name(name1)
         second_cone = ConesPage.return_cone_by_name(name2)
         ConesPage.drag_cone_to_cone(second_cone, first_cone)
     else:
         ConesPage.link_or_unlink_cones(name1, name2)
 def unlink_cones(name1, name2):
     if Properties.if_ios():
         ConesPage.__swipe_from()
         second_cone = ConesPage.return_cone_by_name(name2)
         ConesPage.long_press_on_element(second_cone)
     else:
         ConesPage.link_or_unlink_cones(name1, name2)
Пример #3
0
 def play_next_set():
     if not Properties.if_ios():
         PlayListPage._swipe_to_next_set()
         PlayListPage.return_next_set_button().click()
     else:
         PlayListPage._swipe_to_similar_to_text()
         PlayListPage.swipe_down()
Пример #4
0
 def is_search_result_exists(name):
     if Properties.if_ios():
         return WebLink(
             Properties.get_play_list_page_locator_map().get_locator(
                 SearchPageLocators.resultChooser)).is_presented()
     return SearchPage.swipe_down_to_element(
         SearchPage.return_search_result(name).click())
 def get_screen_size():
     if Properties.if_ios():
         size = Searcher.get_driver().find_element_by_xpath(
             "//UIAApplication").size
     else:
         size = Searcher.get_driver().find_element_by_xpath("//*").size
     return size
Пример #6
0
    def get_expected_volume_after_changing(self, volume, steps=1):
        result = steps * TuneClient.VOLUME_APPLICATION_STEP_ANDROID
        from config_entries.Properties import Properties

        if Properties.if_ios():
            # volume changes on 3 db by step in ios
            result = steps * TuneClient.VOLUME_APPLICATION_STEP_IOS
        return volume + result
Пример #7
0
 def get_current_filter_type():
     if Properties.if_ios():
         element = WebLink(
             Properties.get_search_page_locator_map().get_locator(
                 SearchPageLocators.currentSearchType))
         return element.get_elements()[2].get_attribute("name")
     return WebLink(Properties.get_search_page_locator_map().get_locator(
         SearchPageLocators.currentSearchType)).get_text()
Пример #8
0
 def is_artists_type_exists():
     if Properties.if_ios():
         return WebLink(
             Properties.get_search_page_locator_map().get_locator(
                 SearchPageLocators.artistsSearchType)).is_presented()
     return SearchPage.swipe_down_to_element(
         WebLink(Properties.get_search_page_locator_map().get_locator(
             SearchPageLocators.artistsSearchType)))
Пример #9
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)
Пример #10
0
 def get_artist_from_search(number):
     artists = WebLink(Properties.get_search_page_locator_map().get_locator(
         SearchPageLocators.searchArtist))
     artist = artists.get_elements()
     if len(artist) <= number:
         return ''
     if Properties.if_ios():
         return artist[number].get_attribute('name')
     return artist[number].text
Пример #11
0
 def get_skips_left():
     if not Properties.if_ios():
         PlayListPage._swipe_to_similar_to_text()
     else:
         PlayListPage._swipe_to_next_track_btn()
     skip_field = PlayListPage.return_next_track_skips_left().get_text().encode('ascii','ignore')
     if skip_field == "You have no skips left":
         return 0
     else:
         return int(skip_field[9:11])
Пример #12
0
def preparation():
    for cone in range(Properties.get_cones().get_size()):
        Properties.get_cones().get_by_number(
            cone).get_comms_remote().uncluster()
        Properties.get_cones().get_by_number(
            cone).get_comms_remote().wait_for_unclustering()
        if Properties.if_ios():
            DeviceInstaller.uninstall_app_by_name()
    yield
    Searcher.reset_driver()
Пример #13
0
 def is_filter_type_exists(filter_type):
     if Properties.if_ios():
         element = WebLink(
             Properties.get_search_page_locator_map().get_locator(
                 SearchPageLocators.filterSearchType))
         element.locator.locator = element.locator.locator.replace(
             "TEXT_TO_CHANGE", filter_type)
         return element.is_presented()
     return SearchPage.swipe_down_to_element(
         WebLink(Properties.get_search_page_locator_map().get_locator(
             SearchPageLocators.artistsSearchType)))
Пример #14
0
 def get_playlist_content():
     """:rtype: list of framework_entries.Track.Track"""
     if Properties.if_ios():
         SearchPage.swipe_to_bottom()
     artists = WebLink(Properties.get_search_page_locator_map().get_locator(
         SearchPageLocators.playlistArtist))
     artists_list = artists.get_elements()
     size = len(artists_list)
     songs = []
     if not Properties.if_ios():
         tracks = WebLink(
             Properties.get_search_page_locator_map().get_locator(
                 SearchPageLocators.playlistTrack))
         tracks_list = tracks.get_elements()
         for i in range(size):
             songs.append(
                 Track.Track(artists_list[i].text, tracks_list[i].text))
     else:
         for i in range(size):
             songs.append(Track.Track(artists_list[i].text, ""))
     return songs
def uninstall_app_by_name(app_package='com.aether'):
    if Properties.if_ios():
        output = subprocess.Popen(['/usr/local/bin/ideviceinstaller', '-l'], stdout=subprocess.PIPE).communicate()[0]
        if app_package in output:
            subprocess.Popen(['/usr/local/bin/ideviceinstaller', '-U', 'com.aether.cone'], stdout=subprocess.PIPE)
            return True
        else:
            return False
    else:
        output = subprocess.Popen(["adb shell 'pm list packages -f'", " | grep aether"]).communicate()[0]
        if app_package in output:
            subprocess.Popen(['adb uninstall com.aether.aethercone'])
            return True
        else:
            return False
 def cones_settings_click(name):
     ConesPage.__swipe_from()
     if Properties.if_ios():
         ConesPage.return_settings_button().click()
         ConesPage.choose_by_name(name)
     else:
         locator = Properties.get_cones_page_locator_map().get_locator(
             ConesPageLocators.coneSettings)
         locator.locator = locator.locator.replace("TEXT_TO_CHANGE", name)
         settings_button = Button(locator)
         location = settings_button.get_location()
         size = settings_button.get_size()
         x = location["x"]
         y = location["y"] + size["height"] // 2
         Button(locator).click()
         ConesPage.tap_on(x, y)
 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")
Пример #18
0
 def get_test_cases_root(self):
     from config_entries.Properties import Properties
     os_mark = "Android"
     if Properties.if_ios():
         os_mark = "IOS"
     return self.__test_case[:1] + [os_mark] + self.__test_case[1:]
Пример #19
0
 def get_phase(self):
     from config_entries.Properties import Properties
     os_mark = "Android"
     if Properties.if_ios():
         os_mark = "IOS"
     return self.__phase[:2] + [os_mark] + self.__phase[2:]
Пример #20
0
 def decrease_volume_by_application_button(taps_quantity=1):
     if Properties.if_ios():
         for i in range(taps_quantity):
             Button(Properties.get_play_list_page_locator_map().get_locator(PlayListPageLocators.decreaseVolumeButton)).click()
     else:
         PlayListPage._decrease_volume_by_application_button(taps_quantity)
Пример #21
0
 def get_similar_to_text():
     if not Properties.if_ios():
         PlayListPage._swipe_to_similar_to_text()
     return PlayListPage.return_similar_to_text_input().get_text()
Пример #22
0
 def play_next_artist(number=0):
     if not Properties.if_ios():
         PlayListPage._swipe_to_next_artist()
     artists = WebLink(Properties.get_play_list_page_locator_map().get_locator(PlayListPageLocators.nextTracks))
     artist = artists.get_elements()[number]
     artist.click()
Пример #23
0
 def last_artist():
     if not Properties.if_ios():
         PlayListPage._swipe_to_last_artist()
     artists = WebLink(Properties.get_play_list_page_locator_map().get_locator(PlayListPageLocators.prevArtists))
     artist = artists.get_elements()[artists.get_elements().__len__() - 1]
     return artist.text
Пример #24
0
 def _swipe_to_last_track():
     if not Properties.if_ios():
         PlayListPage._swipe_to_current_artist()
     PlayListPage.swipe_up()
     PlayListPage.swipe_up_to_element(Button(Properties.get_play_list_page_locator_map().
                                             get_locator(PlayListPageLocators.prevTracks)))
Пример #25
0
 def next_track(number=0):
     if not Properties.if_ios():
         PlayListPage._swipe_to_next_track()
     tracks = WebLink(Properties.get_play_list_page_locator_map().get_locator(PlayListPageLocators.nextTracks))
     track = tracks.get_elements()[number]
     return track.text
Пример #26
0
 def search_track(search_string):
     InputField(Properties.get_search_page_locator_map().get_locator(
         SearchPageLocators.searchInput)).send_keys(search_string)
     if not Properties.if_ios():
         SearchPage.click_search_button_on_keyboard()
Пример #27
0
 def get_track():
     if not Properties.if_ios():
         PlayListPage._swipe_to_current_artist()
     return PlayListPage.return_current_track_input().get_text()