Commit 7635a96d by Muddasser Hussain Committed by Muddasser

advanced_settins.feature conversion to lettuce

parent 7bca66c2
@shard_1
Feature: CMS.Advanced (manual) course policy
In order to specify course policy settings for which no custom user interface exists
I want to be able to manually enter JSON key /value pairs
Scenario: A course author sees default advanced settings
Given I have opened a new course in Studio
When I select the Advanced Settings
Then I see default advanced settings
Scenario: Add new entries, and they appear alphabetically after save
Given I am on the Advanced Course Settings page in Studio
Then the settings are alphabetized
# Sauce labs does not play nicely with CodeMirror
@skip_sauce
Scenario: Test cancel editing key value
Given I am on the Advanced Course Settings page in Studio
When I edit the value of a policy key
And I press the "Cancel" notification button
Then the policy key value is unchanged
And I reload the page
Then the policy key value is unchanged
# Sauce labs does not play nicely with CodeMirror
@skip_sauce
Scenario: Test editing key value
Given I am on the Advanced Course Settings page in Studio
When I edit the value of a policy key and save
Then the policy key value is changed
And I reload the page
Then the policy key value is changed
# Sauce labs does not play nicely with CodeMirror
@skip_sauce
Scenario: Test how multi-line input appears
Given I am on the Advanced Course Settings page in Studio
When I create a JSON object as a value for "Discussion Topic Mapping"
Then it is displayed as formatted
And I reload the page
Then it is displayed as formatted
# Sauce labs does not play nicely with CodeMirror
@skip_sauce
Scenario: Test error if value supplied is of the wrong type
Given I am on the Advanced Course Settings page in Studio
When I create a JSON object as a value for "Course Display Name"
Then I get an error on save
And I reload the page
Then the policy key value is unchanged
# This feature will work in Firefox only when Firefox is the active window
# Sauce labs does not play nicely with CodeMirror
@skip_sauce
Scenario: Test automatic quoting of non-JSON values
Given I am on the Advanced Course Settings page in Studio
When I create a non-JSON value not in quotes
Then it is displayed as a string
And I reload the page
Then it is displayed as a string
# Sauce labs does not play nicely with CodeMirror
@skip_sauce
Scenario: Confirmation is shown on save
Given I am on the Advanced Course Settings page in Studio
When I edit the value of a policy key
And I press the "Save" notification button
Then I see a confirmation that my changes have been saved
Scenario: Deprecated Settings are not shown by default
Given I am on the Advanced Course Settings page in Studio
Then deprecated settings are not shown
Scenario: Deprecated Settings can be toggled
Given I am on the Advanced Course Settings page in Studio
When I toggle the display of deprecated settings
Then deprecated settings are then shown
And I toggle the display of deprecated settings
Then deprecated settings are not shown
......@@ -107,6 +107,13 @@ class AdvancedSettingsPage(CoursePage):
return -1
def get_index_of(self, key):
"""
Returns the index of a setting passed as key.
Returns -1 when key is not found.
"""
return self._get_index_of(key)
def save(self):
press_the_notification_button(self, "Save")
......@@ -118,6 +125,19 @@ class AdvancedSettingsPage(CoursePage):
type_in_codemirror(self, index, new_value)
self.save()
def set_value_without_saving(self, key, new_value):
"""
Set value without saving it.
"""
index = self._get_index_of(key)
type_in_codemirror(self, index, new_value)
def click_toggle_button(self):
"""
Click toggle button with css class deprecated-settings-label.
"""
self.q(css='.deprecated-settings-label').click()
def get(self, key):
index = self._get_index_of(key)
return get_codemirror_value(self, index)
......@@ -222,3 +242,10 @@ class AdvancedSettingsPage(CoursePage):
'learning_info',
'instructor_info'
]
def get_all_displayed_settings(self):
"""
Get names of all displayed settings.
"""
query = self.q(css=SETTINGS_NAME_SELECTOR)
return query.text
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