def testDisableAndEnableUserFromDetailsDialog(self): """Test that disabling and enabling a user works from the details page.""" landing_page = LandingPage(self.driver) landing_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) self.assertTestUserPresenceOnPage(True) self.assertUserCanBeDisabledAndThenEnabled(False, True) landing_page.tryToCloseDetailsDialogAndRefreshIfFail(self.args.server_url)
def testDisableAndEnableUserFromDetailsDialog(self): """Test that disabling and enabling a user works from the details page.""" landing_page = LandingPage(self.driver) landing_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) self.assertTestUserPresenceOnPage(True) self.assertUserCanBeDisabledAndThenEnabled(False, True) landing_page.tryToCloseDetailsDialogAndRefreshIfFail( self.args.server_url)
def testCreateNewInviteCode(self): """Test that creating a new invite code actually generates a new one.""" landing_page = LandingPage(self.driver) # Create test user and get it. landing_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) self.assertTestUserPresenceOnPage(True) test_user_item = landing_page.findTestUser( BaseTest.TEST_USER_AS_DICT['name']) # Navigate to details dialog. details_dialog = landing_page.getDetailsDialogForItem(test_user_item) # Get the initial invite code. initial_invite_code = details_dialog.find_element( *LandingPage.USER_INVITE_CODE_TEXT).get_attribute('value') # Click new invite code on that user. get_invite_code_button = details_dialog.find_element( *LandingPage.USER_ROTATE_KEYS_BUTTON) get_invite_code_button.click() # Wait for post to finish, can take a while. WebDriverWait(self.driver, LandingPage.DEFAULT_TIMEOUT).until( EC.invisibility_of_element_located( ((LandingPage.USER_DETAILS_SPINNER)))) # Renavigate to the landing page to ensure the backend changed vs just a # UI update if specified. self.driver.get(self.args.server_url + flask.url_for('landing')) test_user_item = landing_page.findTestUser( BaseTest.TEST_USER_AS_DICT['name']) # Set the container element to find the disable/enable button and text on. # Will be either the item within the listbox or the overall details dialog. details_dialog = landing_page.getDetailsDialogForItem(test_user_item) # Check the invite code text changed. final_invite_code = details_dialog.find_element( *LandingPage.USER_INVITE_CODE_TEXT).get_attribute('value') self.assertNotEquals(initial_invite_code, final_invite_code) landing_page.tryToCloseDetailsDialogAndRefreshIfFail( self.args.server_url)
def testCreateNewInviteCode(self): """Test that creating a new invite code actually generates a new one.""" landing_page = LandingPage(self.driver) # Create test user and get it. landing_page.add_test_user(BaseTest.TEST_USER_AS_DICT['name'], BaseTest.TEST_USER_AS_DICT['email'], self.args.server_url) self.assertTestUserPresenceOnPage(True) test_user_item = landing_page.findTestUser( BaseTest.TEST_USER_AS_DICT['name']) # Navigate to details dialog. details_dialog = landing_page.getDetailsDialogForItem(test_user_item) # Get the initial invite code. initial_invite_code = details_dialog.find_element( *LandingPage.USER_INVITE_CODE_TEXT).get_attribute('value') # Click new invite code on that user. get_invite_code_button = details_dialog.find_element( *LandingPage.USER_ROTATE_KEYS_BUTTON) get_invite_code_button.click() # Wait for post to finish, can take a while. WebDriverWait(self.driver, LandingPage.DEFAULT_TIMEOUT).until( EC.invisibility_of_element_located((( LandingPage.USER_DETAILS_SPINNER)))) # Renavigate to the landing page to ensure the backend changed vs just a # UI update if specified. self.driver.get(self.args.server_url + flask.url_for('landing')) test_user_item = landing_page.findTestUser( BaseTest.TEST_USER_AS_DICT['name']) # Set the container element to find the disable/enable button and text on. # Will be either the item within the listbox or the overall details dialog. details_dialog = landing_page.getDetailsDialogForItem(test_user_item) # Check the invite code text changed. final_invite_code = details_dialog.find_element( *LandingPage.USER_INVITE_CODE_TEXT).get_attribute('value') self.assertNotEquals(initial_invite_code, final_invite_code) landing_page.tryToCloseDetailsDialogAndRefreshIfFail(self.args.server_url)