예제 #1
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)
예제 #2
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)
예제 #3
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")
예제 #4
0
    def testAddTintEvent(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, 10).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, 10).until(
            EC.presence_of_element_located(
                (By.ID, "com.view.viewglass:id/scene_Detail")))

        commonFunctions.editbutton(self.driver)
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/add_tint_eventTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/add_tint_eventTV").click()
        else:
            raiseExceptions("Add Tint Event button is missing")

        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)
예제 #5
0
    def testEditZoneGroupForRO(self):
        auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO')
        auth.login(self.driver, config.users['RO']['username'],
                   config.users['RO']['password'])
        sleep(20)
        if commonFunctions.foundAlert(self.driver):
            commonFunctions.respondToAlert(self.driver, 0)
        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/view_btnTV")) > 0:
            commonFunctions.navIcon(self.driver)

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

        if zones_and_scenes.findZonegroup(self.driver, "abc") == False:
            zones_and_scenes.quickCreateZonegroup(self.driver, "abc")
            zones_and_scenes.findZonegroup(self.driver, "abc")

        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.XPATH, "//android.widget.TextView[@text='abc']"))):
            commonFunctions.editbutton(self.driver)
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/title_createZoneGrpTV"))):
            zones = self.driver.find_elements(
                By.ID, "com.view.viewglass:id/zone_item_select_zoneTV")
            zones[2].click()
            zones[3].click()
            commonFunctions.savebutton(self.driver)
        else:
            raiseExceptions("Edit button led to the wrong screen")
예제 #6
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)
예제 #7
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)
예제 #8
0
    def testAddTintEventExceptionHandling(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")))

        commonFunctions.editbutton(self.driver)
        if WebDriverWait(self.driver, 20).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/add_tint_eventTV"))):
            self.driver.find_element_by_id(
                "com.view.viewglass:id/add_tint_eventTV").click()
        else:
            raiseExceptions("Add Tint Event button is missing")

        commonFunctions.savebutton(self.driver)
        if commonFunctions.foundAlert(self.driver):
            commonFunctions.respondToAlert(self.driver, 1)
        else:
            raiseExceptions(
                "Missing exception handling for invalid input for Add Tint Event"
            )
예제 #9
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")
예제 #10
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"
            )