diff --git a/cms/djangoapps/contentstore/features/subsection.py b/cms/djangoapps/contentstore/features/subsection.py index 6d9612d9bd..68e65ee7ac 100644 --- a/cms/djangoapps/contentstore/features/subsection.py +++ b/cms/djangoapps/contentstore/features/subsection.py @@ -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:]+)?') diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index e8d5b1f2e7..f40108eb3a 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -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') diff --git a/common/djangoapps/terrain/ui_helpers.py b/common/djangoapps/terrain/ui_helpers.py index e4e0626779..75bc8bb2cb 100644 --- a/common/djangoapps/terrain/ui_helpers.py +++ b/common/djangoapps/terrain/ui_helpers.py @@ -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): diff --git a/lms/djangoapps/courseware/features/lti.py b/lms/djangoapps/courseware/features/lti.py index 0e91d5ed02..ef385cf2c9 100644 --- a/lms/djangoapps/courseware/features/lti.py +++ b/lms/djangoapps/courseware/features/lti.py @@ -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$') diff --git a/lms/djangoapps/courseware/features/problems_setup.py b/lms/djangoapps/courseware/features/problems_setup.py index 0253571b47..3b1b983fc3 100644 --- a/lms/djangoapps/courseware/features/problems_setup.py +++ b/lms/djangoapps/courseware/features/problems_setup.py @@ -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'