@@ -218,6 +218,13 @@ class SeleniumTestCaseBase(unittest.TestCase):
element = Wait(self.driver, timeout=timeout).until(is_present, msg)
return element
+ def wait_until_element_visible(self, element, timeout=Wait._TIMEOUT):
+ """ Wait until element matching CSS selector is visible on the page """
+ is_visible = lambda driver: element.is_displayed()
+ msg = 'An element should be visible'
+ Wait(self.driver, timeout=timeout).until(is_visible, msg)
+ return
+
def wait_until_visible(self, selector, timeout=Wait._TIMEOUT):
""" Wait until element matching CSS selector is visible on the page """
is_visible = lambda driver: self.find(selector).is_displayed()
@@ -100,7 +100,7 @@ class TestLayerDetailsPage(SeleniumTestCase):
(self.initial_values, value))
# Make sure the input visible beofre sending keys
- self.wait_until_clickable("#layer-git input[type=text]")
+ self.wait_until_element_visible(inputs)
inputs.send_keys("-edited")
# Save the new values
In this test case there are multiple elements matching the selector so the usual wait function isn't effective. Switch to waiting on the element directly, adding a new function to allow us to do so. This function is probably needed in other unreliable places in the tests too. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/toaster/tests/browser/selenium_helpers_base.py | 7 +++++++ lib/toaster/tests/browser/test_layerdetails_page.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)