URL: https://github.com/freeipa/freeipa/pull/1929 Author: Rezney Title: #1929: [Backport][ipa-4-6] ui_tests: improve "field_validation" method Action: opened
PR body: """ This PR was opened automatically because PR #1920 was pushed to master and backport to ipa-4-6 is required. """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/1929/head:pr1929 git checkout pr1929
From ab6af97b7e6c4375d82503f9b35115dbc8666cdb Mon Sep 17 00:00:00 2001 From: Michal Reznik <mrez...@redhat.com> Date: Fri, 11 May 2018 08:20:39 +0200 Subject: [PATCH] ui_tests: improve "field_validation" method Often when trying to check e.g. required field we pass the method another element as parent in order to narrow down a scope for validation. This way we can just pass "field" name to make the process easier. https://pagure.io/freeipa/issue/7546 --- ipatests/test_webui/ui_driver.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 3e266dc9bf..ae66876e6d 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -2129,7 +2129,7 @@ def assert_action_list_action(self, action, visible=True, enabled=True, assert is_enabled == enabled, ('Invalid enabled state of action item %s. ' 'Expected: %s') % (action, str(visible)) - def assert_field_validation(self, expect_error, parent=None): + def assert_field_validation(self, expect_error, parent=None, field=None): """ Assert for error in field validation """ @@ -2137,14 +2137,18 @@ def assert_field_validation(self, expect_error, parent=None): if not parent: parent = self.get_form() + if field: + field_s = '.widget[name="{}"]'.format(field) + parent = self.find(field_s, By.CSS_SELECTOR, context=parent) + req_field_css = '.help-block[name="error_link"]' res = self.find(req_field_css, By.CSS_SELECTOR, context=parent) assert expect_error in res.text, \ 'Expected error: {} not found'.format(expect_error) - def assert_field_validation_required(self, parent=None): - self.assert_field_validation('Required field', parent) + def assert_field_validation_required(self, parent=None, field=None): + self.assert_field_validation('Required field', parent, field) def assert_notification(self, type='success', assert_text=None): """
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org