diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-22 13:40:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-24 11:24:03 +0100 |
commit | 56a8e5283e4e53ee108f91bf92843a30740c3a6e (patch) | |
tree | d2fb26489a691763a4292a42a9ccdb7e40dd0aee | |
parent | 1f2b8a27ead94d48148111c00f11056e328c03eb (diff) | |
download | poky-56a8e5283e4e53ee108f91bf92843a30740c3a6e.tar.gz |
bitbake: toaster/tests/browser/helper: Add wait for jquery to complete
Most of the tests that click on buttons need the DOM to stablise, including
any running JQuery code before the test can proceed. Add calls to do this
whenever we're about to click on an element.
(Bitbake rev: 0eb206b355248e2a874a62baec30025652f2a5a8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/toaster/tests/browser/selenium_helpers_base.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py index 4eea2267cc..6953541ab5 100644 --- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py | |||
@@ -234,6 +234,7 @@ class SeleniumTestCaseBase(unittest.TestCase): | |||
234 | 234 | ||
235 | def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT): | 235 | def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT): |
236 | """ Wait until element matching CSS selector is visible on the page """ | 236 | """ Wait until element matching CSS selector is visible on the page """ |
237 | WebDriverWait(self.driver, timeout=timeout).until(lambda driver: self.driver.execute_script("return jQuery.active == 0")) | ||
237 | is_clickable = lambda driver: (self.find(selector).is_displayed() and self.find(selector).is_enabled()) | 238 | is_clickable = lambda driver: (self.find(selector).is_displayed() and self.find(selector).is_enabled()) |
238 | msg = 'An element matching "%s" should be clickable' % selector | 239 | msg = 'An element matching "%s" should be clickable' % selector |
239 | Wait(self.driver, timeout=timeout).until(is_clickable, msg) | 240 | Wait(self.driver, timeout=timeout).until(is_clickable, msg) |
@@ -241,6 +242,7 @@ class SeleniumTestCaseBase(unittest.TestCase): | |||
241 | 242 | ||
242 | def wait_until_element_clickable(self, finder, timeout=Wait._TIMEOUT): | 243 | def wait_until_element_clickable(self, finder, timeout=Wait._TIMEOUT): |
243 | """ Wait until element is clickable """ | 244 | """ Wait until element is clickable """ |
245 | WebDriverWait(self.driver, timeout=timeout).until(lambda driver: self.driver.execute_script("return jQuery.active == 0")) | ||
244 | is_clickable = lambda driver: (finder(driver).is_displayed() and finder(driver).is_enabled()) | 246 | is_clickable = lambda driver: (finder(driver).is_displayed() and finder(driver).is_enabled()) |
245 | msg = 'A matching element never became be clickable' | 247 | msg = 'A matching element never became be clickable' |
246 | Wait(self.driver, timeout=timeout).until(is_clickable, msg) | 248 | Wait(self.driver, timeout=timeout).until(is_clickable, msg) |