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
0e237a85
Commit
0e237a85
authored
Dec 19, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add acceptance test of the Graphical Slider Tool [LMS-1641]
parent
06fadcdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
0 deletions
+88
-0
lms/djangoapps/courseware/features/gst.feature
+11
-0
lms/djangoapps/courseware/features/gst.py
+77
-0
No files found.
lms/djangoapps/courseware/features/gst.feature
0 → 100644
View file @
0e237a85
@shard_2
Feature
:
LMS.Graphical Slider Tool Module
As a student, I want to view a Graphical Slider Tool Component
Scenario
:
The slider changes values on the page
Given
that I have a course with a Graphical Slider Tool
When
I view the Graphical Slider Tool
Then
the displayed value should be 0
And
I move the slider to the right
Then
the displayed value should be 10
\ No newline at end of file
lms/djangoapps/courseware/features/gst.py
0 → 100644
View file @
0e237a85
from
lettuce
import
world
,
steps
from
nose.tools
import
assert_in
,
assert_equals
,
assert_true
from
common
import
i_am_registered_for_the_course
,
visit_scenario_item
from
problems_setup
import
add_problem_to_course
,
answer_problem
DEFAULT_DATA
=
"""
\
<render>
<p>Test of the graphical slider tool</p>
<div class='gst-value'>
<span id="value-display" style="width:50px; float:left; margin-left:10px;"/>
</div>
<div class='gst-input'>
<slider var="a" style="width:400px;float:left;margin-left:10px;"/>
</div>
</render>
<configuration>
<parameters>
<param var="a" min="0" max="10" step="1" initial="0"/>
</parameters>
<functions>
<function output="element" el_id="value-display">a</function>
</functions>
</configuration>
"""
@steps
class
GraphicalSliderToolSteps
(
object
):
COURSE_NUM
=
'test_course'
def
setup_gst
(
self
,
step
):
r'that I have a course with a Graphical Slider Tool$'
i_am_registered_for_the_course
(
step
,
self
.
COURSE_NUM
)
world
.
scenario_dict
[
'GST'
]
=
world
.
ItemFactory
(
parent_location
=
world
.
scenario_dict
[
'SECTION'
]
.
location
,
category
=
'graphical_slider_tool'
,
display_name
=
"Test GST"
,
data
=
DEFAULT_DATA
)
def
view_gst
(
self
,
step
):
r'I view the Graphical Slider Tool$'
visit_scenario_item
(
'GST'
)
world
.
wait_for_js_variable_truthy
(
'$(".xblock-student_view[data-type=GraphicalSliderTool]").data("initialized")'
)
world
.
wait_for_ajax_complete
()
def
check_value
(
self
,
step
,
value
):
r'the displayed value should be (?P<value>\d+)$'
assert_equals
(
world
.
css_text
(
'.gst-value'
),
value
)
def
move_slider
(
self
,
step
):
r'I move the slider to the right$'
handle_selector
=
'.gst-input .ui-slider-handle'
world
.
wait_for_visible
(
handle_selector
)
world
.
wait_for_visible
(
'.gst-value #value-display'
)
def
try_move
():
handle
=
world
.
css_find
(
handle_selector
)
.
first
slider
=
world
.
css_find
(
'.gst-input .ui-slider'
)
.
first
(
handle
.
action_chains
.
click_and_hold
(
handle
.
_element
)
.
move_by_offset
(
int
(
handle
.
_element
.
location
[
'x'
]
+
400
),
0
)
.
release
()
.
perform
())
world
.
retry_on_exception
(
try_move
)
GraphicalSliderToolSteps
()
\ No newline at end of file
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