Commit 73e03883 by Jay Zoldak

Merge pull request #1083 from edx/zoldak/speedy-lms-acceptance

Speed up lms acceptance tests
parents 6d41669b 002f3ef9
......@@ -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):
......
......@@ -22,7 +22,13 @@ def lti_is_not_rendered(_step):
#inside iframe test content is not presented
with world.browser.get_iframe('ltiLaunchFrame') as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
assert iframe.is_element_not_present_by_css('.result', wait_time=5)
world.browser.driver.implicitly_wait(1)
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$')
......
......@@ -144,7 +144,7 @@ PROBLEM_DICT = {
]
},
'correct': ['section.choicetextgroup_correct'],
'incorrect': ['span.incorrect', 'section.choicetextgroup_incorrect'],
'incorrect': ['section.choicetextgroup_incorrect', 'span.incorrect'],
'unanswered': ['span.unanswered']},
'checkbox_text': {
......@@ -242,7 +242,7 @@ def answer_problem(problem_type, correctness):
def problem_has_answer(problem_type, answer_class):
if problem_type == "drop down":
if answer_class == 'blank':
assert world.browser.is_element_not_present_by_css('option[selected="true"]')
assert world.is_css_not_present('option[selected="true"]')
else:
actual = world.browser.find_by_css('option[selected="true"]').value
expected = 'Option 2' if answer_class == 'correct' else 'Option 3'
......
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