Advanced settings bokchoy tests II
This commit is contained in:
@@ -3,15 +3,6 @@ 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
|
||||
|
||||
# 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
|
||||
@@ -40,18 +31,6 @@ Feature: CMS.Advanced (manual) course policy
|
||||
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
|
||||
|
||||
@@ -51,6 +51,12 @@ class AdvancedSettingsPage(CoursePage):
|
||||
"""
|
||||
return self.q(css=DEPRECATED_SETTINGS_BUTTON_SELECTOR).text[0]
|
||||
|
||||
def check_deprecated_settings_visibility(self):
|
||||
"""
|
||||
Returns true if deprecated settings are visible
|
||||
"""
|
||||
return self.q(css=DEPRECATED_SETTINGS_SELECTOR).visible
|
||||
|
||||
def wait_for_modal_load(self):
|
||||
"""
|
||||
Wait for validation response from the server, and make sure that
|
||||
@@ -69,6 +75,14 @@ class AdvancedSettingsPage(CoursePage):
|
||||
self.browser.refresh()
|
||||
self.wait_for_page()
|
||||
|
||||
@property
|
||||
def confirmation_message(self):
|
||||
"""
|
||||
Returns the text of confirmation message which appears after saving the settings
|
||||
"""
|
||||
self.wait_for_element_visibility(CONFIRMATION_MESSAGE_SELECTOR, 'Confirmation message is visible')
|
||||
return self.q(css=CONFIRMATION_MESSAGE_SELECTOR).text[0]
|
||||
|
||||
def coordinates_for_scrolling(self, coordinates_for):
|
||||
"""
|
||||
Get the x and y coordinates of elements
|
||||
|
||||
@@ -5,6 +5,8 @@ Acceptance tests for Studio's Setting pages
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
from textwrap import dedent
|
||||
|
||||
from bok_choy.promise import EmptyPromise
|
||||
@@ -369,21 +371,72 @@ class AdvancedSettingsValidationTest(StudioCourseTest):
|
||||
self.assertNotEqual(
|
||||
original_course_display_name,
|
||||
new_course_name,
|
||||
('original course name:{} can not not be equal to unsaved course name {}'.format(
|
||||
original_course_display_name,
|
||||
new_course_name
|
||||
)
|
||||
(
|
||||
'original course name:{} can not not be equal to unsaved course name {}'.format(
|
||||
original_course_display_name,
|
||||
new_course_name
|
||||
)
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
self.advanced_settings.get(self.course_name_key),
|
||||
original_course_display_name,
|
||||
('course name from the page should be same as original_course_display_name:{}'.format(
|
||||
original_course_display_name
|
||||
)
|
||||
(
|
||||
'course name from the page should be same as original_course_display_name:{}'.format(
|
||||
original_course_display_name
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def test_editing_key_value(self):
|
||||
"""
|
||||
Scenario: Test that advanced settings saves the key value, if save button
|
||||
is clicked from notification bar after the editing
|
||||
Given a staff logs in to studio
|
||||
When this user goes to advanced settings page and enters a new course name
|
||||
And he clicks 'save' button from the notification bar
|
||||
Then he is able to see the updated course name
|
||||
"""
|
||||
new_course_name = ''.join(random.choice(string.ascii_uppercase) for _ in range(10))
|
||||
self.advanced_settings.set(self.course_name_key, new_course_name)
|
||||
self.assertEqual(
|
||||
self.advanced_settings.get(self.course_name_key),
|
||||
'"{}"'.format(new_course_name),
|
||||
(
|
||||
'course name from the page should be same as new_course_name:{}'.format(
|
||||
new_course_name
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def test_confirmation_is_shown_on_save(self):
|
||||
"""
|
||||
Scenario: Test that advanced settings shows confirmation after editing a field successfully
|
||||
Given a staff logs in to studio
|
||||
When this user goes to advanced settings page and edits any value
|
||||
And he clicks 'save' button from the notification bar
|
||||
Then he is able to see the confirmation message
|
||||
"""
|
||||
self.advanced_settings.set('Maximum Attempts', 5)
|
||||
confirmation_message = self.advanced_settings.confirmation_message
|
||||
self.assertEqual(
|
||||
confirmation_message,
|
||||
'Your policy changes have been saved.',
|
||||
'Settings must be saved successfully in order to have confirmation message'
|
||||
)
|
||||
|
||||
def test_deprecated_settings_invisible_by_default(self):
|
||||
"""
|
||||
Scenario: Test that advanced settings does not have deprecated settings by default
|
||||
Given a staff logs in to studio
|
||||
When this user goes to advanced settings page
|
||||
Then the user does not see the deprecated settings
|
||||
And sees 'Show Deprecated Settings' button
|
||||
"""
|
||||
button_text = self.advanced_settings.deprecated_settings_button_text
|
||||
self.assertEqual(button_text, 'Show Deprecated Settings')
|
||||
self.assertFalse(self.advanced_settings.check_deprecated_settings_visibility())
|
||||
|
||||
def test_modal_shows_one_validation_error(self):
|
||||
"""
|
||||
Test that advanced settings don't save if there's a single wrong input,
|
||||
|
||||
Reference in New Issue
Block a user