Esempio n. 1
0
    def testAtLeastOneSunriseEntryInUI(self):
        """
        Open any LiveView for zone and verify at least one entry with reason Sunrise is displayed to user
        """
        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)

        hasSunriseEntry = False
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/tintReason_liveViewTV"))):
            for element in self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/tintReason_liveViewTV"):
                if element == "Sunrise":
                    hasSunriseEntry = True
        else:
            raiseExceptions("Bug: there are no tint activities in the list")

        if not hasSunriseEntry:
            raiseExceptions("Bug: No Sunrise entry in UI")
Esempio n. 2
0
    def testUICaratMoveAfterSunset(self):
        """
        Login to app after sunset time and select the entry after sunset from table and
        verify that user is unable to move carat after sunset but should be able to move carat any
        time between sunrise and sunset for that day
        """
        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")
            commonFunctions.checkLiveViewAccess(self.driver)

            if len(
                    self.driver.find_elements(
                        By.ID, "com.view.viewglass:id/GraphOver")) > 0:
                self.driver.find_element_by_id(
                    "com.view.viewglass:id/GraphOver").click()
            else:
                raiseExceptions("Graph is missing")

            if len(
                    self.driver.find_elements(By.CLASS_NAME,
                                              "android.widget.SeekBar")) > 0:
                size = self.driver.find_element_by_class_name(
                    "android.widget.SeekBar").size
                location = self.driver.find_element_by_class_name(
                    "android.widget.SeekBar").location
                self.driver.swipe(location['x'], location['y'],
                                  location['x'] + size['width'], location['y'],
                                  3000)
            else:
                raiseExceptions("Seek bar is missing")
Esempio n. 3
0
    def testScrollerAndTintDetails(self):
        """
        To check if the scroller on the arc is moved, then the tint event details also scroll with the time.
        """
        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)

        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/GraphOver")) > 0:
            self.driver.find_element_by_id(
                "com.view.viewglass:id/GraphOver").click()
        else:
            raiseExceptions("Graph is missing")

        if len(
                self.driver.find_elements(By.CLASS_NAME,
                                          "android.widget.SeekBar")) > 0:
            size = self.driver.find_element_by_class_name(
                "android.widget.SeekBar").size
            location = self.driver.find_element_by_class_name(
                "android.widget.SeekBar").location
            self.driver.swipe(location['x'], location['y'],
                              location['x'] + size['width'] / 2, location['y'],
                              3000)
        else:
            raiseExceptions("Seek bar is missing")
Esempio n. 4
0
    def testDisplayDataEntryAndGraphSync(self):
        """
        Open any LiveView for zone
        click on any entry in LiveView history and according to that information should changed in Graph
        Eg: If user clicks on A20 Zone and selects the 9:35AM entry in table then in graph user should immediately
        see the Tint icon, control,carat icon moved to 9:35 am, reason for Tint and in center of graph time display should e 9:35 am
        """
        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)

        firstActivityTime = ""
        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()
            firstActivityTime = 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")

        timeSelectedInGraph = self.driver.find_element_by_id(
            "com.view.viewglass:id/curTimeTV").text
        if timeSelectedInGraph != firstActivityTime:
            raiseExceptions("The Data Entry and Graph are not in sync")
Esempio n. 5
0
    def testVerifyTintEventTimes(self):
        """
        To verify if the first tint applied of the day is before 6 am.
        then the last applied tint should be displayed with the time and date.
        """
        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)

        format = '%I:%M %p'
        sixAM = datetime.strptime("06:00 AM", format)
        isFirstTintBeforeSix = False
        if WebDriverWait(self.driver, 10).until(
                EC.presence_of_element_located(
                    (By.ID, "com.view.viewglass:id/time_liveViewTV"))):
            for element in self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/time_liveViewTV"):
                elementsTime = datetime.strptime(element.text, format)
                if elementsTime < sixAM:
                    isFirstTintBeforeSix = True
        else:
            raiseExceptions("Bug: there are no tint activities in the list")

        if not isFirstTintBeforeSix:
            raiseExceptions(
                "Bug: the first tint applied of the day is not before 6 am")
Esempio n. 6
0
    def test1VerifyLiveViewUIComponents(self):
        """
        To verify the UI components of the "LiveView screen"
        """
        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, 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)

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

        if len(
                self.driver.find_elements(
                    By.ID,
                    "com.view.viewglass:id/zoneSelector_liveViewTV")) > 0:
            self.driver.find_element_by_id(
                "com.view.viewglass:id/zoneSelector_liveViewTV").click()
            x = self.driver.find_element_by_class_name(
                "android.widget.RelativeLayout").size['width'] + 10
            y = self.driver.find_element_by_class_name(
                "android.widget.RelativeLayout").location['y'] + 10
            self.driver.tap([(x, y)])
        else:
            raiseExceptions("Name of the Zone is missing")

        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/homeBtnLiveViewLL")) > 0:
            pass
        else:
            raiseExceptions("Navigation icon is missing")

        if len(
                self.driver.find_elements(
                    By.ID,
                    "com.view.viewglass:id/TimeTempEnergy_liveViewLL")) > 0:
            pass
        else:
            raiseExceptions("Timeline is missing")

        if len(
                self.driver.find_elements(
                    By.ID, "com.view.viewglass:id/GraphOver")) > 0:
            pass
        else:
            raiseExceptions("Currently applied program is not highlighted")
Esempio n. 7
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"
            )
Esempio n. 8
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"
            )