示例#1
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)
示例#2
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")
示例#3
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)
示例#4
0
    def testVerifyUIComponentsOfAddNewScene(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")

        if WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/scene_headertext"))):
            commonFunctions.addbutton(self.driver)
        else:
            raiseExceptions("Scenes heading is missing")

        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/title_scene_addTV")) <= 0:
            raiseExceptions("Add New Scene heading is missing")
        if len(
                self.driver.find_elements(
                    By.ID,
                    "com.view.viewglass:id/back_btn_add_newSceneIV")) <= 0:
            raiseExceptions("Back button is missing")
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/save_scene_addTV")) <= 0:
            raiseExceptions("Save button is missing")
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/name_scene_addETV")) <= 0:
            raiseExceptions("Name text field is missing")
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/no_tint_eventTV")) <= 0:
            raiseExceptions("Message: No tint event is available, is missing")
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/add_tint_eventTV")) <= 0:
            raiseExceptions("Add Tint Event button is missing")
示例#5
0
def quickCreateZonegroup(driver, zonegroup):
    commonFunctions.addbutton(driver)
    if WebDriverWait(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(driver.find_elements(By.ID, "com.view.viewglass:id/name_createZoneGrp_addETV")) > 0:
        driver.find_element_by_id("com.view.viewglass:id/name_createZoneGrp_addETV").send_keys("abc")
        firstZone = driver.find_elements(By.ID, "com.view.viewglass:id/zone_item_select_zoneTV")[0]
        firstZone.click()
        commonFunctions.savebutton(driver)
    else:
        raiseExceptions("Name text field is missing")

    foundCreatedZonegroup = False
    if len(driver.find_elements(By.ID, "com.view.viewglass:id/listItemNameTV")) > 0:
        zonegroups = driver.find_elements(By.ID, "com.view.viewglass:id/listItemNameTV")
        for group in zonegroups:
            if group.text == zonegroup:
                foundCreatedZonegroup = True
    if not foundCreatedZonegroup:
        raiseExceptions("Zonegroup 'abc' was not created")
示例#6
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"
            )