summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-18 22:41:28 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-24 11:24:03 +0100
commit9c80b40ee5a98cf6e7b1cda6b2951b178ac28524 (patch)
tree612b306afa29634eb0824e9cb6236175f06d914e /bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
parent23483ff489f99c4c5f7b33b75d15592fbb1bfde2 (diff)
downloadpoky-9c80b40ee5a98cf6e7b1cda6b2951b178ac28524.tar.gz
bitbake: toaster/tests/browser/helpers: Drop remains of polling/sleep calls
Drop the remaining poll parameters from the helpers code along with the remaining sleep call since the tests no longer depend on this. This has the nice benefit of significantly speeding up the toaster test runs (45 minutes down to 12 minutes overall). If a parameter is needed, it should be the timeout, not the polling frequency. (Bitbake rev: 6de912e4f278ffd694fb2258482081dc3bc61c7a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/selenium_helpers_base.py')
-rw-r--r--bitbake/lib/toaster/tests/browser/selenium_helpers_base.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
index b664166055..45eabaf1ce 100644
--- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -186,7 +186,7 @@ class SeleniumTestCaseBase(unittest.TestCase):
186 self.driver.get(abs_url) 186 self.driver.get(abs_url)
187 187
188 try: # Ensure page is loaded before proceeding 188 try: # Ensure page is loaded before proceeding
189 self.wait_until_visible("#global-nav", poll=3) 189 self.wait_until_visible("#global-nav")
190 except NoSuchElementException: 190 except NoSuchElementException:
191 self.driver.implicitly_wait(3) 191 self.driver.implicitly_wait(3)
192 except TimeoutException: 192 except TimeoutException:
@@ -211,20 +211,18 @@ class SeleniumTestCaseBase(unittest.TestCase):
211 """ Return the element which currently has focus on the page """ 211 """ Return the element which currently has focus on the page """
212 return self.driver.switch_to.active_element 212 return self.driver.switch_to.active_element
213 213
214 def wait_until_present(self, selector, poll=0.5): 214 def wait_until_present(self, selector, timeout=Wait._TIMEOUT):
215 """ Wait until element matching CSS selector is on the page """ 215 """ Wait until element matching CSS selector is on the page """
216 is_present = lambda driver: self.find(selector) 216 is_present = lambda driver: self.find(selector)
217 msg = 'An element matching "%s" should be on the page' % selector 217 msg = 'An element matching "%s" should be on the page' % selector
218 element = Wait(self.driver, poll=poll).until(is_present, msg) 218 element = Wait(self.driver, timeout=timeout).until(is_present, msg)
219 if poll > 2:
220 time.sleep(poll) # element need more delay to be present
221 return element 219 return element
222 220
223 def wait_until_visible(self, selector, poll=1): 221 def wait_until_visible(self, selector, timeout=Wait._TIMEOUT):
224 """ Wait until element matching CSS selector is visible on the page """ 222 """ Wait until element matching CSS selector is visible on the page """
225 is_visible = lambda driver: self.find(selector).is_displayed() 223 is_visible = lambda driver: self.find(selector).is_displayed()
226 msg = 'An element matching "%s" should be visible' % selector 224 msg = 'An element matching "%s" should be visible' % selector
227 Wait(self.driver, poll=poll).until(is_visible, msg) 225 Wait(self.driver, timeout=timeout).until(is_visible, msg)
228 return self.find(selector) 226 return self.find(selector)
229 227
230 def wait_until_not_visible(self, selector, timeout=Wait._TIMEOUT): 228 def wait_until_not_visible(self, selector, timeout=Wait._TIMEOUT):
@@ -234,15 +232,14 @@ class SeleniumTestCaseBase(unittest.TestCase):
234 Wait(self.driver, timeout=timeout).until_not(is_visible, msg) 232 Wait(self.driver, timeout=timeout).until_not(is_visible, msg)
235 return self.find(selector) 233 return self.find(selector)
236 234
237 def wait_until_clickable(self, selector, poll=1): 235 def wait_until_clickable(self, selector, timeout=Wait._TIMEOUT):
238 """ Wait until element matching CSS selector is visible on the page """ 236 """ Wait until element matching CSS selector is visible on the page """
239 sel = selector 237 sel = selector
240 if sel.startswith('#'): 238 if sel.startswith('#'):
241 sel = selector[1:] 239 sel = selector[1:]
242 WebDriverWait( 240 WebDriverWait(
243 self.driver, 241 self.driver,
244 Wait._TIMEOUT, 242 timeout=timeout,
245 poll_frequency=poll
246 ).until( 243 ).until(
247 EC.element_to_be_clickable((By.ID, sel 244 EC.element_to_be_clickable((By.ID, sel
248 ) 245 )