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
f7368a52
Commit
f7368a52
authored
Dec 09, 2015
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add AnnotationProblemTypeTest and SymbolicProblemTypeTest
parent
a9b308e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
common/test/acceptance/tests/lms/test_problem_types.py
+93
-0
No files found.
common/test/acceptance/tests/lms/test_problem_types.py
View file @
f7368a52
...
@@ -11,6 +11,7 @@ from nose.plugins.attrib import attr
...
@@ -11,6 +11,7 @@ from nose.plugins.attrib import attr
from
selenium.webdriver
import
ActionChains
from
selenium.webdriver
import
ActionChains
from
capa.tests.response_xml_factory
import
(
from
capa.tests.response_xml_factory
import
(
AnnotationResponseXMLFactory
,
ChoiceResponseXMLFactory
,
ChoiceResponseXMLFactory
,
ChoiceTextResponseXMLFactory
,
ChoiceTextResponseXMLFactory
,
CodeResponseXMLFactory
,
CodeResponseXMLFactory
,
...
@@ -21,6 +22,7 @@ from capa.tests.response_xml_factory import (
...
@@ -21,6 +22,7 @@ from capa.tests.response_xml_factory import (
NumericalResponseXMLFactory
,
NumericalResponseXMLFactory
,
OptionResponseXMLFactory
,
OptionResponseXMLFactory
,
StringResponseXMLFactory
,
StringResponseXMLFactory
,
SymbolicResponseXMLFactory
,
)
)
from
common.test.acceptance.fixtures.course
import
XBlockFixtureDesc
from
common.test.acceptance.fixtures.course
import
XBlockFixtureDesc
...
@@ -225,6 +227,59 @@ class ProblemTypeTestMixin(object):
...
@@ -225,6 +227,59 @@ class ProblemTypeTestMixin(object):
self
.
problem_page
.
a11y_audit
.
check_for_accessibility_errors
()
self
.
problem_page
.
a11y_audit
.
check_for_accessibility_errors
()
class
AnnotationProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
"""
TestCase Class for Annotation Problem Type
"""
problem_name
=
'ANNOTATION TEST PROBLEM'
problem_type
=
'annotationresponse'
factory
=
AnnotationResponseXMLFactory
()
factory_kwargs
=
{
'title'
:
'Annotation Problem'
,
'text'
:
'The text being annotated'
,
'comment'
:
'What do you think the about this text?'
,
'comment_prompt'
:
'Type your answer below.'
,
'tag_prompt'
:
'Which of these items most applies to the text?'
,
'options'
:
[
(
'dog'
,
'correct'
),
(
'cat'
,
'incorrect'
),
(
'fish'
,
'partially-correct'
),
]
}
status_indicators
=
{
'correct'
:
[
'span.correct'
],
'incorrect'
:
[
'span.incorrect'
],
'partially-correct'
:
[
'span.partially-correct'
],
'unanswered'
:
[
'span.unanswered'
],
}
def
setUp
(
self
,
*
args
,
**
kwargs
):
"""
Additional setup for AnnotationProblemTypeTest
"""
super
(
AnnotationProblemTypeTest
,
self
)
.
setUp
(
*
args
,
**
kwargs
)
self
.
problem_page
.
a11y_audit
.
config
.
set_rules
({
'ignore'
:
[
'label'
,
# TODO: AC-293
]
})
def
answer_problem
(
self
,
correct
):
"""
Answer annotation problem.
"""
choice
=
0
if
correct
else
1
answer
=
'Student comment'
self
.
problem_page
.
q
(
css
=
'div.problem textarea.comment'
)
.
fill
(
answer
)
self
.
problem_page
.
q
(
css
=
'div.problem span.tag'
.
format
(
choice
=
choice
)
)
.
nth
(
choice
)
.
click
()
class
CheckboxProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
class
CheckboxProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
"""
"""
TestCase Class for Checkbox Problem Type
TestCase Class for Checkbox Problem Type
...
@@ -764,3 +819,41 @@ class ImageProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
...
@@ -764,3 +819,41 @@ class ImageProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
chain
.
move_by_offset
(
offset
,
offset
)
chain
.
move_by_offset
(
offset
,
offset
)
chain
.
click
()
chain
.
click
()
chain
.
perform
()
chain
.
perform
()
class
SymbolicProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
"""
TestCase Class for Symbolic Problem Type
"""
problem_name
=
'SYMBOLIC TEST PROBLEM'
problem_type
=
'symbolicresponse'
factory
=
SymbolicResponseXMLFactory
()
factory_kwargs
=
{
'expect'
:
'2*x+3*y'
,
}
status_indicators
=
{
'correct'
:
[
'span div.correct'
],
'incorrect'
:
[
'span div.incorrect'
],
'unanswered'
:
[
'span div.unanswered'
],
}
def
setUp
(
self
,
*
args
,
**
kwargs
):
"""
Additional setup for SymbolicProblemTypeTest
"""
super
(
SymbolicProblemTypeTest
,
self
)
.
setUp
(
*
args
,
**
kwargs
)
self
.
problem_page
.
a11y_audit
.
config
.
set_rules
({
'ignore'
:
[
'label'
,
# TODO: AC-294
]
})
def
answer_problem
(
self
,
correct
):
"""
Answer symbolic problem.
"""
choice
=
"2*x+3*y"
if
correct
else
"3*a+4*b"
self
.
problem_page
.
fill_answer
(
choice
)
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