diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-10-29 16:01:25 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-10-30 13:31:12 +0100 |
commit | e3d56597cd8aba4eee17a19f326f36bfcb3b90e2 (patch) | |
tree | e2accf27f042e11fd87e08113f033633fb773d46 /ipatests/test_webui/ui_driver.py | |
parent | 70c1e4a18588a257e64a8343b91c52c9f7afd954 (diff) | |
download | freeipa-e3d56597cd8aba4eee17a19f326f36bfcb3b90e2.tar.gz freeipa-e3d56597cd8aba4eee17a19f326f36bfcb3b90e2.tar.xz freeipa-e3d56597cd8aba4eee17a19f326f36bfcb3b90e2.zip |
Fix password expiration notification
- was broken by navigation and application controller refactoring
https://fedorahosted.org/freeipa/ticket/4003
Diffstat (limited to 'ipatests/test_webui/ui_driver.py')
-rw-r--r-- | ipatests/test_webui/ui_driver.py | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 46d7d6794..8603aa705 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -288,13 +288,13 @@ class UI_driver(object): """ return "contains(concat(' ',normalize-space(@%s), ' '),' %s ')" % (attr, val) - def init_app(self): + def init_app(self, login=None, password=None): """ Load and login """ self.load() self.wait(0.5) - self.login() + self.login(login, password) # metadata + default page self.wait_for_request(n=5) @@ -306,21 +306,39 @@ class UI_driver(object): runner = self WebDriverWait(self.driver, 10).until(lambda d: runner.files_loaded()) - def login(self): + def login(self, login=None, password=None, new_password=None): """ Log in if user is not logged in. """ self.wait_for_request(n=2) if not self.logged_in(): + + if not login: + login = self.config['ipa_admin'] + if not password: + password = self.config['ipa_password'] + if not new_password: + new_password = password + auth = self.get_auth_dialog() login_tb = self.find("//input[@type='text'][@name='username']", 'xpath', auth, strict=True) psw_tb = self.find("//input[@type='password'][@name='password']", 'xpath', auth, strict=True) - login_tb.send_keys(self.config['ipa_admin']) - psw_tb.send_keys(self.config['ipa_password']) + login_tb.send_keys(login) + psw_tb.send_keys(password) psw_tb.send_keys(Keys.RETURN) self.wait(0.5) self.wait_for_request() + # reset password if needed + if self.get_auth_dialog(): + newpw_tb = self.find("//input[@type='password'][@name='new_password']", 'xpath', auth, strict=True) + verify_tb = self.find("//input[@type='password'][@name='verify_password']", 'xpath', auth, strict=True) + 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): """ Check if user is logged in @@ -330,6 +348,10 @@ class UI_driver(object): logged_in = not self.auth_dialog_opened() and visible_name return logged_in + def logout(self): + btn = self.find('logout', 'class name') + btn.click() + def get_auth_dialog(self): """ Get reference to authentication dialog |