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 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 testLoginUsingROUser(self): """ Verify the app authentication by logging using valid RO privilege user """ auth.checkIfUserIsLoggedIn(self.driver, 0, 'RO') auth.login(self.driver, config.users['RO']['username'], config.users['RO']['password']) if len( self.driver.find_elements( By.ID, "com.view.viewglass:id/home_controlIV")) > 0: auth.logout(self.driver) elif len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@resource-id='com.view.viewglass:id/button_cancel']" )) > 0: auth.signout(self.driver)
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 testUIComponentsOfLoginScreen(self): """ Verify the UI components of login screen like logo, user credentials parameters """ if auth.isUserLoggedIn(self.driver): if commonFunctions.foundAlert(self.driver): commonFunctions.respondToAlert(self.driver, 0) auth.logout(self.driver) sleep(30) if len( self.driver.find_elements( By.XPATH, "//android.widget.TextView[@text='view']")) > 0: pass else: raiseExceptions("View logo is missing") if len( self.driver.find_elements( By.XPATH, "//android.widget.TextView[@text='Dynamic Glass']")) > 0: # If statement pass else: raiseExceptions("Dynamic Glass logo is missing") if WebDriverWait(self.driver, 30).until( EC.presence_of_element_located( (By.XPATH, "//android.widget.EditText[@index='0']"))): email = self.driver.find_element_by_xpath( "//android.widget.EditText[@index='0']") text = email.text if text != "Email": email.clear() if WebDriverWait(self.driver, 5).until( EC.presence_of_element_located( (By.XPATH, "//android.widget.EditText[@text='Email']"))): pass else: raiseExceptions(" Enter username field is missing") if WebDriverWait(self.driver, 5).until( EC.presence_of_element_located( (By.XPATH, "//android.widget.EditText[@text='Password']"))): pass else: raiseExceptions("Enter Password field is missing") if len( self.driver.find_elements( By.XPATH, "//android.view.View[@content-desc='Remember Me']")) > 0: pass elif len( self.driver.find_elements(By.CLASS_NAME, "android.widget.CheckBox")) > 0: pass else: raiseExceptions(" Remember me is missing on login screen") if len( self.driver.find_elements( By.XPATH, "//android.widget.Button[@content-desc='Login']")) > 0: pass else: raiseExceptions("unable to find login button")
def on_stop(self): """Logout and stuff after ending a user session.""" logout()
def logout(self): if auth.logout(self.locust): self.interrupt()
def logout(self): """docstring for logout""" auth.logout() return redirect("/")