diff --git a/muranodashboard/dynamic_ui/fields.py b/muranodashboard/dynamic_ui/fields.py index 03157b9f8..2733e631a 100644 --- a/muranodashboard/dynamic_ui/fields.py +++ b/muranodashboard/dynamic_ui/fields.py @@ -348,12 +348,10 @@ class ChoiceField(forms.ChoiceField, CustomPropertiesField): if isinstance(choices, dict): choices = list(choices.items()) kwargs['choices'] = choices - kwargs['widget'] = hz_forms.ThemableSelectWidget(transform=_get_title) super(ChoiceField, self).__init__(**kwargs) -class DynamicChoiceField(hz_forms.ThemableDynamicChoiceField, - CustomPropertiesField): +class DynamicChoiceField(hz_forms.DynamicChoiceField, CustomPropertiesField): pass @@ -444,9 +442,8 @@ class Choice(object): class ImageChoiceField(ChoiceField): - widget = hz_forms.ThemableSelectWidget( - transform=_get_title, - transform_html_attrs=_disable_non_ready) + widget = hz_forms.SelectWidget(transform=_get_title, + transform_html_attrs=_disable_non_ready) def __init__(self, *args, **kwargs): self.image_type = kwargs.pop('image_type', None) diff --git a/muranodashboard/images/forms.py b/muranodashboard/images/forms.py index f1622d578..880c4fe38 100644 --- a/muranodashboard/images/forms.py +++ b/muranodashboard/images/forms.py @@ -59,15 +59,13 @@ class MarkImageForm(horizon_forms.SelfHandlingForm): 'custom': "Custom type" } - image = forms.ChoiceField( - label=_('Image'), - widget=horizon_forms.ThemableSelectWidget()) + image = forms.ChoiceField(label=_('Image')) title = forms.CharField(max_length="255", label=_("Title")) type = forms.ChoiceField( label=_("Type"), choices=_metadata.items(), initial='custom', - widget=horizon_forms.ThemableSelectWidget(attrs={ + widget=forms.Select(attrs={ 'class': 'switchable', 'data-slug': 'type'})) custom_type = forms.CharField( diff --git a/muranodashboard/packages/forms.py b/muranodashboard/packages/forms.py index ab93fe666..73be7fe1a 100644 --- a/muranodashboard/packages/forms.py +++ b/muranodashboard/packages/forms.py @@ -52,7 +52,7 @@ class ImportBundleForm(forms.Form): import_type = forms.ChoiceField( label=_("Package Bundle Source"), choices=IMPORT_BUNDLE_TYPE_CHOICES, - widget=horizon_forms.ThemableSelectWidget(attrs={ + widget=forms.Select(attrs={ 'class': 'switchable', 'data-slug': 'source'})) url = PackageURLField( @@ -88,7 +88,7 @@ class ImportPackageForm(forms.Form): import_type = forms.ChoiceField( label=_("Package Source"), choices=IMPORT_TYPE_CHOICES, - widget=horizon_forms.ThemableSelectWidget(attrs={ + widget=forms.Select(attrs={ 'class': 'switchable', 'data-slug': 'source'})) url = PackageURLField( diff --git a/muranodashboard/tests/functional/base.py b/muranodashboard/tests/functional/base.py index 7bb96fbcc..eeab93218 100644 --- a/muranodashboard/tests/functional/base.py +++ b/muranodashboard/tests/functional/base.py @@ -256,16 +256,12 @@ class UITestCase(testtools.TestCase): el.click() def select_from_list(self, list_name, value, sec=10): - self.check_element_on_page(by.By.CSS_SELECTOR, - consts.ThemableSelect.format(list_name)) - self.wait_element_is_clickable( - by.By.CSS_SELECTOR, consts.ThemableSelect.format( - list_name)).click() - self.check_element_on_page(by.By.CSS_SELECTOR, - consts.ThemableOption.format(value)) - self.wait_element_is_clickable( - by.By.CSS_SELECTOR, - consts.ThemableOption.format(value)).click() + locator = (by.By.XPATH, + "//select[contains(@name, '{0}')]" + "/option[@value='{1}']".format(list_name, value)) + el = ui.WebDriverWait(self.driver, sec).until( + EC.presence_of_element_located(locator)) + el.click() def check_element_on_page(self, method, value, sec=10): try: diff --git a/muranodashboard/tests/functional/consts.py b/muranodashboard/tests/functional/consts.py index 664ed47d3..24d0d5e4f 100644 --- a/muranodashboard/tests/functional/consts.py +++ b/muranodashboard/tests/functional/consts.py @@ -91,10 +91,9 @@ DeploymentHistoryLogs = "div#environment_details__env_logs div.reports.logs "\ "div.report-info" PackageFilterDropdownBtn = 'div.table_search > div.themable-select.dropdown >'\ ' button' +PackageFilterTypeBtn = "a[data-select-value='{0}']" PackageFilterInput = 'input[name="packages__filter_packages__q"]' PackageFilterBtn = "packages__action_filter_packages" -ThemableSelect = 'label[for$="{0}"] ~ div div button.dropdown-toggle' -ThemableOption = "a[data-select-value='{0}']" # Panels AppCatalog = "//*[@id='main_content']/nav//a[contains(text(), 'App Catalog')]" # noqa diff --git a/muranodashboard/tests/functional/sanity_check.py b/muranodashboard/tests/functional/sanity_check.py index 5bdee0116..568774ca5 100644 --- a/muranodashboard/tests/functional/sanity_check.py +++ b/muranodashboard/tests/functional/sanity_check.py @@ -2436,7 +2436,7 @@ class TestSuitePackages(base.PackageTestCase): self.wait_element_is_clickable( by.By.CSS_SELECTOR, c.PackageFilterDropdownBtn).click() self.wait_element_is_clickable( - by.By.CSS_SELECTOR, c.ThemableOption.format('name')).click() + by.By.CSS_SELECTOR, c.PackageFilterTypeBtn.format('name')).click() for package_name in packages_by_name: self.fill_field(by.By.CSS_SELECTOR, c.PackageFilterInput, @@ -2476,7 +2476,7 @@ class TestSuitePackages(base.PackageTestCase): self.wait_element_is_clickable( by.By.CSS_SELECTOR, c.PackageFilterDropdownBtn).click() self.wait_element_is_clickable( - by.By.CSS_SELECTOR, c.ThemableOption.format('type')).click() + by.By.CSS_SELECTOR, c.PackageFilterTypeBtn.format('type')).click() for package_type, package_list in packages_by_type.items(): self.fill_field(by.By.CSS_SELECTOR, c.PackageFilterInput, @@ -2532,7 +2532,7 @@ class TestSuitePackages(base.PackageTestCase): self.wait_element_is_clickable( by.By.CSS_SELECTOR, c.PackageFilterDropdownBtn).click() self.wait_element_is_clickable( - by.By.CSS_SELECTOR, c.ThemableOption.format('search'))\ + by.By.CSS_SELECTOR, c.PackageFilterTypeBtn.format('search'))\ .click() for keyword, package_name in packages_by_keyword.items(): @@ -2834,7 +2834,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_url') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_url") el = self.driver.find_element_by_css_selector( "input[name='upload-url']") @@ -2864,7 +2867,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -2901,8 +2907,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.ImportBundle).click() - - self.select_from_list('import_type', 'by_url') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_url") el = self.driver.find_element_by_css_selector( "input[name='upload-url']") @@ -2937,8 +2945,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.ImportBundle).click() - - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-name']") @@ -2971,8 +2981,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -2999,7 +3011,10 @@ class TestSuiteRepository(base.PackageTestCase): # Invalid folder self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_url') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_url") el = self.driver.find_element_by_css_selector( "input[name='upload-url']") el.send_keys("http://127.0.0.1:8099/None/{0}.zip".format(pkg_name)) @@ -3008,7 +3023,10 @@ class TestSuiteRepository(base.PackageTestCase): # HTTP connect error self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_url') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_url") el = self.driver.find_element_by_css_selector( "input[name='upload-url']") el.send_keys("http://127.0.0.2:12345/apps/{0}.zip".format(pkg_name)) @@ -3017,7 +3035,10 @@ class TestSuiteRepository(base.PackageTestCase): # Invalid app name self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_url') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_url") el = self.driver.find_element_by_css_selector( "input[name='upload-url']") el.send_keys( @@ -3037,7 +3058,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -3058,7 +3082,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -3082,7 +3109,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -3116,8 +3146,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -3153,7 +3185,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.UploadPackage).click() - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-repo_name']") @@ -3202,7 +3237,10 @@ class TestSuiteRepository(base.PackageTestCase): self.navigate_to('Manage') self.go_to_submenu('Packages') self.driver.find_element_by_id(c.ImportBundle).click() - self.select_from_list('import_type', 'by_name') + sel = self.driver.find_element_by_css_selector( + "select[name='upload-import_type']") + sel = ui.Select(sel) + sel.select_by_value("by_name") el = self.driver.find_element_by_css_selector( "input[name='upload-name']")