diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index a98087fe0e..3a65dcd846 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -223,6 +223,7 @@ def i_enabled_the_advanced_module(step, module): type_in_codemirror(0, '["%s"]' % module) press_the_notification_button(step, 'Save') + @world.absorb def add_unit(): world.clear_courses() diff --git a/cms/djangoapps/contentstore/features/course-team.py b/cms/djangoapps/contentstore/features/course-team.py index deba2d820d..4ccac98020 100644 --- a/cms/djangoapps/contentstore/features/course-team.py +++ b/cms/djangoapps/contentstore/features/course-team.py @@ -50,8 +50,8 @@ def other_delete_self(_step): @step(u'I make "([^"]*)" a course team admin') def make_course_team_admin(_step, name): - admin_btn_css = '.user-item[data-email="{email}"] .user-actions .add-admin-role'.format( - email=name+'@edx.org') + admin_btn_css = '.user-item[data-email="{name}@edx.org"] .user-actions .add-admin-role'.format( + name=name) world.css_click(admin_btn_css) @@ -80,8 +80,8 @@ def see_course(_step, do_not_see, gender='self'): @step(u'"([^"]*)" should( not)? be marked as an admin') def marked_as_admin(_step, name, not_marked_admin): - flag_css = '.user-item[data-email="{email}"] .flag-role.flag-role-admin'.format( - email=name+'@edx.org') + flag_css = '.user-item[data-email="{name}@edx.org"] .flag-role.flag-role-admin'.format( + name=name) if not_marked_admin: assert world.is_css_not_present(flag_css) else: diff --git a/cms/djangoapps/contentstore/features/course_import.py b/cms/djangoapps/contentstore/features/course_import.py index 0d26124d79..84b7affe30 100644 --- a/cms/djangoapps/contentstore/features/course_import.py +++ b/cms/djangoapps/contentstore/features/course_import.py @@ -2,6 +2,7 @@ import os from lettuce import world from django.conf import settings + def import_file(filename): world.browser.execute_script("$('input.file-input').css('display', 'block')") path = os.path.join(settings.COMMON_TEST_DATA_ROOT, "imports", filename) diff --git a/cms/djangoapps/contentstore/features/grading.py b/cms/djangoapps/contentstore/features/grading.py index b0db396081..dcc11857d8 100644 --- a/cms/djangoapps/contentstore/features/grading.py +++ b/cms/djangoapps/contentstore/features/grading.py @@ -180,7 +180,7 @@ def cannot_edit_fail(_step): def i_change_grace_period(_step, grace_period): grace_period_css = '#course-grading-graceperiod' ele = world.css_find(grace_period_css).first - + # Sometimes it takes a moment for the JavaScript # to populate the field. If we don't wait for # this to happen, then we can end up with diff --git a/cms/djangoapps/contentstore/features/textbooks.py b/cms/djangoapps/contentstore/features/textbooks.py index 2cf6683d6d..bac4e6bebc 100644 --- a/cms/djangoapps/contentstore/features/textbooks.py +++ b/cms/djangoapps/contentstore/features/textbooks.py @@ -47,7 +47,7 @@ def name_textbook(_step, name): @step(u'I name the (first|second|third) chapter "([^"]*)"') def name_chapter(_step, ordinal, name): index = ["first", "second", "third"].index(ordinal) - input_css = ".textbook .chapter{i} input.chapter-name".format(i=index+1) + input_css = ".textbook .chapter{i} input.chapter-name".format(i=index + 1) world.css_fill(input_css, name) if world.is_firefox(): world.trigger_event(input_css) @@ -56,7 +56,7 @@ def name_chapter(_step, ordinal, name): @step(u'I type in "([^"]*)" for the (first|second|third) chapter asset') def asset_chapter(_step, name, ordinal): index = ["first", "second", "third"].index(ordinal) - input_css = ".textbook .chapter{i} input.chapter-asset-path".format(i=index+1) + input_css = ".textbook .chapter{i} input.chapter-asset-path".format(i=index + 1) world.css_fill(input_css, name) if world.is_firefox(): world.trigger_event(input_css) @@ -65,7 +65,7 @@ def asset_chapter(_step, name, ordinal): @step(u'I click the Upload Asset link for the (first|second|third) chapter') def click_upload_asset(_step, ordinal): index = ["first", "second", "third"].index(ordinal) - button_css = ".textbook .chapter{i} .action-upload".format(i=index+1) + button_css = ".textbook .chapter{i} .action-upload".format(i=index + 1) world.css_click(button_css) diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index cf0d92fc94..22a4425686 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -191,7 +191,7 @@ def view_asset(_step, status): # Note that world.visit would trigger a 403 error instead of displaying "Unauthorized" # Instead, we can drop back into the selenium driver get command. world.browser.driver.get(url) - assert_equal(world.css_text('body'),expected_text) + assert_equal(world.css_text('body'), expected_text) @step('I see a confirmation that the file was deleted$') diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py index 7072501666..86f0419849 100644 --- a/common/djangoapps/terrain/steps.py +++ b/common/djangoapps/terrain/steps.py @@ -22,7 +22,7 @@ logger = getLogger(__name__) @step(r'I wait (?:for )?"(\d+\.?\d*)" seconds?$') -def wait(step, seconds): +def wait_for_seconds(step, seconds): world.wait(seconds) @@ -145,9 +145,9 @@ def should_see_in_the_page(step, doesnt_appear, text): else: multiplier = 1 if doesnt_appear: - assert world.browser.is_text_not_present(text, wait_time=5*multiplier) + assert world.browser.is_text_not_present(text, wait_time=5 * multiplier) else: - assert world.browser.is_text_present(text, wait_time=5*multiplier) + assert world.browser.is_text_present(text, wait_time=5 * multiplier) @step('I am logged in$')