diff options
Diffstat (limited to 'ipatests/test_webui')
-rw-r--r-- | ipatests/test_webui/ui_driver.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 780f7f8a0..4eb0d27b3 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -1715,7 +1715,7 @@ class UI_driver(object): 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() + is_enabled = not self.has_class(link, 'disabled') assert is_visible == visible, ('Invalid visibility of action button: %s. ' 'Expected: %s') % (action, str(visible)) @@ -1723,3 +1723,26 @@ class UI_driver(object): if is_visible: assert is_enabled == enabled, ('Invalid enabled state of action button %s. ' 'Expected: %s') % (action, str(visible)) + + def assert_action_list_action(self, action, visible=True, enabled=True, parent=None): + """ + Assert that action dropdown action is visible/hidden, and enabled/disabled + + Enabled is checked only if action is visible. + """ + if not parent: + parent = self.get_form() + + s = ".facet-actions li[data-name='%s'] a" % action + link = self.find(s, By.CSS_SELECTOR, parent) + + is_visible = link is not None and link.is_displayed() + is_enabled = False + + assert is_visible == visible, ('Invalid visibility of action item: %s. ' + 'Expected: %s') % (action, str(visible)) + + if is_visible: + is_enabled = not self.has_class(link, 'disabled') + assert is_enabled == enabled, ('Invalid enabled state of action item %s. ' + 'Expected: %s') % (action, str(visible)) |