Beispiel #1
0
def verifyInvalidTintsNotFound(driver, tint):
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/tintImage_controlIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/tintImage_controlIV").click()
        if commonFunctions.foundAlert(driver):
            commonFunctions.respondToAlert(driver, 1)
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/tintLevelNum_controlTV")) > 0:
        pass
    else:
        selectRandomTint(driver)
        commonFunctions.overridebutton(driver)
        if len(
                driver.find_elements(
                    By.ID, "com.view.viewglass:id/tintImage_controlIV")) > 0:
            driver.find_element_by_id(
                "com.view.viewglass:id/tintImage_controlIV").click()
            if commonFunctions.foundAlert(driver):
                commonFunctions.respondToAlert(driver, 1)
    currentTint = getCurrentTint(driver)
    for i in range(1, 5):
        if i != tint:
            tintStr = "//android.widget.TextView[@text='" + str(i) + "']"
            print(
                len(driver.find_elements(By.XPATH, tintStr)) == 0,
                "Incorrect tint was found. Tint found was " + str(currentTint))
Beispiel #2
0
def selectTint(driver, t):
    t = int(t)
    tint = getTint1(driver)
    if t == 1:
        tint = getTint1(driver)
    elif t == 2:
        tint = getTint2(driver)
    elif t == 3:
        tint = getTint3(driver)
    elif t == 4:
        tint = getTint4(driver)
    driver.tap([(tint[0], tint[1])])
    commonFunctions.overridebutton(driver)
    sleep(30)
Beispiel #3
0
    def testZoneGroupsWithMixedTint(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)
        zonegroups = self.driver.find_elements(
            By.ID, "com.view.viewglass:id/parent_zone_item_listLL")
        if len(zonegroups) >= 2:
            zonegroups[0].click()
            commonFunctions.overridebutton(self.driver)
            control.selectTint(self.driver, 1)

            commonFunctions.navIcon(self.driver)
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_zonesTV").click()
            zones_and_scenes.selectTopZonegroup(self.driver)

            zonegroups[1].click()
            commonFunctions.overridebutton(self.driver)
            control.selectTint(self.driver, 2)
        else:
            commonFunctions.goback(self.driver)
            print("there are not enough zones to have a mixed tint detail")

        commonFunctions.navIcon(self.driver)
        self.driver.find_element_by_id(
            "com.view.viewglass:id/navigation_zonesTV").click()
        zones_and_scenes.selectTopZonegroup(self.driver)
        currentTint = self.driver.find_element_by_id(
            "com.view.viewglass:id/tint_level_zngrpdetailTV").text
        if currentTint != "Mixed Tint":
            raiseExceptions("Control screen is not in sync with Zones screen")
Beispiel #4
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")
Beispiel #5
0
def getCurrentTint(driver):
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/tintImage_controlIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/tintImage_controlIV").click()
        if commonFunctions.foundAlert(driver):
            commonFunctions.respondToAlert(driver, 1)
        currentTint = driver.find_element_by_id(
            "com.view.viewglass:id/tintLevelNum_controlTV").text
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/tintLevelNum_controlTV")) > 0:
        currentTint = driver.find_element_by_id(
            "com.view.viewglass:id/tintLevelNum_controlTV").text
    else:
        currentTint = selectRandomTint(driver)
        commonFunctions.overridebutton(driver)
    return currentTint
Beispiel #6
0
def clickTintLevelNum(driver):
    if len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/tintImage_controlIV")) > 0:
        driver.find_element_by_id(
            "com.view.viewglass:id/tintImage_controlIV").click()
        if commonFunctions.foundAlert(driver):
            commonFunctions.respondToAlert(driver, 1)
    elif len(
            driver.find_elements(
                By.ID, "com.view.viewglass:id/tintLevelNum_controlTV")) > 0:
        pass
    else:
        selectRandomTint(driver)
        commonFunctions.overridebutton(driver)
        driver.find_element_by_id(
            "com.view.viewglass:id/tintImage_controlIV").click()
        if commonFunctions.foundAlert(driver):
            commonFunctions.respondToAlert(driver, 1)
Beispiel #7
0
    def testUIUpdateAfterApplyingTint(self):
        """
        To apply a tint from UI and check if it is updated on the UI of the LiveView.
        """
        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.checkLiveViewAccess(self.driver)

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

        # search for a specific zone to cross-check with LiveView (With NC20Test, use Zone1)
        self.driver.find_element_by_id(
            "com.view.viewglass:id/selected_zone_name_controlTV").click()
        self.driver.find_element_by_id(
            "com.view.viewglass:id/search_ImageView").click()
        self.driver.find_element_by_id(
            "com.view.viewglass:id/control_searchETV").send_keys("Zone1")
        self.driver.find_element_by_xpath(
            "//android.widget.TextView[@text='Zone1']").click()
        control.selectRandomTint(self.driver)
        commonFunctions.overridebutton(self.driver)
        format = '%I:%M %p'
        now = datetime.now()
        timeOfEventJustAdded = datetime.strftime(now, format)

        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")

        timeOfMostRecentActivity = ""
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/time_liveViewTV"))):
            self.driver.find_elements(
                By.ID, "com.view.viewglass:id/time_liveViewTV")[0].click()
            timeOfMostRecentActivity = self.driver.find_elements(
                By.ID, "com.view.viewglass:id/time_liveViewTV")[0].text
        else:
            raiseExceptions("Bug: there are no tint activities in the list")

        if timeOfMostRecentActivity != timeOfEventJustAdded:
            raiseExceptions(
                "Bug: The recently applied tint was not added to the list of tint activities"
            )