Commit 002f3ef9 by Jay Zoldak

Speed up waiting for elements not present on remote webdriver sessions.

parent 20ea2874
......@@ -109,7 +109,7 @@ def i_see_my_subsection_name_with_quote_on_the_courseware_page(step):
@step('the subsection does not exist$')
def the_subsection_does_not_exist(step):
css = 'span.subsection-name'
assert world.browser.is_element_not_present_by_css(css)
assert world.is_css_not_present(css)
@step('I see the subsection release date is ([0-9/-]+)( [0-9:]+)?')
......
......@@ -119,6 +119,7 @@ def initial_setup(server):
if not success:
raise IOError("Could not acquire valid {driver} browser session.".format(driver=browser_driver))
world.absorb(0, 'IMPLICIT_WAIT')
world.browser.driver.set_window_size(1280, 1024)
elif world.LETTUCE_SELENIUM_CLIENT == 'saucelabs':
......@@ -128,7 +129,7 @@ def initial_setup(server):
url="http://{}:{}@ondemand.saucelabs.com:80/wd/hub".format(config['username'], config['access-key']),
**make_saucelabs_desired_capabilities()
)
world.browser.driver.implicitly_wait(30)
world.absorb(30, 'IMPLICIT_WAIT')
elif world.LETTUCE_SELENIUM_CLIENT == 'grid':
world.browser = Browser(
......@@ -136,11 +137,12 @@ def initial_setup(server):
url=settings.SELENIUM_GRID.get('URL'),
browser=settings.SELENIUM_GRID.get('BROWSER'),
)
world.browser.driver.implicitly_wait(30)
world.absorb(30, 'IMPLICIT_WAIT')
else:
raise Exception("Unknown selenium client '{}'".format(world.LETTUCE_SELENIUM_CLIENT))
world.browser.driver.implicitly_wait(world.IMPLICIT_WAIT)
world.absorb(world.browser.driver.session_id, 'jobid')
......
......@@ -36,8 +36,13 @@ def is_css_present(css_selector, wait_time=10):
@world.absorb
def is_css_not_present(css_selector, wait_time=5):
return world.browser.is_element_not_present_by_css(css_selector, wait_time=wait_time)
world.browser.driver.implicitly_wait(1)
try:
return world.browser.is_element_not_present_by_css(css_selector, wait_time=wait_time)
except:
raise
finally:
world.browser.driver.implicitly_wait(world.IMPLICIT_WAIT)
@world.absorb
def css_has_text(css_selector, text, index=0):
......
......@@ -23,9 +23,12 @@ def lti_is_not_rendered(_step):
with world.browser.get_iframe('ltiLaunchFrame') as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
world.browser.driver.implicitly_wait(1)
result = iframe.is_element_not_present_by_css('.result', wait_time=1)
world.browser.driver.implicitly_wait(world.IMPLICIT_WAIT)
assert result
try:
assert iframe.is_element_not_present_by_css('.result', wait_time=1)
except:
raise
finally:
world.browser.driver.implicitly_wait(world.IMPLICIT_WAIT)
@step('I view the LTI and it is rendered$')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment