Пример #1
0
def savebutton(driver):
    if len(
            driver.find_elements(
                By.XPATH, "//android.widget.TextView[@text='Save']")) > 0:
        driver.find_element_by_xpath(
            "//android.widget.TextView[@text='Save']").click()
    elif len(
            driver.find_elements(By.ID,
                                 "com.view.viewglass:id/save_zoneGrpTV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/save_zoneGrpTV").click()
    elif len(
            driver.find_elements(By.ID,
                                 "com.view.viewglass:id/editbtn_sceneTV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/editbtn_sceneTV").click()
    elif len(
            driver.find_elements(
                By.ID,
                "com.view.viewglass:id/save_scene_add_TintEventTV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/save_scene_add_TintEventTV").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/savebtn_sceneEventTV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/savebtn_sceneEventTV").click()
    else:
        raiseExceptions("Save button is missing")
Пример #2
0
    def testVerifyUIComponentsOfSceneScreen(self):
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        commonFunctions.navIcon(self.driver)
        try:
            WebDriverWait(self.driver, 60).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_scenesTV")))
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_scenesTV").click()
        except TimeoutException:
            raiseExceptions("Scenes option in navigation menu is missing")

        try:
            WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/scene_headertext")))
        except TimeoutException:
            raiseExceptions("Scenes heading is missing")
        commonFunctions.navIcon(self.driver)
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/view_btnTV")) <= 0:
            raiseExceptions("Navigation icon in Scenes screen is missing")
        commonFunctions.navIcon(self.driver)

        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/scene_addIconIV")) <= 0:
            raiseExceptions("Add icon in Scenes screen is missing")
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/desc_SceneItemTV")) <= 0:
            raiseExceptions(
                "Number of zones each scene is applied to is missing")
Пример #3
0
    def testUIAccessAfterSunset(self):
        """
        Login to app after sunset time and verify the accessibility of LiveView
        """
        now = datetime.now()
        sunset = datetime.strptime("06:00 PM", '%I:%M %p')
        if now < sunset:
            print("Cannot test because it is not after sunset yet")
        else:
            auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
            if len(
                    self.driver.find_elements(
                        By.ID, "com.view.viewglass:id/title_LiveViewTV")) <= 0:
                commonFunctions.navIcon(self.driver)
                if WebDriverWait(self.driver, 10).until(
                        EC.presence_of_element_located(
                            (By.ID,
                             "com.view.viewglass:id/navigation_live_viewTV"))):
                    self.driver.find_element_by_id(
                        "com.view.viewglass:id/navigation_live_viewTV").click(
                        )
                else:
                    raiseExceptions(
                        "LiveView option in navigation menu is missing")

            if len(
                    self.driver.find_elements(
                        By.ID, "com.view.viewglass:id/title_LiveViewTV")) <= 0:
                raiseExceptions("Unable to access LiveView after sunset")
Пример #4
0
    def testSelectSiteForCRUDOUser(self):
        """
        Verify the by logging using valid CRUDO privilege user
        """
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO')
        auth.login(self.driver, config.users['CRUDO']['username'],
                   config.users['CRUDO']['password'])

        try:
            WebDriverWait(self.driver, 50).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/search_image_view")))
            search = self.driver.find_element_by_id(
                "com.view.viewglass:id/search_image_view")
            search.click()
            search_text = self.driver.find_element_by_id(
                "com.view.viewglass:id/search_site_edit_text")
            # search for the site and press ENTER
            search_text.send_keys(config.sites['Default'])
            # self.self.driver.press_keycode(66)
            size = self.driver.find_element_by_id(
                "com.view.viewglass:id/viewLogoLL").size
            location = self.driver.find_element_by_id(
                "com.view.viewglass:id/viewLogoLL").location
            x = size['width'] / 2
            y = location['y'] + size['height'] * 2
            self.driver.tap([(x, y)])
            if len(
                    self.driver.find_elements(
                        By.ID, "com.view.viewglass:id/viewLogoLL")) > 0:
                y = location['y'] + size['height'] * 2.5
                self.driver.tap([(x, y)])
        except TimeoutException:
            raiseExceptions("Failed to reach Select Site screen")
Пример #5
0
    def check_data():
        query = """
        select count(id) FROM laborum
        """

        query2 = """
        select count(id) FROM get_on_board
        """
        # Connection for laborum
        conn = sqlite3.connect('laborum.sqlite')
        cursor = conn.cursor()
        result1 = cursor.execute(query)
        # Connection for get_on_boars
        conn2 = sqlite3.connect('get_on_board.sqlite')
        cursor2 = conn2.cursor()
        result2 = cursor2.execute(query2)

        # Just check if there are more than 0 results for all db
        if result1.fetchone()[0] > 0 and result2.fetchone()[0] > 0:
            print('extraccion correcta')

        else:
            raiseExceptions('Extraccion Erronea')

        conn.close()
        conn2.close()
Пример #6
0
def goback(driver):
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/backBtn_schdTintTV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/backBtn_schdTintTV").click()
    elif len(
            driver.find_elements(
                By.ID,
                "com.view.viewglass:id/backBtn_allZonesSelectLL']")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/backBtn_allZonesSelectLL']").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/backBtn_schdSTintLL']")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/backBtn_schdSTintLL']").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/home_btn_myProfileLL")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/home_btn_myProfileLL").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/back_copy_tint_eventIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/back_copy_tint_eventIV").click()
    elif len(
            driver.find_elements(
                By.ID,
                "com.view.viewglass:id/back_btn_create_newZoneGrpIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/back_btn_create_newZoneGrpIV").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/backBtn_zngrpdetailLL")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/backBtn_zngrpdetailLL").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/back_scene_detailLL")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/back_scene_detailLL").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/back_scene_eventLL")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/back_scene_eventLL").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/back_btn_settingIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/back_btn_settingIV").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/back_btn_settingscreenIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/back_btn_settingscreenIV").click()
    else:
        raiseExceptions("Back button is missing")
Пример #7
0
    def testCreateWeeklySceneSchedule(self):
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        commonFunctions.navIcon(self.driver)
        if WebDriverWait(self.driver, 60).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_scenesTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_scenesTV").click()
        else:
            raiseExceptions("Scenes option in navigation menu is missing")

        WebDriverWait(self.driver, 20).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scene_headertext")))
        selectedScene = self.driver.find_elements(
            By.ID, "com.view.viewglass:id/parent_scene_item")[0]
        selectedScene.click()

        if WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/schedule_scene_TV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/schedule_scene_TV").click()
        else:
            raiseExceptions("Schedule Scene button is missing")

        self.driver.find_element_by_id(
            "com.view.viewglass:id/repeats_schdSceneTintTV").click()
        self.driver.find_element_by_xpath(
            "//android.widget.TextView[@text='Weekly']").click()
        commonFunctions.savebutton(self.driver)
Пример #8
0
    def testEditScene(self):
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        commonFunctions.navIcon(self.driver)
        if WebDriverWait(self.driver, 60).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_scenesTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_scenesTV").click()
        else:
            raiseExceptions("Scenes option in navigation menu is missing")

        WebDriverWait(self.driver, 20).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scene_headertext")))
        firstScene = self.driver.find_elements(
            By.ID, "com.view.viewglass:id/parent_scene_item")[0]
        firstScene.click()

        WebDriverWait(self.driver, 20).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scene_Detail")))
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/editbtn_sceneTV")) <= 0:
            raiseExceptions("Edit button in Scenes Detail screen is missing")
        else:
            commonFunctions.editbutton(self.driver)

        self.driver.find_element_by_id(
            "com.view.viewglass:id/name_scene_editETV").send_keys("abc")
        commonFunctions.goback(self.driver)
        commonFunctions.goback(self.driver)
Пример #9
0
def isUserLoggedIn(driver):
    sleep(20)
    if len(driver.find_elements(By.ID, "com.view.viewglass:id/retry_btn")) > 0:
        driver.find_element_by_id("com.view.viewglass:id/retry_btn").click()
    try:
        findElements = [
            ("XPATH", "//android.widget.Button[@content-desc='Login']"),
            ("XPATH",
             "//android.widget.TextView[@text='Recently Crashed!!!']"),
            ("ID", "com.view.viewglass:id/home_controlIV")
        ]
        common.waitForElement(driver, findElements, 120)
        if len(
                driver.find_elements(By.ID,
                                     "com.view.viewglass:id/home_controlIV")
        ) > 0 or len(
                driver.find_elements(
                    By.XPATH,
                    "//android.widget.TextView[@text='Recently Crashed!!!']")
        ) > 0:
            return True
        elif len(
                driver.find_elements(
                    By.XPATH,
                    "//android.widget.Button[@content-desc='Login']")) > 0:
            return False
    except TimeoutException:
        if len(
                driver.find_elements(
                    By.XPATH,
                    "//android.widget.TextView[@text='Authenticating, Please wait..']"
                )) > 0:
            print("Found authenticating progress")
        raiseExceptions("Loading the app has taken too long (over 2 minutes)")
Пример #10
0
def changeSite(driver, site):
    commonFunctions.navIcon(driver)
    driver.find_element_by_id("username_navigationTV").click()
    WebDriverWait(driver, 10).until(
        EC.presence_of_element_located(
            (By.XPATH, "//android.widget.TextView[@text='Change Site']")))
    driver.find_element_by_xpath(
        "//android.widget.TextView[@text='Change Site']").click()
    if len(driver.find_elements(By.ID,
                                "com.view.viewglass:id/search_layout")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/search_layout").click()
        search = driver.find_element_by_xpath(
            "//android.widget.EditText[@text='Search']")
        search.send_keys(site)
        driver.find_element_by_id(
            "com.view.viewglass:id/zone_item_select_zoneTV").click()
    else:
        raiseExceptions("Missing Search option in Change Site")

    if WebDriverWait(driver, 10).until(
            EC.presence_of_element_located(
                (By.XPATH, "//android.widget.Button[@text='Yes']"))):
        driver.find_element_by_xpath(
            "//android.widget.Button[@text='Yes']").click()
    else:
        raiseExceptions("confirmation message for changing site is missing")
    WebDriverWait(driver, 20).until(
        EC.presence_of_element_located(
            (By.ID, "com.view.viewglass:id/home_btn_myProfileLL")))
    commonFunctions.goback(driver)
    commonFunctions.navIcon(driver)
Пример #11
0
    def testNavigationIcon(self):
        """
        To verify the functionality of "navigation icon" in the upper left corner of the screen
        """
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/title_LiveViewTV")) <= 0:
            commonFunctions.navIcon(self.driver)
            if WebDriverWait(self.driver, 10).until(
                    EC.presence_of_element_located(
                        (By.ID,
                         "com.view.viewglass:id/navigation_live_viewTV"))):
                self.driver.find_element_by_id(
                    "com.view.viewglass:id/navigation_live_viewTV").click()
            else:
                raiseExceptions(
                    "LiveView option in navigation menu is missing")

        commonFunctions.navIcon(self.driver)
        WebDriverWait(self.driver, 10).until(
            EC.presence_of_element_located((
                By.XPATH,
                "//android.widget.TextView[@resource-id='com.view.viewglass:id/view_btnTV']"
            )))
        commonFunctions.navIcon(self.driver)
Пример #12
0
def navIcon(driver):
    try:
        findElements = [("ID", "com.view.viewglass:id/home_controlIV"),
                        ("ID", "com.view.viewglass:id/home_zonesIV"),
                        ("ID", "com.view.viewglass:id/homeBtnLiveViewLL"),
                        ("ID", "com.view.viewglass:id/home_schdIV"),
                        ("ID", "com.view.viewglass:id/menuBtn_scene")]
        waitForElement(driver, findElements, 20)
    except TypeError:
        driver.get_screenshot_as_png()
        driver.save_screenshot("navigation.png")
        raiseExceptions("Navigation icon is missing")
    if len(driver.find_elements(By.ID,
                                "com.view.viewglass:id/home_controlIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/home_controlIV").click()
    elif len(driver.find_elements(By.ID,
                                  "com.view.viewglass:id/home_zonesIV")) > 0:
        driver.find_element_by_id("com.view.viewglass:id/home_zonesIV").click()
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/homeBtnLiveViewLL")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/homeBtnLiveViewLL").click()
    elif len(driver.find_elements(By.ID,
                                  "com.view.viewglass:id/home_schdIV")) > 0:
        driver.find_element_by_id("com.view.viewglass:id/home_schdIV").click()
    elif len(driver.find_elements(By.ID,
                                  "com.view.viewglass:id/menuBtn_scene")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/menuBtn_scene").click()
Пример #13
0
def selectTopZonegroup(driver):
    if len(driver.find_elements(By.ID, "com.view.viewglass:id/listItem_parentLL")) > 0:
        size = driver.find_element_by_xpath("//android.widget.TextView[@text='ZONE GROUPS']").size
        location = driver.find_element_by_xpath("//android.widget.TextView[@text='ZONE GROUPS']").location
        x = location['x'] + size['width']
        y = location['y'] * 2
        driver.tap([(x, y)])
    else:
        raiseExceptions("The list of zonegroups is empty")
Пример #14
0
    def testCreateZoneGroupForRUO(self):
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'RUO')
        auth.loginAndSelectSite(self.driver, config.users['RUO']['username'],
                                config.users['RUO']['password'],
                                config.sites['Default'])

        commonFunctions.navIcon(self.driver)
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_zonesTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_zonesTV").click()
        else:
            raiseExceptions("Zones option in navigation menu is missing")

        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/title_zonesTV"))):
            pass
        else:
            raiseExceptions("Zones heading is missing")

        commonFunctions.addbutton(self.driver)
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/title_createZoneGrpTV"))):
            pass
        else:
            raiseExceptions("Add button led to the wrong screen")

        if len(
                self.driver.find_elements(
                    By.ID,
                    "com.view.viewglass:id/name_createZoneGrp_addETV")) > 0:
            self.driver.find_element_by_id(
                "com.view.viewglass:id/name_createZoneGrp_addETV").send_keys(
                    "abc")
            firstZone = self.driver.find_elements(
                By.ID, "com.view.viewglass:id/zone_item_select_zoneTV")[0]
            firstZone.click()
            commonFunctions.savebutton(self.driver)
        else:
            raiseExceptions("Name text field is missing")

        foundCreatedZonegroup = False
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/listItemNameTV")) > 0:
            zonegroups = self.driver.find_elements(
                By.ID, "com.view.viewglass:id/listItemNameTV")
            for group in zonegroups:
                if group.text == "abc":
                    foundCreatedZonegroup = True
        if not foundCreatedZonegroup:
            raiseExceptions("Zonegroup 'abc' was not created")
Пример #15
0
def signout(driver):
    if WebDriverWait(driver, 50).until(
            EC.presence_of_element_located((
                By.XPATH,
                "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']"
            ))):
        driver.find_element_by_xpath(
            "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']"
        ).click()
    else:
        raiseExceptions("Missing Sign Out button in Select Site screen")
Пример #16
0
def deleteSchedule(driver, schedule):
    # size = schedule.size
    # location = schedule.location
    # x = location['x'] + size['width'] - 10
    # y = location['y'] + 10
    # driver.tap([(x, y)])
    if len(
            driver.find_elements(By.XPATH,
                                 "//android.widget.ImageView[index='4']")) > 0:
        driver.find_element_by_xpath(
            "//android.widget.ImageView[index='4']").click()
    else:
        raiseExceptions("Missing delete schedule button")
Пример #17
0
def cancelbutton(driver):
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/cross_btn_controlLL")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/cross_btn_controlLL").click()
    elif len(
            driver.find_elements(
                By.XPATH, "//android.widget.TextView[@text='CANCEL']")) > 0:
        driver.find_element_by_xpath(
            "//android.widget.TextView[@text='CANCEL']").click()
    else:
        raiseExceptions("cancel button is missing")
Пример #18
0
def loginScreenValidations(driver):
    if len(
            driver.find_elements(
                By.XPATH,
                "//android.view.View[@content-desc='User Authentication Failed']"
            )) > 0:
        pass
    elif len(
            driver.find_elements(
                By.XPATH,
                "//android.widget.Button[@content-desc='Login']")) > 0:
        pass
    else:
        raiseExceptions("Missing login Screen Exceptional handling")
Пример #19
0
    def testUIComponentsOfSettingsScreen(self):
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        commonFunctions.navIcon(self.driver)

        if WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID,
                     "com.view.viewglass:id/settingIcon_navigationIV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/settingIcon_navigationIV").click()
        else:
            raiseExceptions("Settings option in navigation menu is missing")

        if WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID,
                     "com.view.viewglass:id/title_settingScreen_wallSwitchTV"
                     ))):
            pass
        else:
            raiseExceptions("Settings heading is missing")

        if len(
                self.driver.find_elements(
                    By.ID,
                    "com.view.viewglass:id/act_about_wallSwitchTV")) <= 0:
            raiseExceptions("About tab is missing")
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/legal_wallSwitchTV")) <= 0:
            raiseExceptions("Legal tab is missing")
Пример #20
0
    def testSelectSiteSignoutFunctionality(self):
        """
        Verify the functionality of the Sign Out button
        """
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO')
        auth.login(self.driver, config.users['CRUDO']['username'],
                   config.users['CRUDO']['password'])

        try:
            WebDriverWait(self.driver, 50).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/button_cancel")))
            self.driver.find_element_by_id(
                "com.view.viewglass:id/button_cancel").click()
        except TimeoutException:
            raiseExceptions(" Missing Sign Out button")
Пример #21
0
    def get_idx(self, index=None):
        if self.index is None:
            return range(0, len(self.y))
        else:
            if len(self.index) != len(self.y):
                raiseExceptions('length of index must be equal to length of X')
            idxval = np.array(self.index)
            pos_sorted = np.argsort(idxval)
            sorted_idxval = idxval[pos_sorted]

            vals, start_idx, count = np.unique(sorted_idxval,
                                               return_counts=True,
                                               return_index=True)
            splitted_idx = np.split(pos_sorted, start_idx[1:])
            splitted_idx = [list(i) for i in splitted_idx]
            return splitted_idx
Пример #22
0
    def testSelectSiteForOneSiteAssignToUser(self):
        """
        Verify the functionality of logging into a user assigned
        to only one site
        """
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'RUO')
        auth.login(self.driver, config.users['SingleSite']['username'],
                   config.users['SingleSite']['password'])

        if len(
                self.driver.find_elements(
                    By.XPATH,
                    "//android.widget.TextView[@text='Select Site']")) > 0:
            raiseExceptions("This user has more than one site")
        else:
            pass
Пример #23
0
def quickCreateSchedule(driver):
    if WebDriverWait(driver, 10).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/add_schdIV"))):
        commonFunctions.addbutton(driver)
        changeTint(driver)
        commonFunctions.savebutton(driver)
        WebDriverWait(driver, 30).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scheduleTV")))
    else:
        raiseExceptions("add schedule button is missing")

    if commonFunctions.foundAlert(driver):
        commonFunctions.respondToAlert(driver, 1)
        sleep(5)
        commonFunctions.goback(driver)
Пример #24
0
def checkLiveViewAccess(driver):
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/noLiveView_liveViewTV")) > 0:
        print("Live View Data not available")
        # change site? find a zone with accessible zone data?
        # changeSite(driver, config.site[2])
        # WebDriverWait(driver, 10).until(
        #     EC.presence_of_element_located((By.ID, "com.view.viewglass:id/zoneSelector_liveViewTV")))
        # driver.find_element_by_id("com.view.viewglass:id/zoneSelector_liveViewTV").click()
        # x = driver.find_element_by_class_name("android.widget.RelativeLayout").size['width'] + 10
        # y = driver.find_element_by_class_name("android.widget.RelativeLayout").location['y'] + 10
        # driver.tap([(x, y)])

        selectedZone = driver.find_element_by_id(
            "com.view.viewglass:id/zoneSelector_liveViewTV").text
        navIcon(driver)
        if WebDriverWait(driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_controlTV"))):
            driver.find_element_by_id(
                "com.view.viewglass:id/navigation_controlTV").click()
        else:
            raiseExceptions("Control option in navigation menu is missing")
        driver.find_element_by_id(
            "com.view.viewglass:id/selected_zone_name_controlTV").click()
        driver.find_element_by_id(
            "com.view.viewglass:id/search_ImageView").click()
        driver.find_element_by_id(
            "com.view.viewglass:id/control_searchETV").send_keys(selectedZone)
        results = driver.find_elements(
            By.ID, "com.view.viewglass:id/exapdChildTitle")
        for r in results:
            if r.text == selectedZone:
                r.click()
        control.selectRandomTint(driver)
        overridebutton(driver)

        navIcon(driver)
        if WebDriverWait(driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_live_viewTV"))):
            driver.find_element_by_id(
                "com.view.viewglass:id/navigation_live_viewTV").click()
        else:
            raiseExceptions("LiveView option in navigation menu is missing")
Пример #25
0
 def testNetworkConnectivityLost(self):
     """
     Verify the App Exceptional handling when user lost network connectivity from mobile device.
     This will disable the Data usage and wifi during test runtime and verify error message
     """
     auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO')
     self.driver.set_network_connection(1)
     if len(
             self.driver.find_elements(
                 By.XPATH, "//android.widget.TextView[@text='Retry']")) > 0:
         self.driver.set_network_connection(6)
         sleep(5)
         self.driver.find_element_by_xpath(
             "//android.widget.TextView[@text='Retry']").click()
     else:
         raiseExceptions(
             "Exception handling for lost network connection is missing")
Пример #26
0
    def testAddNewSceneWithMultipleTintEvents(self):
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO')
        auth.loginAndSelectSite(self.driver, config.users['CRUDO']['username'],
                                config.users['CRUDO']['password'],
                                config.sites['Default'])

        commonFunctions.navIcon(self.driver)
        if WebDriverWait(self.driver, 60).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_scenesTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_scenesTV").click()
        else:
            raiseExceptions("Scenes option in navigation menu is missing")

        WebDriverWait(self.driver, 10).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scene_headertext")))
        commonFunctions.addbutton(self.driver)
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/title_scene_addTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/name_scene_addETV").send_keys(
                    "newscene")
            self.driver.find_element_by_id(
                "com.view.viewglass:id/no_tint_eventTV").click()
        else:
            raiseExceptions("Add New Scene heading is missing")

        for i in range(0, 2):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/add_tint_eventTV").click()
            self.driver.find_element_by_id(
                "com.view.viewglass:id/zone_add_TintEventTV").click()
            if WebDriverWait(self.driver, 10).until(
                    EC.presence_of_element_located(
                        (By.ID, "com.view.viewglass:id/title_repeatTV"))):
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/listItemNameTV")[0].click()
            else:
                raiseExceptions("Zone option led to the wrong screen")
            self.driver.find_element_by_id(
                "com.view.viewglass:id/tintLevel_scene_TintEventTV").click()
            if WebDriverWait(self.driver, 10).until(
                    EC.presence_of_element_located(
                        (By.ID,
                         "com.view.viewglass:id/title_scene_selectTintTV"))):
                zones_and_scenes.selectRandomTint(self.driver)
            else:
                raiseExceptions("Tint Level option led to the wrong screen")
            commonFunctions.savebutton(self.driver)
        commonFunctions.savebutton(self.driver)
        if commonFunctions.foundAlert(self.driver):
            commonFunctions.respondToAlert(self.driver, 1)
Пример #27
0
def logout(driver):
    if common.foundAlert(driver):
        common.respondToAlert(driver, 0)
    common.navIcon(driver)
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/username_navigationTV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/username_navigationTV").click()
    else:
        raiseExceptions("Missing user profile option in navigation bar")
    if len(
            driver.find_elements(
                By.XPATH, "//android.widget.TextView[@text='Sign Out']")) > 0:
        driver.find_element_by_xpath(
            "//android.widget.TextView[@text='Sign Out']").click()
    else:
        raiseExceptions("Missing Sign Out button")
Пример #28
0
    def testSelectSiteForRUOUser(self):
        """
        Verify the app authentication by logging using valid RUO privilege user
        """
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'RUO')
        auth.login(self.driver, config.users['RUO']['username'],
                   config.users['RUO']['password'])

        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/home_controlIV")) > 0:
            print("RUO user only has one site")
        elif len(
                self.driver.find_elements(
                    By.XPATH,
                    "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']"
                )) > 0:
            try:
                WebDriverWait(self.driver, 50).until(
                    EC.presence_of_element_located(
                        (By.ID, "com.view.viewglass:id/search_image_view")))
                search = self.driver.find_element_by_id(
                    "com.view.viewglass:id/search_image_view")
                search.click()
                search_text = self.driver.find_element_by_id(
                    "com.view.viewglass:id/search_site_edit_text")
                # search for the site and press ENTER
                search_text.send_keys(config.sites['Default'])
                # self.self.driver.press_keycode(66)
                size = self.driver.find_element_by_id(
                    "com.view.viewglass:id/viewLogoLL").size
                location = self.driver.find_element_by_id(
                    "com.view.viewglass:id/viewLogoLL").location
                x = size['width'] / 2
                y = location['y'] + size['height'] * 2
                self.driver.tap([(x, y)])
                if len(
                        self.driver.find_elements(
                            By.ID, "com.view.viewglass:id/viewLogoLL")) > 0:
                    y = location['y'] + size['height'] * 2.5
                    self.driver.tap([(x, y)])
            except TimeoutException:
                raiseExceptions("Failed to reach Select Site screen")
Пример #29
0
    def testOverrideZoneGroupTint(self):
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        commonFunctions.navIcon(self.driver)
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_zonesTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_zonesTV").click()
        else:
            raiseExceptions("Zones option in navigation menu is missing")

        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/title_zonesTV"))):
            pass
        else:
            raiseExceptions("Zones heading is missing")

        zones_and_scenes.selectTopZonegroup(self.driver)
        tint = 0
        if len(
                self.driver.find_elements(
                    By.ID,
                    "com.view.viewglass:id/setTintBtn_zngrpdetailTV")) <= 0:
            raiseExceptions("Override button is missing")
        else:
            commonFunctions.overridebutton(self.driver)
            WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/Control_headingTV")))
            tint = control.selectRandomTint(self.driver)
            commonFunctions.overridebutton(self.driver)
        if tint != 0:
            commonFunctions.navIcon(self.driver)
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_zonesTV").click()
            zones_and_scenes.selectTopZonegroup(self.driver)
        else:
            raiseExceptions("unable to override tint")
        currentTint = self.driver.find_element_by_id(
            "com.view.viewglass:id/tint_level_zngrpdetailTV").text
        if str(tint) not in currentTint:
            raiseExceptions("Control screen is not in sync with Zones screen")
Пример #30
0
    def tesCreateCurrentSceneSchedule(self):
        auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO')
        commonFunctions.navIcon(self.driver)
        if WebDriverWait(self.driver, 60).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/navigation_scenesTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_scenesTV").click()
        else:
            raiseExceptions("Scenes option in navigation menu is missing")

        selectedScene = ""
        WebDriverWait(self.driver, 20).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scene_headertext")))
        selectedScene = self.driver.find_elements(
            By.ID, "com.view.viewglass:id/parent_scene_item")[0]
        selectedScene.click()

        if WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/schedule_scene_TV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/schedule_scene_TV").click()
        else:
            raiseExceptions("Schedule Scene button is missing")

        now = datetime.now()
        hours = [now - timedelta(hours=1), now + timedelta(hours=2)]
        startHour = datetime.strftime(hours[0], '%I:00 %p')
        endHour = datetime.strftime(hours[1], '%I:00 %p')

        self.driver.find_element_by_id(
            "com.view.viewglass:id/starts_schdSceneTintTV").click()
        startPicker = self.driver.find_elements(
            By.ID, "android:id/timePickerLayout")[0]
        startPicker.send_keys(startHour)
        self.driver.find_element_by_id(
            "com.view.viewglass:id/ends_schdSceneTintTV").click()
        endPicker = self.driver.find_elements(By.ID,
                                              "android:id/timePickerLayout")[0]
        endPicker.send_keys(endHour)
        commonFunctions.savebutton(self.driver)
Пример #31
0
    def get_ofs(self, dp_id):
        if len(self) == 0:
            logging.raiseExceptions("qos sw is not connected")
            raise ValueError('qos sw is not connected.')

        dps = {}
        if dp_id == REST_ALL:
            dps = self
        else:
            try:
                dpid = dpid_lib.str_to_dpid(dp_id)
            except:
                raise ValueError('Invalid switchID.')

            if dpid in self:
                dps = {dpid: self[dpid]}
            else:
                msg = 'qos sw is not connected. : switchID=%s' % dp_id
                raise ValueError(msg)

        return dps