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
194e0e97
Commit
194e0e97
authored
Dec 20, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add acceptance tests of capa image input
parent
0e237a85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
5 deletions
+51
-5
lms/djangoapps/courseware/features/problems.feature
+8
-0
lms/djangoapps/courseware/features/problems_setup.py
+43
-5
No files found.
lms/djangoapps/courseware/features/problems.feature
View file @
194e0e97
...
...
@@ -26,6 +26,7 @@ Feature: LMS.Answer problems
|
code
|
|
radio_text
|
|
checkbox_text
|
|
image
|
Scenario
:
I
can answer a problem incorrectly
Given
External graders respond
"incorrect"
...
...
@@ -47,6 +48,7 @@ Feature: LMS.Answer problems
|
code
|
|
radio_text
|
|
checkbox_text
|
|
image
|
Scenario
:
I
can submit a blank answer
Given
I am viewing a
"<ProblemType>"
problem
...
...
@@ -66,6 +68,7 @@ Feature: LMS.Answer problems
|
script
|
|
radio_text
|
|
checkbox_text
|
|
image
|
Scenario
:
I
can reset a problem
...
...
@@ -97,6 +100,8 @@ Feature: LMS.Answer problems
|
radio_text
|
incorrect
|
|
checkbox_text
|
correct
|
|
checkbox_text
|
incorrect
|
|
image
|
correct
|
|
image
|
incorrect
|
Scenario
:
I
can answer a problem with one attempt correctly and not reset
...
...
@@ -157,6 +162,8 @@ Feature: LMS.Answer problems
|
formula
|
incorrect
|
1
point
possible
|
1
point
possible
|
|
script
|
correct
|
2/2
points
|
2
points
possible
|
|
script
|
incorrect
|
2
points
possible
|
2
points
possible
|
|
image
|
correct
|
1/1
points
|
1
point
possible
|
|
image
|
incorrect
|
1
point
possible
|
1
point
possible
|
Scenario
:
I
can see my score on a problem to which I submit a blank answer
Given
I am viewing a
"<ProblemType>"
problem
...
...
@@ -173,6 +180,7 @@ Feature: LMS.Answer problems
|
numerical
|
1
point
possible
|
|
formula
|
1
point
possible
|
|
script
|
2
points
possible
|
|
image
|
1
point
possible
|
Scenario
:
I
can reset the correctness of a problem after changing my answer
...
...
lms/djangoapps/courseware/features/problems_setup.py
View file @
194e0e97
...
...
@@ -14,11 +14,18 @@ from lettuce import world
import
random
import
textwrap
from
common
import
section_location
from
capa.tests.response_xml_factory
import
OptionResponseXMLFactory
,
\
ChoiceResponseXMLFactory
,
MultipleChoiceResponseXMLFactory
,
\
StringResponseXMLFactory
,
NumericalResponseXMLFactory
,
\
FormulaResponseXMLFactory
,
CustomResponseXMLFactory
,
\
CodeResponseXMLFactory
,
ChoiceTextResponseXMLFactory
from
capa.tests.response_xml_factory
import
(
ChoiceResponseXMLFactory
,
ChoiceTextResponseXMLFactory
,
CodeResponseXMLFactory
,
CustomResponseXMLFactory
,
FormulaResponseXMLFactory
,
ImageResponseXMLFactory
,
MultipleChoiceResponseXMLFactory
,
NumericalResponseXMLFactory
,
OptionResponseXMLFactory
,
StringResponseXMLFactory
,
)
# Factories from capa.tests.response_xml_factory that we will use
...
...
@@ -158,6 +165,16 @@ PROBLEM_DICT = {
},
'correct'
:
[
'span.correct'
],
'incorrect'
:
[
'span.incorrect'
],
'unanswered'
:
[
'span.unanswered'
]},
'image'
:
{
'factory'
:
ImageResponseXMLFactory
(),
'kwargs'
:
{
'src'
:
'/static/images/mit_dome.jpg'
,
'rectangle'
:
'(50,50)-(100,100)'
},
'correct'
:
[
'span.correct'
],
'incorrect'
:
[
'span.incorrect'
],
'unanswered'
:
[
'span.unanswered'
]}
}
...
...
@@ -242,6 +259,27 @@ def answer_problem(course, problem_type, correctness):
input_value
)
world
.
css_check
(
inputfield
(
course
,
problem_type
,
choice
=
choice
))
elif
problem_type
==
'image'
:
offset
=
25
if
correctness
==
"correct"
else
-
25
def
try_click
():
image_selector
=
"#imageinput_i4x-{0.org}-{0.course}-problem-image_2_1"
.
format
(
section_loc
)
input_selector
=
"#input_i4x-{0.org}-{0.course}-problem-image_2_1"
.
format
(
section_loc
)
world
.
browser
.
execute_script
(
'$("body").on("click", function(event) {console.log(event);})'
)
initial_input
=
world
.
css_value
(
input_selector
)
world
.
wait_for_visible
(
image_selector
)
image
=
world
.
css_find
(
image_selector
)
.
first
(
image
.
action_chains
.
move_to_element
(
image
.
_element
)
.
move_by_offset
(
offset
,
offset
)
.
click
()
.
perform
())
world
.
wait_for
(
lambda
_
:
world
.
css_value
(
input_selector
)
!=
initial_input
)
world
.
retry_on_exception
(
try_click
)
def
problem_has_answer
(
course
,
problem_type
,
answer_class
):
...
...
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