From 592da268707926ac542313694fbcf25703d34e6c Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Tue, 1 Mar 2016 17:32:36 +0300 Subject: [PATCH] Fix BaseRegion and TabbedFormRegion initialization Now `src_elem` and `_default_src_locator` properties work in conjunction - if both are specified, `_default_src_locator` is being searched in the provided `src_elem`. This fixes the issue of binding table tabs instead of form tabs on the same page. Co-Authored-By: Georgy Dyuldin Change-Id: Id91d82062d4145f37c7b1a33fca56bf7e441aa6e Closes-Bug: #1549632 --- .../test/integration_tests/regions/baseregion.py | 8 +++----- .../test/integration_tests/regions/forms.py | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/test/integration_tests/regions/baseregion.py b/openstack_dashboard/test/integration_tests/regions/baseregion.py index bd373a599c..5a47280ba8 100644 --- a/openstack_dashboard/test/integration_tests/regions/baseregion.py +++ b/openstack_dashboard/test/integration_tests/regions/baseregion.py @@ -30,11 +30,9 @@ class BaseRegion(basewebobject.BaseWebObject): # private methods def __init__(self, driver, conf, src_elem=None): super(BaseRegion, self).__init__(driver, conf) - if src_elem is None and self._default_src_locator: - # fake self.src_elem must be set up in - # order self._get_element work - self.src_elem = driver - src_elem = self._get_element(*self._default_src_locator) + if self._default_src_locator: + root = src_elem or driver + src_elem = root.find_element(*self._default_src_locator) self.src_elem = src_elem or driver diff --git a/openstack_dashboard/test/integration_tests/regions/forms.py b/openstack_dashboard/test/integration_tests/regions/forms.py index c1fab204f9..6d3cb34aec 100644 --- a/openstack_dashboard/test/integration_tests/regions/forms.py +++ b/openstack_dashboard/test/integration_tests/regions/forms.py @@ -388,7 +388,8 @@ class TabbedFormRegion(FormRegion): @property def tabs(self): - return menus.TabbedMenuRegion(self.driver, self.conf) + return menus.TabbedMenuRegion(self.driver, self.conf, + src_elem=self.src_elem) class DateFormRegion(BaseFormRegion):