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
66375b85
Commit
66375b85
authored
Jan 08, 2015
by
cahrens
Committed by
Andy Armstrong
Jan 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bok choy test for editing of content groups on Group Configuration page.
parent
ebeb9a99
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
238 additions
and
59 deletions
+238
-59
cms/static/js/spec/views/pages/group_configurations_spec.js
+1
-1
cms/static/js/views/list_item.js
+10
-0
cms/static/js/views/pages/group_configurations.js
+2
-2
cms/templates/js/mock/mock-group-configuration-page.underscore
+1
-1
common/test/acceptance/pages/studio/settings_group_configurations.py
+60
-12
common/test/acceptance/tests/studio/test_studio_settings.py
+121
-0
common/test/acceptance/tests/studio/test_studio_split_test.py
+43
-43
No files found.
cms/static/js/spec/views/pages/group_configurations_spec.js
View file @
66375b85
...
...
@@ -52,7 +52,7 @@ define([
expect
(
view
.
$
(
'.ui-loading'
)).
toBeVisible
();
view
.
render
();
expect
(
view
.
$
(
groupConfigItemClassName
)).
toExist
();
expect
(
view
.
$
(
'.co
hor
t-groups .no-group-configurations-content'
)).
toExist
();
expect
(
view
.
$
(
'.co
nten
t-groups .no-group-configurations-content'
)).
toExist
();
expect
(
view
.
$
(
'.ui-loading'
)).
toHaveClass
(
'is-hidden'
);
});
});
...
...
cms/static/js/views/list_item.js
View file @
66375b85
...
...
@@ -25,6 +25,16 @@ define([
this
.
listenTo
(
this
.
model
,
'remove'
,
this
.
remove
);
},
className
:
function
()
{
var
index
=
this
.
model
.
collection
.
indexOf
(
this
.
model
);
return
[
'group-configuration'
,
'group-configurations-list-item'
,
'group-configurations-list-item-'
+
index
].
join
(
' '
);
},
deleteItem
:
function
(
event
)
{
if
(
event
&&
event
.
preventDefault
)
{
event
.
preventDefault
();
}
if
(
!
this
.
canDelete
)
{
return
;
}
...
...
cms/static/js/views/pages/group_configurations.js
View file @
66375b85
...
...
@@ -23,9 +23,9 @@ function ($, _, gettext, BasePage, GroupConfigurationsListView, ContentGroupList
renderPage
:
function
()
{
var
hash
=
this
.
getLocationHash
();
if
(
this
.
experimentsEnabled
)
{
this
.
$
(
'.experiment-groups'
).
append
(
this
.
experimentGroupsListView
.
render
().
el
);
this
.
$
(
'.
wrapper-groups.
experiment-groups'
).
append
(
this
.
experimentGroupsListView
.
render
().
el
);
}
this
.
$
(
'.
cohor
t-groups'
).
append
(
this
.
cohortGroupsListView
.
render
().
el
);
this
.
$
(
'.
wrapper-groups.conten
t-groups'
).
append
(
this
.
cohortGroupsListView
.
render
().
el
);
this
.
addWindowActions
();
if
(
hash
)
{
// Strip leading '#' to get id string to match
...
...
cms/templates/js/mock/mock-group-configuration-page.underscore
View file @
66375b85
...
...
@@ -11,7 +11,7 @@
<div class="wrapper-content wrapper">
<section class="content">
<article class="content-primary" role="main">
<div class="wrapper-groups co
hor
t-groups">
<div class="wrapper-groups co
nten
t-groups">
<div class="ui-loading">
<p><span class="spin"><i class="icon fa fa-refresh"></i></span> <span class="copy">Loading</span></p>
</div>
...
...
common/test/acceptance/pages/studio/settings_group_configurations.py
View file @
66375b85
...
...
@@ -12,6 +12,8 @@ class GroupConfigurationsPage(CoursePage):
"""
url_path
=
"group_configurations"
experiment_groups_css
=
".experiment-groups"
content_groups_css
=
".content-groups"
def
is_browser_on_page
(
self
):
"""
...
...
@@ -30,26 +32,72 @@ class GroupConfigurationsPage(CoursePage):
return
True
@property
def
group_configurations
(
self
):
def
experiment_
group_configurations
(
self
):
"""
Return list of the group configurations for the course.
Return list of the
experiment
group configurations for the course.
"""
css
=
'.group-configurations-list-item'
return
[
GroupConfiguration
(
self
,
index
)
for
index
in
xrange
(
len
(
self
.
q
(
css
=
css
)))]
return
self
.
_get_groups
(
self
.
experiment_groups_css
)
def
create
(
self
):
@property
def
content_groups
(
self
):
"""
Return list of the content groups for the course.
"""
return
self
.
_get_groups
(
self
.
content_groups_css
)
def
_get_groups
(
self
,
prefix
):
"""
Return list of the group-configurations-list-item's of specified type for the course.
"""
css
=
prefix
+
' .group-configurations-list-item'
return
[
GroupConfiguration
(
self
,
prefix
,
index
)
for
index
in
xrange
(
len
(
self
.
q
(
css
=
css
)))]
def
create_experiment_group_configuration
(
self
):
"""
Creates new group configuration.
"""
self
.
q
(
css
=
".experiment-groups .new-button"
)
.
first
.
click
()
self
.
q
(
css
=
self
.
experiment_groups_css
+
" .new-button"
)
.
first
.
click
()
def
create_first_content_group
(
self
):
"""
Creates new content group when there are none initially defined.
"""
self
.
q
(
css
=
self
.
content_groups_css
+
" .new-button"
)
.
first
.
click
()
def
add_content_group
(
self
):
"""
Creates new content group when at least one already exists
"""
self
.
q
(
css
=
self
.
content_groups_css
+
" .action-add"
)
.
first
.
click
()
@property
def
no_experiment_groups_message_is_present
(
self
):
return
self
.
_no_content_message
(
self
.
experiment_groups_css
)
.
present
@property
def
no_content_groups_message_is_present
(
self
):
return
self
.
_no_content_message
(
self
.
content_groups_css
)
.
present
@property
def
no_experiment_groups_message_text
(
self
):
return
self
.
_no_content_message
(
self
.
experiment_groups_css
)
.
text
[
0
]
@property
def
no_group_configuration_message_is_present
(
self
):
return
self
.
q
(
css
=
'.wrapper-content .experiment-groups .no-group-configurations-content'
)
.
present
def
no_content_groups_message_text
(
self
):
return
self
.
_no_content_message
(
self
.
content_groups_css
)
.
text
[
0
]
def
_no_content_message
(
self
,
prefix
):
"""
Returns the message about "no content" for the specified type.
"""
return
self
.
q
(
css
=
'.wrapper-content '
+
prefix
+
' .no-group-configurations-content'
)
@property
def
no_group_configuration_message_text
(
self
):
return
self
.
q
(
css
=
'.wrapper-content .experiment-groups .no-group-configurations-content'
)
.
text
[
0
]
def
experiment_group_sections_present
(
self
):
"""
Returns whether or not anything related to content experiments is present.
"""
return
self
.
q
(
css
=
self
.
experiment_groups_css
)
.
present
or
self
.
q
(
css
=
".experiment-groups-doc"
)
.
present
class
GroupConfiguration
(
object
):
...
...
@@ -57,9 +105,9 @@ class GroupConfiguration(object):
Group Configuration wrapper.
"""
def
__init__
(
self
,
page
,
index
):
def
__init__
(
self
,
page
,
prefix
,
index
):
self
.
page
=
page
self
.
SELECTOR
=
'
.group-configurations-list-item-{}'
.
format
(
index
)
self
.
SELECTOR
=
prefix
+
'
.group-configurations-list-item-{}'
.
format
(
index
)
self
.
index
=
index
def
get_selector
(
self
,
css
=
''
):
...
...
common/test/acceptance/tests/studio/test_studio_settings.py
View file @
66375b85
...
...
@@ -7,6 +7,127 @@ from nose.plugins.attrib import attr
from
base_studio_test
import
StudioCourseTest
from
...pages.studio.settings_advanced
import
AdvancedSettingsPage
from
...pages.studio.settings_group_configurations
import
GroupConfigurationsPage
@attr
(
'shard_1'
)
class
ContentGroupConfigurationTest
(
StudioCourseTest
):
"""
Tests for content groups in the Group Configurations Page.
There are tests for the experiment groups in test_studio_split_test.
"""
def
setUp
(
self
):
super
(
ContentGroupConfigurationTest
,
self
)
.
setUp
()
self
.
group_configurations_page
=
GroupConfigurationsPage
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
]
)
def
create_and_verify_content_group
(
self
,
name
,
existing_groups
):
"""
Creates a new content group and verifies that it was properly created.
"""
self
.
assertEqual
(
existing_groups
,
len
(
self
.
group_configurations_page
.
content_groups
))
if
existing_groups
==
0
:
self
.
group_configurations_page
.
create_first_content_group
()
else
:
self
.
group_configurations_page
.
add_content_group
()
config
=
self
.
group_configurations_page
.
content_groups
[
existing_groups
]
config
.
name
=
name
# Save the content group
self
.
assertEqual
(
config
.
get_text
(
'.action-primary'
),
"Create"
)
self
.
assertTrue
(
config
.
delete_button_is_absent
)
config
.
save
()
self
.
assertIn
(
name
,
config
.
name
)
return
config
def
test_no_content_groups_by_default
(
self
):
"""
Scenario: Ensure that message telling me to create a new content group is
shown when no content groups exist.
Given I have a course without content groups
When I go to the Group Configuration page in Studio
Then I see "You have not created any content groups yet." message
"""
self
.
group_configurations_page
.
visit
()
self
.
assertTrue
(
self
.
group_configurations_page
.
no_content_groups_message_is_present
)
self
.
assertIn
(
"You have not created any content groups yet."
,
self
.
group_configurations_page
.
no_content_groups_message_text
)
def
test_can_create_and_edit_content_groups
(
self
):
"""
Scenario: Ensure that the content groups can be created and edited correctly.
Given I have a course without content groups
When I click button 'Add your first Content Group'
And I set new the name and click the button 'Create'
Then I see the new content is added and has correct data
And I click 'New Content Group' button
And I set the name and click the button 'Create'
Then I see the second content group is added and has correct data
When I edit the second content group
And I change the name and click the button 'Save'
Then I see the second content group is saved successfully and has the new name
"""
self
.
group_configurations_page
.
visit
()
self
.
create_and_verify_content_group
(
"New Content Group"
,
0
)
second_config
=
self
.
create_and_verify_content_group
(
"Second Content Group"
,
1
)
# Edit the second content group
second_config
.
edit
()
second_config
.
name
=
"Updated Second Content Group"
self
.
assertEqual
(
second_config
.
get_text
(
'.action-primary'
),
"Save"
)
second_config
.
save
()
self
.
assertIn
(
"Updated Second Content Group"
,
second_config
.
name
)
def
test_cannot_delete_content_group
(
self
):
"""
Scenario: Delete is not currently supported for content groups.
Given I have a course without content groups
When I create a content group
Then there is no delete button
"""
self
.
group_configurations_page
.
visit
()
config
=
self
.
create_and_verify_content_group
(
"New Content Group"
,
0
)
self
.
assertTrue
(
config
.
delete_button_is_absent
)
def
test_must_supply_name
(
self
):
"""
Scenario: Ensure that validation of the content group works correctly.
Given I have a course without content groups
And I create new content group without specifying a name click the button 'Create'
Then I see error message "Content Group name is required."
When I set a name and click the button 'Create'
Then I see the content group is saved successfully
"""
self
.
group_configurations_page
.
visit
()
self
.
group_configurations_page
.
create_first_content_group
()
config
=
self
.
group_configurations_page
.
content_groups
[
0
]
config
.
save
()
self
.
assertEqual
(
config
.
mode
,
'edit'
)
self
.
assertEqual
(
"Group name is required"
,
config
.
validation_message
)
config
.
name
=
"Content Group Name"
config
.
save
()
self
.
assertIn
(
"Content Group Name"
,
config
.
name
)
def
test_can_cancel_creation_of_content_group
(
self
):
"""
Scenario: Ensure that creation of a content group can be canceled correctly.
Given I have a course without content groups
When I click button 'Add your first Content Group'
And I set new the name and click the button 'Cancel'
Then I see that there is no content groups in the course
"""
self
.
group_configurations_page
.
visit
()
self
.
group_configurations_page
.
create_first_content_group
()
config
=
self
.
group_configurations_page
.
content_groups
[
0
]
config
.
name
=
"Content Group"
config
.
cancel
()
self
.
assertEqual
(
0
,
len
(
self
.
group_configurations_page
.
content_groups
))
@attr
(
'shard_1'
)
...
...
common/test/acceptance/tests/studio/test_studio_split_test.py
View file @
66375b85
This diff is collapsed.
Click to expand it.
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