def testLoginTo1dot2Site(self): """ Verify the app authentication by logging using valid RO privilege user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.login(self.driver, config.users['1dot2System']['username'], config.users['1dot2System']['password']) site.selectSite(self.driver, 'B195 Ballroom')
def testUIComponentsOfProfileScreenForRO(self): auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO') auth.login(self.driver, config.users['RO']['username'], config.users['RO']['password']) sleep(20) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/home_controlIV")) > 0: pass elif len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']" )) > 0: site.selectSite(self.driver, config.users['RO']['testsite']) if commonFunctions.foundAlert(self.driver): commonFunctions.respondToAlert(self.driver, 0) commonFunctions.navIcon(self.driver) if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/username_navigationTV"))): self.driver.find_element_by_id( "com.view.viewglass:id/username_navigationTV").click() else: raiseExceptions("Profile option in navigation menu is missing") if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/title_myProfileTV"))): pass else: raiseExceptions("Profile heading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/startup_myProfileTV")) <= 0: raiseExceptions("Send Feedback tab is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/change_appserverIP_myProfileTV") ) <= 0: raiseExceptions("Change Appserver IP is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/tourPreferenceTV")) <= 0: raiseExceptions("Tour Preference is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/mobiledataTV")) <= 0: raiseExceptions("Cellular Data is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/signout_myProfileTV")) <= 0: raiseExceptions("Sign Out button is missing") self.driver.find_element_by_xpath( "//android.widget.TextView[@text='Sign Out']").click()
def testCreateZoneGroupForRO(self): auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO') auth.login(self.driver, config.users['RO']['username'], config.users['RO']['password']) sleep(20) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/home_controlIV")) > 0: pass elif len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']" )) > 0: site.selectSite(self.driver, config.users['RO']['testsite']) 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 len( self.driver.find_elements( By.ID, "com.view.viewglass:id/actZone_addIV")) > 0: raiseExceptions("RO user is able to add a zonegroup")
def testAddNewSceneForRO(self): auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO') auth.login(self.driver, config.users['RO']['username'], config.users['RO']['password']) sleep(20) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/home_controlIV")) > 0: pass elif len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']" )) > 0: site.selectSite(self.driver, config.users['RO']['testsite']) if commonFunctions.foundAlert(self.driver): commonFunctions.respondToAlert(self.driver, 0) 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"))) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/scene_addIconIV")) > 0: raiseExceptions("Bug: RO user is able to add a new scene") auth.logout(self.driver)
def testCheckIfSystemIsReadyForTesting(self): auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') attempts = 0 while attempts < 3: if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/retry_btn")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/retry_btn").click() if len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@content-desc='Login']")) > 0: auth.loginOperation(self.driver, config.users['CRUDO']['username'], config.users['CRUDO']['password']) try: findElements = [ ("ID", "com.view.viewglass:id/search_image_view"), ("XPATH", "//android.widget.TextView[@text='Recently Crashed!!!']" ), ("ID", "com.view.viewglass:id/home_controlIV") ] common.waitForElement(self.driver, findElements, 120) # WebDriverWait(self.driver, 120).until(lambda driver: len(driver.find_elements(By.ID,"com.view.viewglass:id/search_image_view")) > 0 or len(driver.find_elements(By.XPATH,"//android.widget.TextView[@text='Recently Crashed!!!']")) > 0 or len(driver.find_elements(By.ID,"com.view.viewglass:id/home_controlIV")) > 0) except TimeoutException: print("didn't find anything after 2 minutes") pass # after user enters valid credentials and clicks the login button, check if # (1) user is led to the Select Site screen, or (2) in the Control screen (RO user), or (3) in Control # screen with a 'Recently Crashed' alert. If so, break, and continue (maybe respond to alert) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/search_image_view")) > 0: site.selectSite(self.driver, config.sites['Default']) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/home_controlIV")) > 0: break elif len( self.driver.find_elements( By.XPATH, "//android.widget.TextView[@text='Recently Crashed!!!']" )) > 0: common.respondToAlert(self.driver, 0) sleep(5) break elif len( self.driver.find_elements( By.ID, "com.view.viewglass:id/view_btnTV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/view_btnTV").click() break elif common.foundTour(self.driver): common.exitTour(self.driver) break elif len( self.driver.find_elements( By.XPATH, "//android.widget.TextView[@text='Site is not reachable. Please try again later or contact Facilities Manager or View Support at [email protected] or (855)-478-8468']" )) > 0: raiseExceptions("Site is not reachable at the moment") else: attempts += 1 self.driver.close_app() self.driver.launch_app() sleep(20) if common.foundTour(self.driver): common.exitTour(self.driver) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/view_btnTV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/view_btnTV").click() sleep(5) if attempts == 3: raiseExceptions("Unable to login after 3 tries")
def testAboutForRO(self): auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO') auth.login(self.driver, config.users['RO']['username'], config.users['RO']['password']) sleep(20) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/home_controlIV")) > 0: pass elif len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']" )) > 0: site.selectSite(self.driver, config.users['RO']['testsite']) if commonFunctions.foundAlert(self.driver): commonFunctions.respondToAlert(self.driver, 0) commonFunctions.navIcon(self.driver) if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/settingIcon_navigationIV"))): self.driver.find_element_by_id( "com.view.viewglass:id/settingIcon_navigationIV").click() else: raiseExceptions("Settings option in navigation menu is missing") if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/title_settingScreen_wallSwitchTV" ))): pass else: raiseExceptions("Settings heading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/act_about_wallSwitchTV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/act_about_wallSwitchTV").click() if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/title_settingTV"))): pass else: raiseExceptions("About Viewglass heading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/application_settingTV")) <= 0: raiseExceptions("Application subheading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/version_settingLL")) <= 0: raiseExceptions("Version is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/deviceid_settingLL")) <= 0: raiseExceptions("Show Device is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/masterController_settingsTV")) <= 0: raiseExceptions("Master Controller subheading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/site_settingLL")) <= 0: raiseExceptions("Site is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/mode_settingLL")) <= 0: raiseExceptions("Mode is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/name_settingLL")) <= 0: raiseExceptions("Name is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/date_settingTV")) <= 0: raiseExceptions("Date setting is missing") size = self.driver.find_element_by_id( "com.view.viewglass:id/appInfoParentLL").size location = self.driver.find_element_by_id( "com.view.viewglass:id/appInfoParentLL").location self.driver.swipe(location['x'] + size['width'] / 2, location['y'] + size['height'] - 10, location['x'] + size['width'] / 2, location['y'] + 10, 2000) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/time_settingLL")) <= 0: raiseExceptions("Time setting is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/setting_timeZoneLL")) <= 0: raiseExceptions("Timezone setting is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/setting_PltfrmVersionLL")) <= 0: raiseExceptions("Platform Version is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/setting_DatabaseVersionLL")) <= 0: raiseExceptions("Database Version is missing")