ui_tests: select_combobox() fixes

Move strict "search_btn" element finding to later so we
do not fail when using combobox without search button.
Also switch open_btn.click() before fill_textbox() as it
is used to close the selection.

https://pagure.io/freeipa/issue/7441

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Michal Reznik 2018-03-13 22:14:49 +01:00 committed by Christian Heimes
parent 16083eb9b5
commit bf1f2d1c3f

View File

@ -872,19 +872,19 @@ class UI_driver(object):
self.wait_for_request()
list_cnt = self.find('.combobox-widget-list', By.CSS_SELECTOR, cb, strict=True)
search_btn = self.find('a[name=search] i', By.CSS_SELECTOR, cb, strict=True)
opt_s = "select[name=list] option[value='%s']" % value
option = self.find(opt_s, By.CSS_SELECTOR, cb)
if combobox_input:
if not option:
self.fill_textbox(combobox_input, value, cb)
open_btn.click()
self.fill_textbox(combobox_input, value, cb)
else:
if not option:
# try to search
self.fill_textbox('filter', value, cb)
search_btn = self.find('a[name=search] i', By.CSS_SELECTOR, cb,
strict=True)
search_btn.click()
self.wait_for_request()
option = self.find(opt_s, By.CSS_SELECTOR, cb, strict=True)