Commit 2d17c00e by Jay Zoldak

Merge pull request #1223 from edx/zoldak/fix-acceptance-text-customization

Modify acceptance tests to account for the new text_customization...
parents 3ec8df9f cce37583
...@@ -65,13 +65,29 @@ def edit_component(): ...@@ -65,13 +65,29 @@ def edit_component():
@world.absorb @world.absorb
def verify_setting_entry(setting, display_name, value, explicitly_set): def verify_setting_entry(setting, display_name, value, explicitly_set):
"""
Verify the capa module fields are set as expected in the
Advanced Settings editor.
Parameters
----------
setting: the WebDriverElement object found in the browser
display_name: the string expected as the label
value: the expected field value
explicitly_set: True if the value is expected to have been explicitly set
for the problem, rather than derived from the defaults. This is verified
by the existence of a "Clear" button next to the field value.
"""
assert_equal(display_name, setting.find_by_css('.setting-label')[0].value) assert_equal(display_name, setting.find_by_css('.setting-label')[0].value)
# Check specifically for the list type; it has a different structure
# Check if the web object is a list type
# If so, we use a slightly different mechanism for determining its value
if setting.has_class('metadata-list-enum'): if setting.has_class('metadata-list-enum'):
list_value = ', '.join(ele.value for ele in setting.find_by_css('.list-settings-item')) list_value = ', '.join(ele.value for ele in setting.find_by_css('.list-settings-item'))
assert_equal(value, list_value) assert_equal(value, list_value)
else: else:
assert_equal(value, setting.find_by_css('.setting-input')[0].value) assert_equal(value, setting.find_by_css('.setting-input')[0].value)
settingClearButton = setting.find_by_css('.setting-clear')[0] settingClearButton = setting.find_by_css('.setting-clear')[0]
assert_equal(explicitly_set, settingClearButton.has_class('active')) assert_equal(explicitly_set, settingClearButton.has_class('active'))
assert_equal(not explicitly_set, settingClearButton.has_class('inactive')) assert_equal(not explicitly_set, settingClearButton.has_class('inactive'))
......
...@@ -5,7 +5,7 @@ Feature: CMS.Problem Editor ...@@ -5,7 +5,7 @@ Feature: CMS.Problem Editor
Scenario: User can view metadata Scenario: User can view metadata
Given I have created a Blank Common Problem Given I have created a Blank Common Problem
When I edit and select Settings When I edit and select Settings
Then I see five alphabetized settings and their expected values Then I see the advanced settings and their expected values
And Edit High Level Source is not visible And Edit High Level Source is not visible
# Safari is having trouble saving the values on sauce # Safari is having trouble saving the values on sauce
......
...@@ -10,9 +10,9 @@ MAXIMUM_ATTEMPTS = "Maximum Attempts" ...@@ -10,9 +10,9 @@ MAXIMUM_ATTEMPTS = "Maximum Attempts"
PROBLEM_WEIGHT = "Problem Weight" PROBLEM_WEIGHT = "Problem Weight"
RANDOMIZATION = 'Randomization' RANDOMIZATION = 'Randomization'
SHOW_ANSWER = "Show Answer" SHOW_ANSWER = "Show Answer"
TEXT_CUSTOMIZATION = "text_customization"
############### ACTIONS ####################
@step('I have created a Blank Common Problem$') @step('I have created a Blank Common Problem$')
def i_created_blank_common_problem(step): def i_created_blank_common_problem(step):
world.create_component_instance( world.create_component_instance(
...@@ -29,15 +29,16 @@ def i_edit_and_select_settings(step): ...@@ -29,15 +29,16 @@ def i_edit_and_select_settings(step):
world.edit_component_and_select_settings() world.edit_component_and_select_settings()
@step('I see five alphabetized settings and their expected values$') @step('I see the advanced settings and their expected values$')
def i_see_five_settings_with_values(step): def i_see_advanced_settings_with_values(step):
world.verify_all_setting_entries( world.verify_all_setting_entries(
[ [
[DISPLAY_NAME, "Blank Common Problem", True], [DISPLAY_NAME, "Blank Common Problem", True],
[MAXIMUM_ATTEMPTS, "", False], [MAXIMUM_ATTEMPTS, "", False],
[PROBLEM_WEIGHT, "", False], [PROBLEM_WEIGHT, "", False],
[RANDOMIZATION, "Never", False], [RANDOMIZATION, "Never", False],
[SHOW_ANSWER, "Finished", False] [SHOW_ANSWER, "Finished", False],
[TEXT_CUSTOMIZATION, "[object Object]", False]
]) ])
...@@ -159,7 +160,7 @@ def edit_high_level_source_links_visible(step): ...@@ -159,7 +160,7 @@ def edit_high_level_source_links_visible(step):
def cancel_does_not_save_changes(step): def cancel_does_not_save_changes(step):
world.cancel_component(step) world.cancel_component(step)
step.given("I edit and select Settings") step.given("I edit and select Settings")
step.given("I see five alphabetized settings and their expected values") step.given("I see the advanced settings and their expected values")
@step('I have created a LaTeX Problem') @step('I have created a LaTeX Problem')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment