WebUI Tests: changing how the login screen is detected

The "rcue-login-screen" element does not exist anymore. Changing the
code to use the ".login-pf" instead.

With the change, it's also necessary to check if the login screen is still
visible when trying to fill the fields of new password, otherwise a
StaleElementReferenceException exception will be raised.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Felipe Barreto 2018-01-23 16:02:01 -02:00 committed by Christian Heimes
parent 7c3f9b79eb
commit 49a17e98b0

View File

@ -385,14 +385,15 @@ class UI_driver(object):
self.wait_for_request(n=2)
# reset password if needed
newpw_tb = self.find("//input[@type='password'][@name='new_password']", 'xpath', auth)
verify_tb = self.find("//input[@type='password'][@name='verify_password']", 'xpath', auth)
if newpw_tb and newpw_tb.is_displayed():
newpw_tb.send_keys(new_password)
verify_tb.send_keys(new_password)
verify_tb.send_keys(Keys.RETURN)
self.wait(0.5)
self.wait_for_request(n=2)
if self.login_screen_visible():
newpw_tb = self.find("//input[@type='password'][@name='new_password']", 'xpath', auth)
verify_tb = self.find("//input[@type='password'][@name='verify_password']", 'xpath', auth)
if newpw_tb and newpw_tb.is_displayed():
newpw_tb.send_keys(new_password)
verify_tb.send_keys(new_password)
verify_tb.send_keys(Keys.RETURN)
self.wait(0.5)
self.wait_for_request(n=2)
def logged_in(self):
"""
@ -405,12 +406,13 @@ class UI_driver(object):
def logout(self):
self.profile_menu_action('logout')
assert self.login_screen_visible()
def get_login_screen(self):
"""
Get reference of login screen
"""
return self.find('rcue-login-screen', 'id')
return self.find('.login-pf', By.CSS_SELECTOR)
def login_screen_visible(self):
"""