Example #1
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())
Example #2
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)))
Example #3
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()
Example #4
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
Example #5
0
def unlink_cones():
    for i in range(Properties.get_cones().get_size()):
        cone_comms = Properties.get_cones().get_by_number(i).get_comms_remote()
        if cone_comms.is_clustered():
            cone_comms.uncluster()
    yield
    for i in range(Properties.get_cones().get_size()):
        cone_comms = Properties.get_cones().get_by_number(i).get_comms_remote()
        if cone_comms.is_clustered():
            cone_comms.uncluster()
Example #6
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)))
 def create_test_execution(self, name, start_date, end_date):
     ret = 0
     try:
         rel_id = self.get_release()
         cycle = self.client.factory.create('remoteCycle')
         cycle.name = name
         cycle.build = Properties.get_zephyr_session().get_build()
         cycle.environment = Properties.get_external_parameters().get_firmware_version()
         cycle.startDate = start_date
         cycle.endDate = end_date
         cycle.releaseId = rel_id
         ret = self.client.service.createNewCycle(cycle, self.session)
     except Exception as e:
         print 'Error creating new test cycle: %s' % e
     return ret
 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)
 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 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)
Example #11
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()
 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
    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
Example #14
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)
 def get_project(self):
     project = Properties.get_zephyr_session().get_project()
     sc = self.get_search_criteria('', '', '')
     projects_list = self.client.service.getProjectsByCriteria(sc, 'true', self.session)
     for element in projects_list:
         if element.name == project:
             return element
     raise RuntimeError(
         "Zephyr integration error, unable to find project [" + project + "] in list " + projects_list.__str__())
 def get_release(self):
     release = Properties.get_zephyr_session().get_release()
     project = self.get_project()
     sc = self.get_search_criteria('', '', '')
     rr = self.client.service.getReleasesByCriteria(sc, 'true', self.session)
     for key in rr:
         if key.remoteProjectData.remoteData.name == project.name and key.name == release:
             return key
     raise RuntimeError(
         "Zephyr integration error, unable to find release [" + release + "] in list " + releases.__str__())
Example #17
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])
Example #18
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
Example #19
0
def fin(request):
    yield
    if not ZephyrTestOptions.is_reportable():
        return

    test_end = time.time()
    test_duration = request.node.rep_call.duration
    test_start = test_end - test_duration

    start_time = Properties.get_zephyr_session().get_start_time()
    build = Properties.get_zephyr_session().get_build()
    environment = Properties.get_external_parameters().get_firmware_version()
    test_cases_path = Properties.get_zephyr_session().get_test_cases_root()

    test_name = '%s.%s - %s' % (environment, build, start_time)

    zm = ZephyrManager()
    zm.login()

    test_case_tree = zm.get_test_case_tree(test_cases_path)
    zm.logout()
    ZephyrTestOptions.reset()
    """
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
Example #21
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()
 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_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())
Example #24
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:]
 def setup(self, desired_caps, driver_wait_time=30, alert_wait_time=15):
     self.driver = webdriver.Remote(
         Properties.get_external_parameters().get_remote_server_url(),
         desired_caps)
     self.driver_wait = WebDriverWait(self.driver, driver_wait_time)
     self.alert_wait = WebDriverWait(self.driver, alert_wait_time)
Example #26
0
 def get_password_field():
     return InputField(Properties.get_login_page_locator_map().get_locator(
         LoginPageLocators.passwordTextField))
Example #27
0
def free_user():
    """:rtype : config_entries.entries.User.User"""
    return Properties.get_users().get_free()
Example #28
0
def unlim_user():
    """:rtype : config_entries.entries.User.User"""
    return Properties.get_users().get_unlimited()
Example #29
0
def free_cone():
    """:rtype : framework_entries.cones.Cone.Cone"""
    return Properties.get_cones().get_by_number(2)
Example #30
0
 def get_login_button():
     return Button(Properties.get_login_page_locator_map().get_locator(
         LoginPageLocators.loginButton))