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
33f6d3b8
Commit
33f6d3b8
authored
Oct 16, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address code review comments
parent
751994b9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
37 deletions
+52
-37
cms/djangoapps/contentstore/features/common.py
+15
-3
cms/djangoapps/contentstore/features/component.py
+1
-1
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+30
-27
cms/djangoapps/contentstore/features/discussion-editor.py
+1
-1
cms/djangoapps/contentstore/features/html-editor.py
+2
-2
cms/djangoapps/contentstore/features/problem-editor.py
+2
-2
cms/djangoapps/contentstore/features/video.py
+1
-1
No files found.
cms/djangoapps/contentstore/features/common.py
View file @
33f6d3b8
...
...
@@ -225,7 +225,18 @@ def i_enabled_the_advanced_module(step, module):
@world.absorb
def
add_unit
():
def
create_course_with_unit
():
"""
Prepare for tests by creating a course with a section, subsection, and unit.
Performs the following:
Clear out all courseware
Create a course with a section, subsection, and unit
Create a user and make that user a course author
Log the user into studio
Open the course from the dashboard
Expand the section and click on the New Unit link
The end result is the page where the user is editing the new unit
"""
world
.
clear_courses
()
course
=
world
.
CourseFactory
.
create
()
world
.
scenario_dict
[
'COURSE'
]
=
course
...
...
@@ -233,7 +244,8 @@ def add_unit():
world
.
ItemFactory
.
create
(
parent_location
=
section
.
location
,
category
=
'sequential'
,
display_name
=
'Subsection One'
,)
display_name
=
'Subsection One'
,
)
user
=
create_studio_user
(
is_staff
=
False
)
add_course_author
(
user
,
course
)
...
...
@@ -255,7 +267,7 @@ def add_unit():
@step
(
'I have clicked the new unit button$'
)
@step
(
u'I am in Studio editing a new unit$'
)
def
edit_new_unit
(
step
):
add
_unit
()
create_course_with
_unit
()
@step
(
'the save notification button is disabled'
)
...
...
cms/djangoapps/contentstore/features/component.py
View file @
33f6d3b8
...
...
@@ -34,7 +34,7 @@ def add_a_multi_step_component(step, is_advanced, category):
step
=
step
,
category
=
'{}'
.
format
(
category
.
lower
()),
component_type
=
step_hash
[
'Component'
],
is_advanced
=
is_advanced
,
is_advanced
=
bool
(
is_advanced
)
,
)
...
...
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
View file @
33f6d3b8
...
...
@@ -41,6 +41,29 @@ def click_new_component_button(step, component_button_css):
world
.
css_click
(
component_button_css
)
def
_click_advanced
():
css
=
'ul.problem-type-tabs a[href="#tab2"]'
world
.
css_click
(
css
)
my_css
=
'ul.problem-type-tabs li.ui-state-active a[href="#tab2"]'
assert
(
world
.
css_find
(
my_css
))
def
_find_matching_link
(
category
,
component_type
):
"""
Find the link with the specified text. There should be one and only one.
"""
# The tab shows links for the given category
links
=
world
.
css_find
(
'div.new-component-{} a'
.
format
(
category
))
# Find the link whose text matches what you're looking for
matched_links
=
[
link
for
link
in
links
if
link
.
text
==
component_type
]
# There should be one and only one
assert_equal
(
len
(
matched_links
),
1
)
return
matched_links
[
0
]
def
click_component_from_menu
(
category
,
component_type
,
is_advanced
):
"""
Creates a component for a category with more
...
...
@@ -49,39 +72,19 @@ def click_component_from_menu(category, component_type, is_advanced):
the Advanced tab.
The component_type is the link text, e.g. "Blank Common Problem"
"""
def
click_advanced
():
css
=
'ul.problem-type-tabs a[href="#tab2"]'
world
.
css_click
(
css
)
my_css
=
'ul.problem-type-tabs li.ui-state-active a[href="#tab2"]'
assert
(
world
.
css_find
(
my_css
))
# True, not None or False
if
is_advanced
:
# Sometimes this click does not work if you go too fast.
world
.
retry_on_exception
(
click_advanced
,
max_attempts
=
5
,
ignored_exceptions
=
AssertionError
)
def
find_matching_link
():
"""
Find the link with the specified text. There should be one and only one.
"""
# The tab shows links for the given category
links
=
world
.
css_find
(
'div.new-component-{} a'
.
format
(
category
))
# Find the link whose text matches what you're looking for
matched_links
=
[
link
for
link
in
links
if
link
.
text
==
component_type
]
# There should be one and only one
assert_equal
(
len
(
matched_links
),
1
)
return
matched_links
[
0
]
def
click_link
():
link
.
click
()
world
.
retry_on_exception
(
_click_advanced
,
ignored_exceptions
=
AssertionError
)
# Retry this in case the list is empty because you tried too fast.
link
=
world
.
retry_on_exception
(
func
=
find_matching_link
,
ignored_exceptions
=
AssertionError
)
link
=
world
.
retry_on_exception
(
lambda
:
_find_matching_link
(
category
,
component_type
),
ignored_exceptions
=
AssertionError
)
# Wait for the link to be clickable. If you go too fast it is not.
world
.
retry_on_exception
(
click_link
)
world
.
retry_on_exception
(
lambda
:
link
.
click
()
)
@world.absorb
...
...
cms/djangoapps/contentstore/features/discussion-editor.py
View file @
33f6d3b8
...
...
@@ -6,7 +6,7 @@ from lettuce import world, step
@step
(
'I have created a Discussion Tag$'
)
def
i_created_discussion_tag
(
step
):
world
.
add
_unit
()
world
.
create_course_with
_unit
()
world
.
create_component_instance
(
step
=
step
,
category
=
'discussion'
,
...
...
cms/djangoapps/contentstore/features/html-editor.py
View file @
33f6d3b8
...
...
@@ -6,7 +6,7 @@ from lettuce import world, step
@step
(
'I have created a Blank HTML Page$'
)
def
i_created_blank_html_page
(
step
):
world
.
add
_unit
()
world
.
create_course_with
_unit
()
world
.
create_component_instance
(
step
=
step
,
category
=
'html'
,
...
...
@@ -21,7 +21,7 @@ def i_see_only_the_html_display_name(step):
@step
(
'I have created an E-text Written in LaTeX$'
)
def
i_created_etext_in_latex
(
step
):
world
.
add
_unit
()
world
.
create_course_with
_unit
()
world
.
create_component_instance
(
step
=
step
,
category
=
'html'
,
...
...
cms/djangoapps/contentstore/features/problem-editor.py
View file @
33f6d3b8
...
...
@@ -17,7 +17,7 @@ SHOW_ANSWER = "Show Answer"
@step
(
'I have created a Blank Common Problem$'
)
def
i_created_blank_common_problem
(
step
):
world
.
add
_unit
()
world
.
create_course_with
_unit
()
world
.
create_component_instance
(
step
=
step
,
category
=
'problem'
,
...
...
@@ -166,7 +166,7 @@ def cancel_does_not_save_changes(step):
@step
(
'I have created a LaTeX Problem'
)
def
create_latex_problem
(
step
):
world
.
add
_unit
()
world
.
create_course_with
_unit
()
world
.
create_component_instance
(
step
=
step
,
category
=
'problem'
,
...
...
cms/djangoapps/contentstore/features/video.py
View file @
33f6d3b8
...
...
@@ -12,7 +12,7 @@ BUTTONS = {
@step
(
'I have created a Video component$'
)
def
i_created_a_video_component
(
step
):
world
.
add
_unit
()
world
.
create_course_with
_unit
()
world
.
create_component_instance
(
step
=
step
,
category
=
'video'
,
...
...
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