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 testRemoveDeleteZoneGroupForRUO(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") 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 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 testCellularData(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") startingCheck = self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_mobiledataIV").get_attribute( "checked") if startingCheck == "true": oppositeCheck = "false" else: oppositeCheck = "true" if WebDriverWait(self.driver, 20).until( EC.presence_of_element_located( (By.ID, "com.view.viewglass:id/togglebtn_mobiledataIV"))): self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_mobiledataIV").click() status = self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_mobiledataIV") if status.get_attribute("checked") != oppositeCheck: raiseExceptions("Cellular Data toggle button did not work") else: # return to previous setting self.driver.find_element_by_id( "com.view.viewglass:id/togglebtn_mobiledataIV").click()
def testEditZoneGroupForRUO(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") 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")
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")
def testAboutForRUO(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, 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")