URL: https://github.com/freeipa/freeipa/pull/1920
Author: Rezney
 Title: #1920: ui_tests: improve "field_validation" method
Action: opened

PR body:
"""
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.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1920/head:pr1920
git checkout pr1920
From 274dc0304b86ff8cd0cfbf9e89a18d86d7a30c9e Mon Sep 17 00:00:00 2001
From: Michal Reznik <mrez...@redhat.com>
Date: Fri, 11 May 2018 08:20:39 +0200
Subject: [PATCH 1/2] 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.
---
 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 34d21ae35d..1febc3d367 100644
--- a/ipatests/test_webui/ui_driver.py
+++ b/ipatests/test_webui/ui_driver.py
@@ -2139,7 +2139,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
         """
@@ -2147,14 +2147,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):
         """

From b94fc69ae3f269b154af2a04a3cfbee08098c9c5 Mon Sep 17 00:00:00 2001
From: Michal Reznik <mrez...@redhat.com>
Date: Fri, 11 May 2018 08:34:25 +0200
Subject: [PATCH 2/2] TEMP_COMMIT: activate web_ui tests

---
 .freeipa-pr-ci.yaml | 174 +++++++++-------------------------------------------
 1 file changed, 28 insertions(+), 146 deletions(-)

diff --git a/.freeipa-pr-ci.yaml b/.freeipa-pr-ci.yaml
index 88d34d58fc..cf937d4b6e 100644
--- a/.freeipa-pr-ci.yaml
+++ b/.freeipa-pr-ci.yaml
@@ -3,6 +3,9 @@ topologies:
     name: build
     cpu: 2
     memory: 3800
+  ipaserver: &ipaserver
+    name: ipaserver
+    cpu: 1
   master_1repl: &master_1repl
     name: master_1repl
     cpu: 4
@@ -27,183 +30,62 @@ jobs:
         timeout: 1800
         topology: *build
 
-  fedora-27/simple_replication:
+  fedora-27/test_webui_a_to_d:
     requires: [fedora-27/build]
     priority: 50
     job:
-      class: RunPytest
+      class: RunWebuiTests
       args:
         build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_simple_replication.py
+        test_suite: test_webui/test_[a-d]\*.py
         template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
+        timeout: 7200
+        topology: *ipaserver
 
-  fedora-27/caless:
+  fedora-27/test_webui_g_to_m:
     requires: [fedora-27/build]
     priority: 50
     job:
-      class: RunPytest
+      class: RunWebuiTests
       args:
         build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_caless.py::TestServerReplicaCALessToCAFull
+        test_suite: test_webui/test_[g-m]\*.py
         template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
+        timeout: 7200
+        topology: *ipaserver
 
-  fedora-27/external_ca:
+  fedora-27/test_webui_n_to_r:
     requires: [fedora-27/build]
     priority: 50
     job:
-      class: RunPytest
+      class: RunWebuiTests
       args:
         build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_external_ca.py::TestExternalCA test_integration/test_external_ca.py::TestSelfExternalSelf test_integration/test_external_ca.py::TestExternalCAInstall
+        test_suite: 'test_webui/test_[n-r]*.py --'
         template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
+        timeout: 7200
+        topology: *ipaserver
 
-  fedora-27/test_topologies:
+  fedora-27/test_webui_s_to_z:
     requires: [fedora-27/build]
     priority: 50
     job:
-      class: RunPytest
+      class: RunWebuiTests
       args:
         build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_topologies.py
+        test_suite: test_webui/test_[s-z]\*.py
         template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
+        timeout: 7200
+        topology: *ipaserver
 
-  fedora-27/test_sudo:
+  fedora-27/test_webui:
     requires: [fedora-27/build]
     priority: 50
     job:
-      class: RunPytest
+      class: RunWebuiTests
       args:
         build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_sudo.py
+        test_suite: test_webui/
         template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl_1client
-
-  fedora-27/test_ipa_cli:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_ipa_cli.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
-
-  fedora-27/test_kerberos_flags:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_kerberos_flags.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl_1client
-
-  fedora-27/test_http_kdc_proxy:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_http_kdc_proxy.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl_1client
-
-  fedora-27/test_forced_client_enrolment:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_forced_client_reenrollment.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl_1client
-
-  fedora-27/test_advise:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_advise.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
-
-  fedora-27/test_testconfig:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_testconfig.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
-
-  fedora-27/test_service_permissions:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_service_permissions.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
-
-  fedora-27/test_netgroup:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_netgroup.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
-
-  fedora-27/test_vault:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_vault.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl
-
-  fedora-27/test_authconfig:
-    requires: [fedora-27/build]
-    priority: 50
-    job:
-      class: RunPytest
-      args:
-        build_url: '{fedora-27/build_url}'
-        test_suite: test_integration/test_authselect.py
-        template: *ci-master-f27
-        timeout: 3600
-        topology: *master_1repl_1client
-
+        timeout: 16000
+        topology: *ipaserver
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to