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
e41bb846
Commit
e41bb846
authored
Mar 15, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added lettuce tests for script (customresponse) problems.
Increased wait time for login screen to reduce false positives.
parent
84238160
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
common/djangoapps/terrain/steps.py
+1
-1
lms/djangoapps/courseware/features/problems.feature
+5
-0
lms/djangoapps/courseware/features/problems.py
+20
-4
No files found.
common/djangoapps/terrain/steps.py
View file @
e41bb846
...
...
@@ -136,7 +136,7 @@ def log_in(email, password):
# This is complicated by the fact that sometimes a second #login_form
# dialog loads, while the first one remains hidden.
# We give them both time to load, starting with the second one.
world
.
browser
.
is_element_present_by_css
(
'section.content-wrapper form#login_form'
,
wait_time
=
2
)
world
.
browser
.
is_element_present_by_css
(
'section.content-wrapper form#login_form'
,
wait_time
=
4
)
world
.
browser
.
is_element_present_by_css
(
'form#login_form'
,
wait_time
=
2
)
# For some reason, the page sometimes includes two #login_form
...
...
lms/djangoapps/courseware/features/problems.feature
View file @
e41bb846
...
...
@@ -16,6 +16,7 @@ Feature: Answer choice problems
|
string
|
|
numerical
|
|
formula
|
|
script
|
Scenario
:
I
can answer a problem incorrectly
Given
I am viewing a
"<ProblemType>"
problem
...
...
@@ -30,6 +31,7 @@ Feature: Answer choice problems
|
string
|
|
numerical
|
|
formula
|
|
script
|
Scenario
:
I
can submit a blank answer
Given
I am viewing a
"<ProblemType>"
problem
...
...
@@ -44,6 +46,7 @@ Feature: Answer choice problems
|
string
|
|
numerical
|
|
formula
|
|
script
|
Scenario
:
I
can reset a problem
...
...
@@ -66,3 +69,5 @@ Feature: Answer choice problems
|
numerical
|
incorrect
|
|
formula
|
correct
|
|
formula
|
incorrect
|
|
script
|
correct
|
|
script
|
incorrect
|
lms/djangoapps/courseware/features/problems.py
View file @
e41bb846
...
...
@@ -154,6 +154,19 @@ def answer_problem(step, problem_type, correctness):
textvalue
=
"x^2+2*x+y"
if
correctness
==
'correct'
else
'x^2'
inputfield
(
'formula'
)
.
fill
(
textvalue
)
elif
problem_type
==
'script'
:
# Correct answer is any two integers that sum to 10
first_addend
=
random
.
randint
(
-
100
,
100
)
second_addend
=
10
-
first_addend
# If we want an incorrect answer, then change
# the second addend so they no longer sum to 10
if
correctness
==
'incorrect'
:
second_addend
+=
random
.
randint
(
1
,
10
)
inputfield
(
'script'
,
input_num
=
1
)
.
fill
(
str
(
first_addend
))
inputfield
(
'script'
,
input_num
=
2
)
.
fill
(
str
(
second_addend
))
# Submit the problem
check_problem
(
step
)
...
...
@@ -188,7 +201,8 @@ def assert_answer_mark(step, problem_type, correctness):
'checkbox'
:
[
'span.correct'
],
'string'
:
[
'div.correct'
],
'numerical'
:
[
'div.correct'
],
'formula'
:
[
'div.correct'
],
}
'formula'
:
[
'div.correct'
],
'script'
:
[
'div.correct'
],
}
incorrect_selectors
=
{
'drop down'
:
[
'span.incorrect'
],
'multiple choice'
:
[
'label.choicegroup_incorrect'
,
...
...
@@ -196,7 +210,8 @@ def assert_answer_mark(step, problem_type, correctness):
'checkbox'
:
[
'span.incorrect'
],
'string'
:
[
'div.incorrect'
],
'numerical'
:
[
'div.incorrect'
],
'formula'
:
[
'div.incorrect'
],
}
'formula'
:
[
'div.incorrect'
],
'script'
:
[
'div.incorrect'
]
}
assert
(
correctness
in
[
'correct'
,
'incorrect'
,
'unanswered'
])
assert
(
problem_type
in
correct_selectors
and
problem_type
in
incorrect_selectors
)
...
...
@@ -229,7 +244,7 @@ def assert_answer_mark(step, problem_type, correctness):
assert
(
world
.
browser
.
is_element_not_present_by_css
(
sel
,
wait_time
=
4
))
def
inputfield
(
problem_type
,
choice
=
None
):
def
inputfield
(
problem_type
,
choice
=
None
,
input_num
=
1
):
""" Return the <input> element for *problem_type*.
For example, if problem_type is 'string', return
the text field for the string problem in the test course.
...
...
@@ -237,7 +252,8 @@ def inputfield(problem_type, choice=None):
*choice* is the name of the checkbox input in a group
of checkboxes. """
sel
=
"input#input_i4x-edx-model_course-problem-
%
s_2_1"
%
problem_type
.
replace
(
" "
,
"_"
)
sel
=
(
"input#input_i4x-edx-model_course-problem-
%
s_2_
%
s"
%
(
problem_type
.
replace
(
" "
,
"_"
),
str
(
input_num
)))
if
choice
is
not
None
:
base
=
"_choice_"
if
problem_type
==
"multiple choice"
else
"_"
...
...
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