Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
eba1bd09
Commit
eba1bd09
authored
Jun 26, 2013
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor and update acceptance tests around saving settings.
parent
9094f189
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
29 deletions
+90
-29
cms/djangoapps/contentstore/features/advanced-settings.feature
+6
-0
cms/djangoapps/contentstore/features/advanced-settings.py
+2
-16
cms/djangoapps/contentstore/features/common.py
+36
-4
cms/djangoapps/contentstore/features/course-settings.feature
+24
-6
cms/djangoapps/contentstore/features/course-settings.py
+1
-0
cms/djangoapps/contentstore/features/grading.feature
+21
-3
No files found.
cms/djangoapps/contentstore/features/advanced-settings.feature
View file @
eba1bd09
...
...
@@ -46,3 +46,9 @@ Feature: Advanced (manual) course policy
Then
it is displayed as a string
And
I reload the page
Then
it is displayed as a string
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
cms/djangoapps/contentstore/features/advanced-settings.py
View file @
eba1bd09
...
...
@@ -2,8 +2,8 @@
#pylint: disable=W0621
from
lettuce
import
world
,
step
from
nose.tools
import
assert_false
,
assert_equal
,
assert_regexp_matches
from
common
import
type_in_codemirror
from
nose.tools
import
assert_false
,
assert_equal
,
assert_regexp_matches
,
assert_true
from
common
import
type_in_codemirror
,
press_the_notification_button
KEY_CSS
=
'.key input.policy-key'
VALUE_CSS
=
'textarea.json'
...
...
@@ -25,20 +25,6 @@ def i_am_on_advanced_course_settings(step):
step
.
given
(
'I select the Advanced Settings'
)
@step
(
u'I press the "([^"]*)" notification button$'
)
def
press_the_notification_button
(
step
,
name
):
css
=
'a.action-
%
s'
%
name
.
lower
()
# Save was clicked if either the save notification bar is gone, or we have a error notification
# overlaying it (expected in the case of typing Object into display_name).
def
save_clicked
():
confirmation_dismissed
=
world
.
is_css_not_present
(
'.is-shown.wrapper-notification-warning'
)
error_showing
=
world
.
is_css_present
(
'.is-shown.wrapper-notification-error'
)
return
confirmation_dismissed
or
error_showing
world
.
css_click
(
css
,
success_condition
=
save_clicked
)
@step
(
u'I edit the value of a policy key$'
)
def
edit_the_value_of_a_policy_key
(
step
):
type_in_codemirror
(
get_index_of
(
DISPLAY_NAME_KEY
),
'X'
)
...
...
cms/djangoapps/contentstore/features/common.py
View file @
eba1bd09
...
...
@@ -12,6 +12,8 @@ import time
from
logging
import
getLogger
logger
=
getLogger
(
__name__
)
from
terrain.browser
import
reset_data
_COURSE_NAME
=
'Robot Super Course'
_COURSE_NUM
=
'999'
_COURSE_ORG
=
'MITx'
...
...
@@ -54,11 +56,41 @@ def i_press_the_category_delete_icon(_step, category):
def
i_have_opened_a_new_course
(
_step
):
open_new_course
()
@step
(
u'I press the "([^"]*)" notification button$'
)
def
press_the_notification_button
(
step
,
name
):
css
=
'a.action-
%
s'
%
name
.
lower
()
# Save was clicked if either the save notification bar is gone, or we have a error notification
# overlaying it (expected in the case of typing Object into display_name).
def
save_clicked
():
confirmation_dismissed
=
world
.
is_css_not_present
(
'.is-shown.wrapper-notification-warning'
)
error_showing
=
world
.
is_css_present
(
'.is-shown.wrapper-notification-error'
)
return
confirmation_dismissed
or
error_showing
assert_true
(
world
.
css_click
(
css
,
success_condition
=
save_clicked
),
'Save button not clicked after 5 attempts.'
)
@step
(
'I change the "(.*)" field to "(.*)"$'
)
def
i_change_field_to_value
(
step
,
field
,
value
):
# Special casing this because we should type into CodeMirror
field_css
=
'#
%
s'
%
'-'
.
join
([
s
.
lower
()
for
s
in
field
.
split
()])
if
field_css
==
'#course-overview'
:
type_in_codemirror
(
0
,
value
)
else
:
ele
=
world
.
css_find
(
field_css
)
.
first
ele
.
fill
(
value
)
ele
.
_element
.
send_keys
(
Keys
.
ENTER
)
@step
(
'I reset the database'
)
def
reset_the_db
(
step
):
reset_data
(
None
)
@step
(
'I
(save|cancel) my changes$
'
)
def
save_changes
(
step
,
action
):
button_css
=
'.action-
%
s'
%
action
world
.
css_click
(
butt
on_css
)
@step
(
'I
see a confirmation that my changes have been saved
'
)
def
i_see_a_confirmation
(
step
):
confirmation_css
=
'#alert-confirmation'
assert
world
.
is_css_present
(
confirmati
on_css
)
####### HELPER FUNCTIONS ##############
...
...
cms/djangoapps/contentstore/features/course-settings.feature
View file @
eba1bd09
...
...
@@ -5,18 +5,18 @@ Feature: Course Settings
Given
I have opened a new course in Studio
When
I select Schedule and Details
And
I set course dates
And
I
save my changes
And
I
press the
"Save"
notification button
Then
I see the set dates on refresh
Scenario
:
User can clear previously set course dates (except start date)
Given
I have set course dates
And
I clear all the dates except start
And
I
save my changes
And
I
press the
"Save"
notification button
Then
I see cleared dates on refresh
Scenario
:
User cannot clear the course start date
Given
I have set course dates
And
I
save my changes
And
I
press the
"Save"
notification button
And
I clear the course start date
Then
I receive a warning about course start date
And
The previously set start date is shown on refresh
...
...
@@ -24,13 +24,31 @@ Feature: Course Settings
Scenario
:
User can correct the course start date warning
Given
I have tried to clear the course start
And
I have entered a new course start date
And
I
save my changes
And
I
press the
"Save"
notification button
Then
The warning about course start date goes away
And
My new course start date is shown on refresh
Scenario
:
Settings are only persisted when saved
Given
I have set course dates
And
I
save my changes
And
I
press the
"Save"
notification button
When
I change fields
And
I
cancel my changes
And
I
press the
"Cancel"
notification button
Then
I do not see the new changes persisted on refresh
Scenario
:
Confirmation is shown on save
Given
I have opened a new course in Studio
When
I select Schedule and Details
And
I change the
"<field>"
field to
"<value>"
And
I press the
"Save"
notification button
Then
I see a confirmation that my changes have been saved
# Lettuce hooks don't get called between each example, so we need
# to run the before.each_scenario hook manually to avoid database
# errors.
And
I reset the database
Examples
:
|
field
|
value
|
|
Course
Start
Time
|
11:00
|
|
Course
Overview
|
<h1>Overview</h1>
|
|
Course
Introduction
Video
|
4r7wHMg5Yjg
|
|
Course
Effort
|
200:00
|
cms/djangoapps/contentstore/features/course-settings.py
View file @
eba1bd09
...
...
@@ -4,6 +4,7 @@
from
lettuce
import
world
,
step
from
terrain.steps
import
reload_the_page
from
selenium.webdriver.common.keys
import
Keys
from
common
import
type_in_codemirror
import
time
from
nose.tools
import
assert_true
,
assert_false
,
assert_equal
...
...
cms/djangoapps/contentstore/features/grading.feature
View file @
eba1bd09
...
...
@@ -32,7 +32,7 @@ Feature: Course Grading
And
I have populated the course
And
I am viewing the grading settings
When
I change assignment type
"Homework"
to
"New Type"
And
I
save my changes
And
I
press the
"Save"
notification button
And
I go back to the main course page
Then
I do see the assignment name
"New Type"
And
I do not see the assignment name
"Homework"
...
...
@@ -42,6 +42,7 @@ Feature: Course Grading
And
I have populated the course
And
I am viewing the grading settings
When
I delete the assignment type
"Homework"
And
I press the
"Save"
notification button
And
I go back to the main course page
Then
I do not see the assignment name
"Homework"
...
...
@@ -50,7 +51,7 @@ Feature: Course Grading
And
I have populated the course
And
I am viewing the grading settings
When
I add a new assignment type
"New Type"
And
I
save my changes
And
I
press the
"Save"
notification button
And
I go back to the main course page
Then
I do see the assignment name
"New Type"
...
...
@@ -59,5 +60,22 @@ Feature: Course Grading
And
I have populated the course
And
I am viewing the grading settings
When
I change assignment type
"Homework"
to
"New Type"
And
I
cancel my changes
And
I
press the
"Cancel"
notification button
Then
I do not see the changes persisted on refresh
Scenario
:
Confirmation is shown on save
Given
I have opened a new course in Studio
And
I have populated the course
And
I am viewing the grading settings
When
I change the
"<field>"
field to
"<value>"
And
I press the
"Save"
notification button
Then
I see a confirmation that my changes have been saved
# Lettuce hooks don't get called between each example, so we need
# to run the before.each_scenario hook manually to avoid database
# errors.
And
I reset the database
Examples
:
|
field
|
value
|
|
Course
Grading
Graceperiod
|
1:00
|
|
Course
Grading
Assignment
Name
|
New
Assignment
Name
|
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment