From 4c126c7b28c4b09e69e7824a473b333d04aa3584 Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 30 Dec 2013 11:30:24 -0500 Subject: [PATCH 1/3] Add & to contents to verify that import/export still works. Part of STUD-91 --- common/test/data/simple/html/toylab.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/test/data/simple/html/toylab.html b/common/test/data/simple/html/toylab.html index 81df84bd63..72f8c05aca 100644 --- a/common/test/data/simple/html/toylab.html +++ b/common/test/data/simple/html/toylab.html @@ -1,3 +1,3 @@ Lab 2A: Superposition Experiment -

Isn't the toy course great?

+

Isn't the toy course great? &

From 0222e57cff96360ae0e6f1d323e349fc1ec5d747 Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 30 Dec 2013 12:25:47 -0500 Subject: [PATCH 2/3] Add acceptance test for behavior when & is in problem xml. Part of STUD-91 --- .../features/component_settings_editor_helpers.py | 12 ++++++++++++ .../contentstore/features/course-export.feature | 8 ++++++++ .../contentstore/features/course-export.py | 11 ++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 3f91297755..8495d6a3f5 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -4,6 +4,7 @@ from lettuce import world from nose.tools import assert_equal, assert_in # pylint: disable=E0611 from terrain.steps import reload_the_page +from common import type_in_codemirror @world.absorb @@ -114,6 +115,17 @@ def edit_component(): world.css_click('a.edit-button') +@world.absorb +def enter_xml_in_advanced_problem(step, text): + """ + Edits an advanced problem (assumes only on page), + types the provided XML, and saves the component. + """ + world.edit_component() + type_in_codemirror(0, text) + world.save_component(step) + + @world.absorb def verify_setting_entry(setting, display_name, value, explicitly_set): """ diff --git a/cms/djangoapps/contentstore/features/course-export.feature b/cms/djangoapps/contentstore/features/course-export.feature index 6dbd74da46..ff92c2e646 100644 --- a/cms/djangoapps/contentstore/features/course-export.feature +++ b/cms/djangoapps/contentstore/features/course-export.feature @@ -9,3 +9,11 @@ Feature: Course export And I export the course Then I get an error dialog And I can click to go to the unit with the error + + Scenario: User is directed to problem with & in it 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 an ampersand + 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 index 2770c81b6d..ff636f1fa8 100644 --- a/cms/djangoapps/contentstore/features/course-export.py +++ b/cms/djangoapps/contentstore/features/course-export.py @@ -2,7 +2,6 @@ #pylint: disable=C0111 from lettuce import world, step -from common import type_in_codemirror from nose.tools import assert_true, assert_equal @@ -16,9 +15,7 @@ def i_export_the_course(step): @step('I edit and enter bad XML$') def i_enter_bad_xml(step): - world.edit_component() - type_in_codemirror( - 0, + world.enter_xml_in_advanced_problem(step, """

Smallest Canvas

You want to make the smallest canvas you can.

@@ -29,7 +26,11 @@ def i_enter_bad_xml(step):
""" ) - world.save_component(step) + + +@step('I edit and enter an ampersand$') +def i_enter_bad_xml(step): + world.enter_xml_in_advanced_problem(step, "&") @step('I get an error dialog$') From a80101dda2b94a1b18760bfa390444e160677b9a Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 6 Jan 2014 11:48:40 -0500 Subject: [PATCH 3/3] Don't add every helper method to world. --- .../features/component_settings_editor_helpers.py | 1 - cms/djangoapps/contentstore/features/course-export.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 8495d6a3f5..932c21b7a6 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -115,7 +115,6 @@ def edit_component(): world.css_click('a.edit-button') -@world.absorb def enter_xml_in_advanced_problem(step, text): """ Edits an advanced problem (assumes only on page), diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py index ff636f1fa8..b0b9845088 100644 --- a/cms/djangoapps/contentstore/features/course-export.py +++ b/cms/djangoapps/contentstore/features/course-export.py @@ -2,6 +2,7 @@ #pylint: disable=C0111 from lettuce import world, step +from component_settings_editor_helpers import enter_xml_in_advanced_problem from nose.tools import assert_true, assert_equal @@ -15,7 +16,7 @@ def i_export_the_course(step): @step('I edit and enter bad XML$') def i_enter_bad_xml(step): - world.enter_xml_in_advanced_problem(step, + enter_xml_in_advanced_problem(step, """

Smallest Canvas

You want to make the smallest canvas you can.

@@ -30,7 +31,7 @@ def i_enter_bad_xml(step): @step('I edit and enter an ampersand$') def i_enter_bad_xml(step): - world.enter_xml_in_advanced_problem(step, "&") + enter_xml_in_advanced_problem(step, "&") @step('I get an error dialog$')