Commit d9fb0673 by cahrens

Test point for formatting of JSON entry.

parent dd959d11
......@@ -21,4 +21,10 @@ Feature: Advanced (manual) course policy
And I create New Entries
Then they are alphabetized
And I reload the page
Then they are alphabetized
\ No newline at end of file
Then they are alphabetized
Scenario: Test how multi-line input appears
Given I have opened a new course in Studio
When I select the Advanced Settings
And I create a JSON object
Then it is displayed as formatted
\ No newline at end of file
......@@ -45,6 +45,19 @@ def create_new_entries(step):
def they_are_alphabetized(step):
assert_policy_entries(["a", "display_name", "z"], ['"zebra"', '"Robot Super Course"', '"apple"'])
@step('I create a JSON object$')
def create_JSON_object(step):
create_entry("json", '{"key": "value", "key_2": "value_2"}')
click_save()
@step('it is displayed as formatted$')
def it_is_formatted(step):
assert_policy_entries(["display_name", "json"], ['"Robot Super Course"', '{\n "key": "value",\n "key_2": "value_2"\n}'])
# TODO: this is copied from terrain's step.py. Need to figure out how to share that code.
@step('I reload the page$')
def reload_the_page(step):
world.browser.reload()
def create_entry(key, value):
css_click_at('a.new-advanced-policy-item')
......@@ -53,7 +66,8 @@ def create_entry(key, value):
# For some reason have to get the instance for each command (get error that it is no longer attached to the DOM)
# Have to do all this because Selenium has a bug that fill does not remove existing text
css_find('.CodeMirror textarea').last.double_click()
css_find('.CodeMirror textarea').last._element.send_keys(Keys.ARROW_LEFT)
css_find('.CodeMirror textarea').last._element.send_keys(Keys.BACK_SPACE)
css_find('.CodeMirror textarea').last._element.send_keys(Keys.BACK_SPACE)
css_find('.CodeMirror textarea').last.fill(value)
......
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