diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-08-15 15:49:27 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-08-22 15:23:56 +0200 |
commit | 8e8afe0519c1d47994e155a3c72b2bdc934a9695 (patch) | |
tree | 3757db7220b85577630b2c39baab935932698050 /ipatests/test_webui/ui_driver.py | |
parent | e61c2e34411ad1713086813e938b09a464c4ffa6 (diff) | |
download | freeipa-8e8afe0519c1d47994e155a3c72b2bdc934a9695.tar.gz freeipa-8e8afe0519c1d47994e155a3c72b2bdc934a9695.tar.xz freeipa-8e8afe0519c1d47994e155a3c72b2bdc934a9695.zip |
Web UI integration tests: CA-less
Test cases according to: http://www.freeipa.org/page/V3/CA-less_install
https://fedorahosted.org/freeipa/ticket/3830
Diffstat (limited to 'ipatests/test_webui/ui_driver.py')
-rw-r--r-- | ipatests/test_webui/ui_driver.py | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 12d7e2320..9f448840c 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -567,7 +567,7 @@ class UI_driver(object): def _button_click(self, selector, parent, name=''): btn = self.find(selector, By.CSS_SELECTOR, parent, strict=True) - disabled = 'ui-state-disabled' in btn.get_attribute("class").split(' ') + disabled = 'ui-state-disabled' in btn.get_attribute("class").split() assert btn.is_displayed(), 'Button is not displayed: %s' % name assert not disabled, 'Invalid button state: disabled. Button: %s' % name btn.click() @@ -1425,7 +1425,7 @@ class UI_driver(object): facet = self.get_facet() btn = self.find(s, By.CSS_SELECTOR, facet, strict=True) cls = 'action-button-disabled' - has_cls = cls in btn.get_attribute("class").split(' ') + has_cls = cls in btn.get_attribute("class").split() valid = enabled ^ has_cls assert btn.is_displayed(), 'Button is not displayed' assert valid, 'Button has incorrect enabled state.' @@ -1510,7 +1510,7 @@ class UI_driver(object): """ Assert that element has certain class """ - valid = cls in element.get_attribute('class').split(' ') + valid = cls in element.get_attribute('class').split() if negative: assert not valid, "Element contains unwanted class: %s" % cls else: @@ -1522,3 +1522,35 @@ class UI_driver(object): """ for table in tables: self.assert_table_button_enabled('add', table, enabled) + + def assert_menu_item(self, path, present=True): + """ + Assert that menu link is not rendered or visible + """ + s = ".navigation a[href='#%s']" % path + link = self.find(s, By.CSS_SELECTOR) + is_present = link is not None and link.is_displayed() + assert present == is_present, ('Invalid state of navigation item: %s. ' + 'Presence expected: %s') % (path, str(present)) + + def assert_action_panel_action(self, panel_name, action, visible=True, enabled=True): + """ + Assert that action panel action is visible/hidden, and enabled/disabled + + Enabled is checked only if action is visible. + """ + s = "div[data-name='%s'].action-panel" % panel_name + s += " a[data-name='%s']" % action + link = self.find(s, By.CSS_SELECTOR) + + is_visible = link is not None and link.is_displayed() + is_enabled = False + if is_visible: + is_enabled = 'disabled' not in link.get_attribute("class").split() + + assert is_visible == visible, ('Invalid visibility of action button: %s. ' + 'Expected: %s') % (action, str(visible)) + + if is_visible: + assert is_enabled == enabled, ('Invalid enabled state of action button %s. ' + 'Expected: %s') % (action, str(visible)) |