Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 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")
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
    def testUIUpdateAfterApplyingSceneSchedule(self):
        """
         Create a scene schedule from scene screen and  verify the entry with scene schedule in  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_scheduleTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/navigation_scheduleTV").click()
        else:
            raiseExceptions("Schedule option in navigation menu is missing")

        startTime = ""
        endTime = ""
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/scheduleTV"))):
            commonFunctions.addbutton(self.driver)
            control.changeTint(self.driver)
            self.driver.find_element_by_id(
                "com.view.viewglass:id/zone_scene_sel_selClsTypeTV").click()
            self.driver.find_element_by_xpath(
                "//android.widget.TextView[@text='SCENE']").click()
            startTime = datetime.strptime(
                self.driver.find_element_by_id(
                    "com.view.viewglass:id/starts_value_schdSceneTintTV").text,
                '%I:%M %p')
            endTime = datetime.strptime(
                self.driver.find_element_by_id(
                    "com.view.viewglass:id/ends_value_schdSceneTintTV").text,
                '%I:%M %p')
            commonFunctions.savebutton(self.driver)
        if commonFunctions.foundAlert(self.driver):
            commonFunctions.respondToAlert(self.driver, 1)
            print("Unable to create scene")
            commonFunctions.goback(self.driver)

        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 = datetime.strptime(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/time_liveViewTV")[0].text,
                '%I:%M %p')
        else:
            raiseExceptions("Bug: there are no tint activities in the list")

        if startTime < timeOfMostRecentActivity and timeOfMostRecentActivity < endTime:
            raiseExceptions(
                "Bug: The recently applied tint was not added to the list of tint activities"
            )