def testUIAccessAfterSunset(self): """ Login to app after sunset time and verify the accessibility of LiveView """ 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") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/title_LiveViewTV")) <= 0: raiseExceptions("Unable to access LiveView after sunset")
def testNavigationIcon(self): """ To verify the functionality of "navigation icon" in the upper left corner of the screen """ 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.navIcon(self.driver) WebDriverWait(self.driver, 10).until( EC.presence_of_element_located(( By.XPATH, "//android.widget.TextView[@resource-id='com.view.viewglass:id/view_btnTV']" ))) commonFunctions.navIcon(self.driver)
def testAtLeastOneSunsetEntryInUI(self): """ Open any LiveView for zone and verify at lease one entry with reason Sunset 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) hasSunsetEntry = 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 == "Sunset": hasSunsetEntry = True else: raiseExceptions("Bug: there are no tint activities in the list") if not hasSunsetEntry: raiseExceptions("Bug: No Sunset entry in UI")
def testTourPreference(self): auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO') 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/togglebtn_tourPreferenceIV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_tourPreferenceIV").click() if self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_tourPreferenceIV" ).get_attribute("checked") == "false": raiseExceptions("Tour Preference toggle button did not work") else: self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_tourPreferenceIV").click()
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)
def testSendFeedback(self): auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO') 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: self.driver.find_element_by_id( "com.view.viewglass:id/startup_myProfileTV").click() if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.XPATH, "//android.widget.TextView[@text='Send Device Logs...']" ))): pass else: raiseExceptions("Send Device Logs panel is missing")
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)
def testUIComponentsOfSettingsScreen(self): auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO') 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: raiseExceptions("About tab is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/legal_wallSwitchTV")) <= 0: raiseExceptions("Legal tab is missing")
def testSelectSiteForCRUDOUser(self): """ Verify the by logging using valid CRUDO privilege user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.login(self.driver, config.users['CRUDO']['username'], config.users['CRUDO']['password']) try: WebDriverWait(self.driver, 50).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/search_image_view"))) search = self.driver.find_element_by_id( "com.view.viewglass:id/search_image_view") search.click() search_text = self.driver.find_element_by_id( "com.view.viewglass:id/search_site_edit_text") # search for the site and press ENTER search_text.send_keys(config.sites['Default']) # self.self.driver.press_keycode(66) size = self.driver.find_element_by_id( "com.view.viewglass:id/viewLogoLL").size location = self.driver.find_element_by_id( "com.view.viewglass:id/viewLogoLL").location x = size['width'] / 2 y = location['y'] + size['height'] * 2 self.driver.tap([(x, y)]) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/viewLogoLL")) > 0: y = location['y'] + size['height'] * 2.5 self.driver.tap([(x, y)]) except TimeoutException: raiseExceptions("Failed to reach Select Site screen")
def testVerifyUIComponentsOfSceneScreen(self): auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO') commonFunctions.navIcon(self.driver) try: 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() except TimeoutException: raiseExceptions("Scenes option in navigation menu is missing") try: WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/scene_headertext"))) except TimeoutException: raiseExceptions("Scenes heading is missing") commonFunctions.navIcon(self.driver) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/view_btnTV")) <= 0: raiseExceptions("Navigation icon in Scenes screen is missing") commonFunctions.navIcon(self.driver) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/scene_addIconIV")) <= 0: raiseExceptions("Add icon in Scenes screen is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/desc_SceneItemTV")) <= 0: raiseExceptions( "Number of zones each scene is applied to is missing")
def testRemoveDeleteZoneGroupForRO(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") foundZonegroupabc = False size = 0 location = 0 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": foundZonegroupabc = True size = group.size location = group.location break if foundZonegroupabc: startx = location['x'] + size['width'] endx = location['x'] + size['width'] / 2 y = location['y'] + size['height'] / 2 self.driver.swipe(startx, y, endx, y, 3000) x = location['x'] + size['width'] - 10 self.driver.tap([(x, y)]) sleep(5) 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": raiseExceptions("Zonegroup was not deleted")
def testLoginUsingCRUDOUser(self): """ Verify the app authentication by logging using valid CRUDO privilege user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.login(self.driver, config.users['CRUDO']['username'], config.users['CRUDO']['password']) auth.signout(self.driver)
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 testNoSiteAssignedForUserInVRM(self): """ Verify the exceptional handling by logging using invalid user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO') auth.login(self.driver, config.users['RO']['username'], config.users['RO']['password']) auth.logout(self.driver)
def testUnconfiguredUserInVRM(self): """ Verify the exceptional handling by logging using invalid user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'UserNotConfiguredInVRM') auth.login(self.driver, config.users['UserNotConfiguredInVRM']['username'], config.users['UserNotConfiguredInVRM']['password'])
def testVerifyUIComponentsOfSceneDetailScreen(self): auth.checkIfUserIsLoggedIn(self.driver, 1, 'CRUDO') commonFunctions.navIcon(self.driver) try: 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() except TimeoutException: raiseExceptions("Scenes option in navigation menu is missing") try: 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() except TimeoutException: raiseExceptions("Scenes heading is missing") try: WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/scene_Detail"))) except TimeoutException: raiseExceptions("Scene Detail heading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/back_scene_detailLL")) <= 0: raiseExceptions("Back button in Scenes Detail screen is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/editbtn_sceneTV")) <= 0: raiseExceptions("Edit button in Scenes Detail screen is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/sceneNameTV")) <= 0: raiseExceptions("Name of scene is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/tintEvents_scene_detailTV")) <= 0: raiseExceptions("Tint Event subheading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/listitemImageIV")) <= 0: raiseExceptions("Tint level icon is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/listItemNameTV")) <= 0: raiseExceptions("Name of zone in scene is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/schedule_scene_TV")) <= 0: raiseExceptions("Schedule Scene button is missing")
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 testLogoutFunctionality(self): """ Verify the logout functionality """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.login(self.driver, config.users['CRUDO']['username'], config.users['CRUDO']['password']) sleep(30) auth.signout(self.driver)
def testLoginUsingMissingPwd(self): """ Verify the exceptional handling by logging using invalid user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.negativeTestCaseLoginValidation( self.driver, config.users['MissingPwd']['username'], config.users['MissingPwd']['password']) auth.loginScreenValidations(self.driver)
def testSingleSiteUserLogin(self): """ Verify the exceptional handling by logging using invalid user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'RUO') auth.login(self.driver, config.users['SingleSite']['username'], config.users['SingleSite']['password']) sleep(30) auth.logout(self.driver)
def testVerifyUIComponentsOfSceneEventScreen(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/listItemNameTV"))): self.driver.find_elements( By.ID, "com.view.viewglass:id/listItemNameTV")[0].click() else: raiseExceptions("Zones in Scene is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/title_sceneEventTV")) <= 0: raiseExceptions("Scene Detail heading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/back_scene_eventLL")) <= 0: raiseExceptions("Back button is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/savebtn_sceneEventTV")) <= 0: raiseExceptions("Save button is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/zone_TintEventTV")) <= 0: raiseExceptions("Zone option is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/tintLevel_tintEventTV")) <= 0: raiseExceptions("Tint Level option is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/tintLevel_SceneEventTV")) <= 0: raiseExceptions("Tint Level text is missing")
def testSelectSiteNoSiteAssignToUserInVRM(self): """ Verify the functionality of logging into a user not assigned to any site """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.checkIfUserIsLoggedIn(self.driver, 0, 'UserNotConfiguredInVRM') auth.login(self.driver, config.users['UserNotConfiguredInVRM']['username'], config.users['UserNotConfiguredInVRM']['password'])
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")
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)
def testSelectSiteCancelFunctionality(self): """ Verify the functionality of the cancel button """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'CRUDO') auth.login(self.driver, config.users['CRUDO']['username'], config.users['CRUDO']['password']) try: WebDriverWait(self.driver, 50).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/search_image_view"))) search = self.driver.find_element_by_id( "com.view.viewglass:id/search_image_view") search.click() search_text = self.driver.find_element_by_id( "com.view.viewglass:id/search_site_edit_text") # search for the site and press ENTER search_text.send_keys(config.sites['Default']) # self.self.driver.press_keycode(66) size = self.driver.find_element_by_id( "com.view.viewglass:id/viewLogoLL").size location = self.driver.find_element_by_id( "com.view.viewglass:id/viewLogoLL").location x = size['width'] / 2 y = location['y'] + size['height'] * 2 self.driver.tap([(x, y)]) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/viewLogoLL")) > 0: y = location['y'] + size['height'] * 2.5 self.driver.tap([(x, y)]) except TimeoutException: raiseExceptions("Failed to reach Select Site screen") try: WebDriverWait(self.driver, 10).until( EC.presence_of_element_located( (By.XPATH, "//android.widget.TextView[@text='Cancel']"))) if len( self.driver.find_elements( By.XPATH, "//android.widget.TextView[@text='Cancel']")) == 0: raiseExceptions("Cancel button was not found in time.") else: self.driver.find_element_by_xpath( "//android.widget.TextView[@text='Cancel']").click() except TimeoutException: raiseExceptions("Cancel button did not stop the process") if common.foundAlert(self.driver): common.respondToAlert(self.driver, 1)
def testVerifyUIComponentsOfEditSceneScreen(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) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/scene_Detail")) <= 0: raiseExceptions("Edit Scene heading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/editbtn_sceneTV")) <= 0: raiseExceptions("Save button 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") if self.driver.find_element_by_id( "com.view.viewglass:id/name_scene_editETV").text == "": raiseExceptions("Name of Scene is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/tintEvents_scene_detailTV")) <= 0: raiseExceptions("Tint Event subheading is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/listItemNameTV")) <= 0: raiseExceptions("Name of tint event is missing")
def testUIComponentsOfProfileScreenForCRUDO(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, 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_site_myProfileTV")) <= 0: raiseExceptions("Change Site 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 testChangeSite(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, 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/change_site_myProfileTV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/change_site_myProfileTV").click() if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/search_layout")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/search_layout").click() search = self.driver.find_element_by_xpath( "//android.widget.EditText[@text='Search']") search.send_keys(config.site[1]) self.driver.find_element_by_id( "com.view.viewglass:id/zone_item_select_zoneTV").click() else: raiseExceptions("Missing Search option in Change Site") if WebDriverWait(self.driver, 10).until( EC.presence_of_element_located( (By.XPATH, "//android.widget.Button[@text='Yes']"))): self.driver.find_element_by_xpath( "//android.widget.Button[@text='Yes']").click() else: raiseExceptions( "confirmation message for changing site is missing")
def testFunctionalityOfSearching(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/search_zonesIV"))): self.driver.find_element_by_id( "com.view.viewglass:id/search_zonesIV").click() else: raiseExceptions("Search icon is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/searchEditTV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/searchEditTV").send_keys("z") else: raiseExceptions("Search text field is missing") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/exapdChildTitle")) > 0: searchResults = self.driver.find_elements( By.ID, "com.view.viewglass:id/exapdChildTitle") for result in searchResults: if not ("z" in result.text or "Z" in result.text): raiseExceptions("Bug: found incorrect result ", result.text) elif len( self.driver.find_elements( By.ID, "com.view.viewglass:id/exapdChildTitle")) == 0: self.driver.find_element_by_xpath( "//android.widget.TextView[@text='0 SEARCH RESULT']") else: raiseExceptions( "Missing exception handling for unmatching search results") if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/searchCancelTV")) > 0: self.driver.find_element_by_id( "com.view.viewglass:id/searchCancelTV").click() else: raiseExceptions("Cancel button is missing")
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)