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
46248c70
Commit
46248c70
authored
Feb 03, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add lettuce test for displaying category if display_name is empty
parent
7cab3869
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
20 deletions
+40
-20
cms/djangoapps/contentstore/features/component.feature
+9
-0
cms/djangoapps/contentstore/features/component.py
+11
-1
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+16
-0
cms/djangoapps/contentstore/features/problem-editor.py
+4
-19
No files found.
cms/djangoapps/contentstore/features/component.feature
View file @
46248c70
...
...
@@ -119,3 +119,12 @@ Feature: CMS.Component Adding
Then
I see the display name is
"Text"
When
I change the display name to
"I'm the Cuddliest!"
Then
I see the display name is
"I'm the Cuddliest!"
Scenario
:
If a component has no display name, the category is displayed
Given
I am in Studio editing a new unit
When
I add a
"Blank Advanced Problem"
"Advanced Problem"
component
Then
I see the display name is
"Blank Advanced Problem"
When
I change the display name to
""
Then
I see the display name is
"problem"
When
I unset the display name
Then
I see the display name is
"Blank Advanced Problem"
cms/djangoapps/contentstore/features/component.py
View file @
46248c70
...
...
@@ -8,6 +8,8 @@
from
lettuce
import
world
,
step
from
nose.tools
import
assert_true
,
assert_in
# pylint: disable=E0611
DISPLAY_NAME
=
"Display Name"
@step
(
u'I add this type of single step component:$'
)
def
add_a_single_step_component
(
step
):
...
...
@@ -165,5 +167,13 @@ def check_component_display_name(step, display_name):
@step
(
u'I change the display name to "([^"]*)"'
)
def
change_display_name
(
step
,
display_name
):
world
.
edit_component_and_select_settings
()
world
.
css_fill
(
"ul.settings-list li:first-child input"
,
display_name
)
index
=
world
.
get_setting_entry_index
(
DISPLAY_NAME
)
world
.
set_field_value
(
index
,
display_name
)
world
.
save_component
(
step
)
@step
(
u'I unset the display name'
)
def
unset_display_name
(
step
):
world
.
edit_component_and_select_settings
()
world
.
revert_setting_entry
(
DISPLAY_NAME
)
world
.
save_component
(
step
)
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
View file @
46248c70
...
...
@@ -5,6 +5,7 @@ from lettuce import world
from
nose.tools
import
assert_equal
,
assert_in
# pylint: disable=E0611
from
terrain.steps
import
reload_the_page
from
common
import
type_in_codemirror
from
selenium.webdriver.common.keys
import
Keys
@world.absorb
...
...
@@ -219,3 +220,18 @@ def get_setting_entry_index(label):
return
index
return
None
return
world
.
retry_on_exception
(
get_index
)
@world.absorb
def
set_field_value
(
index
,
value
):
"""
Set the field to the specified value.
Note: we cannot use css_fill here because the value is not set
until after you move away from that field.
Instead we will find the element, set its value, then hit the Tab key
to get to the next field.
"""
elem
=
world
.
css_find
(
'div.wrapper-comp-setting input.setting-input'
)[
index
]
elem
.
value
=
value
elem
.
type
(
Keys
.
TAB
)
cms/djangoapps/contentstore/features/problem-editor.py
View file @
46248c70
...
...
@@ -7,7 +7,6 @@ from nose.tools import assert_equal, assert_true # pylint: disable=E0611
from
common
import
type_in_codemirror
,
open_new_course
from
advanced_settings
import
change_value
from
course_import
import
import_file
,
go_to_import
from
selenium.webdriver.common.keys
import
Keys
DISPLAY_NAME
=
"Display Name"
MAXIMUM_ATTEMPTS
=
"Maximum Attempts"
...
...
@@ -53,7 +52,7 @@ def i_can_modify_the_display_name(_step):
# Verifying that the display name can be a string containing a floating point value
# (to confirm that we don't throw an error because it is of the wrong type).
index
=
world
.
get_setting_entry_index
(
DISPLAY_NAME
)
set_field_value
(
index
,
'3.4'
)
world
.
set_field_value
(
index
,
'3.4'
)
verify_modified_display_name
()
...
...
@@ -66,7 +65,7 @@ def my_display_name_change_is_persisted_on_save(step):
@step
(
'I can specify special characters in the display name'
)
def
i_can_modify_the_display_name_with_special_chars
(
_step
):
index
=
world
.
get_setting_entry_index
(
DISPLAY_NAME
)
set_field_value
(
index
,
"updated '
\"
&"
)
world
.
set_field_value
(
index
,
"updated '
\"
&"
)
verify_modified_display_name_with_special_chars
()
...
...
@@ -141,7 +140,7 @@ def set_the_max_attempts(step, max_attempts_set):
# on firefox with selenium, the behaviour is different.
# eg 2.34 displays as 2.34 and is persisted as 2
index
=
world
.
get_setting_entry_index
(
MAXIMUM_ATTEMPTS
)
set_field_value
(
index
,
max_attempts_set
)
world
.
set_field_value
(
index
,
max_attempts_set
)
world
.
save_component_and_reopen
(
step
)
value
=
world
.
css_value
(
'input.setting-input'
,
index
=
index
)
assert
value
!=
""
,
"max attempts is blank"
...
...
@@ -282,23 +281,9 @@ def verify_unset_display_name():
world
.
verify_setting_entry
(
world
.
get_setting_entry
(
DISPLAY_NAME
),
DISPLAY_NAME
,
'Blank Advanced Problem'
,
False
)
def
set_field_value
(
index
,
value
):
"""
Set the field to the specified value.
Note: we cannot use css_fill here because the value is not set
until after you move away from that field.
Instead we will find the element, set its value, then hit the Tab key
to get to the next field.
"""
elem
=
world
.
css_find
(
'div.wrapper-comp-setting input.setting-input'
)[
index
]
elem
.
value
=
value
elem
.
type
(
Keys
.
TAB
)
def
set_weight
(
weight
):
index
=
world
.
get_setting_entry_index
(
PROBLEM_WEIGHT
)
set_field_value
(
index
,
weight
)
world
.
set_field_value
(
index
,
weight
)
def
open_high_level_source
():
...
...
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