diff --git a/cms/djangoapps/contentstore/features/advanced-settings.py b/cms/djangoapps/contentstore/features/advanced-settings.py index cdba6d9cb2..18e179abdb 100644 --- a/cms/djangoapps/contentstore/features/advanced-settings.py +++ b/cms/djangoapps/contentstore/features/advanced-settings.py @@ -2,7 +2,7 @@ #pylint: disable=W0621 from lettuce import world, step -from nose.tools import assert_false, assert_equal, assert_regexp_matches, assert_true +from nose.tools import assert_false, assert_equal, assert_regexp_matches from common import type_in_codemirror, press_the_notification_button KEY_CSS = '.key input.policy-key' @@ -90,18 +90,18 @@ def the_policy_key_value_is_changed(step): ############# HELPERS ############### def assert_policy_entries(expected_keys, expected_values): - for counter in range(len(expected_keys)): - index = get_index_of(expected_keys[counter]) - assert_false(index == -1, "Could not find key: " + expected_keys[counter]) - assert_equal(expected_values[counter], world.css_find(VALUE_CSS)[index].value, "value is incorrect") + for key, value in zip(expected_keys, expected_values): + index = get_index_of(key) + assert_false(index == -1, "Could not find key: {key}".format(key=key)) + assert_equal(value, world.css_find(VALUE_CSS)[index].value, "value is incorrect") def get_index_of(expected_key): - for counter in range(len(world.css_find(KEY_CSS))): - # Sometimes get stale reference if I hold on to the array of elements - key = world.css_value(KEY_CSS, index=counter) + for i, element in enumerate(world.css_find(KEY_CSS)): + # Sometimes get stale reference if I hold on to the array of elements + key = world.css_value(KEY_CSS, index=i) if key == expected_key: - return counter + return i return -1 diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 3a30e0bc81..e99d1cecd1 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -60,12 +60,10 @@ $(document).ready(function() { $('.nav-dd .nav-item .title').removeClass('is-selected'); }); - $('.nav-dd .nav-item .title').click(function(e) { + $('.nav-dd .nav-item').click(function(e) { - $subnav = $(this).parent().find('.wrapper-nav-sub'); - $title = $(this).parent().find('.title'); - e.preventDefault(); - e.stopPropagation(); + $subnav = $(this).find('.wrapper-nav-sub'); + $title = $(this).find('.title'); if ($subnav.hasClass('is-shown')) { $subnav.removeClass('is-shown'); @@ -75,6 +73,9 @@ $(document).ready(function() { $('.nav-dd .nav-item .wrapper-nav-sub').removeClass('is-shown'); $title.addClass('is-selected'); $subnav.addClass('is-shown'); + // if propogation is not stopped, the event will bubble up to the + // body element, which will close the dropdown. + e.stopPropagation(); } }); diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index ec361a9aff..c2bf2bbbf3 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -75,7 +75,7 @@ def initial_setup(server): # If we were unable to get a valid session within the limit of attempts, # then we cannot run the tests. if not success: - raise IOError("Could not acquire valid ChromeDriver browser session.") + raise IOError("Could not acquire valid {driver} browser session.".format(driver=browser_driver)) # Set the browser size to 1280x1024 world.browser.driver.set_window_size(1280, 1024) diff --git a/common/djangoapps/terrain/ui_helpers.py b/common/djangoapps/terrain/ui_helpers.py index e69f53a5dc..2b81e9bd7f 100644 --- a/common/djangoapps/terrain/ui_helpers.py +++ b/common/djangoapps/terrain/ui_helpers.py @@ -216,22 +216,19 @@ def save_the_html(path='/tmp'): @world.absorb def click_course_content(): course_content_css = 'li.nav-course-courseware' - if world.browser.is_element_present_by_css(course_content_css): - world.css_click(course_content_css) + world.css_click(course_content_css) @world.absorb def click_course_settings(): course_settings_css = 'li.nav-course-settings' - if world.browser.is_element_present_by_css(course_settings_css): - world.css_click(course_settings_css) + world.css_click(course_settings_css) @world.absorb def click_tools(): tools_css = 'li.nav-course-tools' - if world.browser.is_element_present_by_css(tools_css): - world.css_click(tools_css) + world.css_click(tools_css) @world.absorb diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index dd9d8b5a3e..99d9e410a1 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -80,8 +80,8 @@ nosexcover==1.0.7 pep8==1.4.5 pylint==0.28 rednose==0.3 -selenium==2.31.0 -splinter==0.5.0 +selenium==2.33.0 +splinter==0.5.4 django_nose==1.1 django-jasmine==0.3.2 django_debug_toolbar