diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index d3293c474e..3f91297755 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -161,9 +161,14 @@ def verify_all_setting_entries(expected_entries): @world.absorb -def save_component_and_reopen(step): +def save_component(step): world.css_click("a.save-button") world.wait_for_ajax_complete() + + +@world.absorb +def save_component_and_reopen(step): + save_component(step) # We have a known issue that modifications are still shown within the edit window after cancel (though) # they are not persisted. Refresh the browser to make sure the changes WERE persisted after Save. reload_the_page(step) diff --git a/cms/djangoapps/contentstore/features/course-export.feature b/cms/djangoapps/contentstore/features/course-export.feature new file mode 100644 index 0000000000..6dbd74da46 --- /dev/null +++ b/cms/djangoapps/contentstore/features/course-export.feature @@ -0,0 +1,11 @@ +@shard_1 +Feature: Course export + I want to export my course to a tar.gz file to share with others or check into source control + + Scenario: User is directed to unit with bad XML when export fails + Given I am in Studio editing a new unit + When I add a "Blank Advanced Problem" "Advanced Problem" component + And I edit and enter bad XML + And I export the course + Then I get an error dialog + And I can click to go to the unit with the error diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py new file mode 100644 index 0000000000..2770c81b6d --- /dev/null +++ b/cms/djangoapps/contentstore/features/course-export.py @@ -0,0 +1,44 @@ +# disable missing docstring +#pylint: disable=C0111 + +from lettuce import world, step +from common import type_in_codemirror +from nose.tools import assert_true, assert_equal + + +@step('I export the course$') +def i_export_the_course(step): + world.click_tools() + link_css = 'li.nav-course-tools-export a' + world.css_click(link_css) + world.css_click('a.action-export') + + +@step('I edit and enter bad XML$') +def i_enter_bad_xml(step): + world.edit_component() + type_in_codemirror( + 0, + """

Smallest Canvas

+

You want to make the smallest canvas you can.

+ + + + + + +
""" + ) + world.save_component(step) + + +@step('I get an error dialog$') +def get_an_error_dialog(step): + assert_true(world.is_css_present("div.prompt.error")) + + +@step('I can click to go to the unit with the error$') +def i_click_on_error_dialog(step): + world.click_link_by_text('Correct failed component') + assert_true(world.css_html("span.inline-error").startswith("Problem i4x://MITx/999/problem")) + assert_equal(1, world.browser.url.count("unit/MITx.999.Robot_Super_Course/branch/draft/block/vertical")) diff --git a/cms/templates/export.html b/cms/templates/export.html index c51945df09..6f2853e77d 100644 --- a/cms/templates/export.html +++ b/cms/templates/export.html @@ -15,7 +15,7 @@ var hasUnit = ${json.dumps(bool(unit))}, editUnitUrl = "${edit_unit_url or ""}", courseHomeUrl = "${course_home_url or ""}", - errMsg = "${raw_err_msg or ""}"; + errMsg = ${json.dumps(raw_err_msg or "")}; require(["domReady!", "gettext", "js/views/feedback_prompt"], function(doc, gettext, PromptView) { var dialog;