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
5e39ff65
Commit
5e39ff65
authored
Oct 23, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1463 from edx/zoldak/fix-tests
Improve problems acceptance tests
parents
031f3074
45f87b30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
lms/djangoapps/courseware/features/problems.feature
+2
-3
lms/djangoapps/courseware/features/problems.py
+15
-9
No files found.
lms/djangoapps/courseware/features/problems.feature
View file @
5e39ff65
...
@@ -126,11 +126,10 @@ Feature: LMS.Answer problems
...
@@ -126,11 +126,10 @@ Feature: LMS.Answer problems
Scenario
:
I can view and hide the answer if the problem has it
:
Scenario
:
I can view and hide the answer if the problem has it
:
Given
I am viewing a
"numerical"
that shows the answer
"always"
Given
I am viewing a
"numerical"
that shows the answer
"always"
When
I press the button with the label
"Show Answer(s)"
When
I press the button with the label
"Show Answer(s)"
Then
the button with the label
"Hide Answer(s)"
does appear
Then
the Show/Hide button label is
"Hide Answer(s)"
And
the button with the label
"Show Answer(s)"
does not appear
And
I should see
"4.14159"
somewhere in the page
And
I should see
"4.14159"
somewhere in the page
When
I press the button with the label
"Hide Answer(s)"
When
I press the button with the label
"Hide Answer(s)"
Then
the
button with the label
"Show Answer(s)"
does appear
Then
the
Show/Hide button label is
"Show Answer(s)"
And
I should not see
"4.14159"
anywhere on the page
And
I should not see
"4.14159"
anywhere on the page
Scenario
:
I
can see my score on a problem when I answer it and after I reset it
Scenario
:
I
can see my score on a problem when I answer it and after I reset it
...
...
lms/djangoapps/courseware/features/problems.py
View file @
5e39ff65
...
@@ -9,6 +9,7 @@ from lettuce import world, step
...
@@ -9,6 +9,7 @@ from lettuce import world, step
from
lettuce.django
import
django_url
from
lettuce.django
import
django_url
from
common
import
i_am_registered_for_the_course
from
common
import
i_am_registered_for_the_course
from
problems_setup
import
PROBLEM_DICT
,
answer_problem
,
problem_has_answer
,
add_problem_to_course
from
problems_setup
import
PROBLEM_DICT
,
answer_problem
,
problem_has_answer
,
add_problem_to_course
from
nose.tools
import
assert_equal
@step
(
u'I am viewing a "([^"]*)" problem with "([^"]*)" attempt'
)
@step
(
u'I am viewing a "([^"]*)" problem with "([^"]*)" attempt'
)
...
@@ -138,23 +139,28 @@ def press_the_button_with_label(_step, buttonname):
...
@@ -138,23 +139,28 @@ def press_the_button_with_label(_step, buttonname):
@step
(
u'The "([^"]*)" button does( not)? appear'
)
@step
(
u'The "([^"]*)" button does( not)? appear'
)
def
action_button_present
(
_step
,
buttonname
,
doesnt_appear
):
def
action_button_present
(
_step
,
buttonname
,
doesnt_appear
):
button_css
=
'section.action input[value*="
%
s"]'
%
buttonname
button_css
=
'section.action input[value*="
%
s"]'
%
buttonname
if
doesnt_appear
:
if
bool
(
doesnt_appear
)
:
assert
world
.
is_css_not_present
(
button_css
)
assert
world
.
is_css_not_present
(
button_css
)
else
:
else
:
assert
world
.
is_css_present
(
button_css
)
assert
world
.
is_css_present
(
button_css
)
@step
(
u'the
button with the label "([^"]*)" does( not)? appear
'
)
@step
(
u'the
Show/Hide button label is "([^"]*)"$
'
)
def
button_with_label_present
(
_step
,
buttonname
,
doesnt_appear
):
def
show_hide_label_is
(
_step
,
label_name
):
if
doesnt_appear
:
# The label text is changed by static/xmodule_js/src/capa/display.js
assert
world
.
browser
.
is_text_not_present
(
buttonname
,
wait_time
=
5
)
# so give it some time to change on the page.
else
:
label_css
=
'button.show span.show-label'
assert
world
.
browser
.
is_text_present
(
buttonname
,
wait_time
=
5
)
world
.
wait_for
(
lambda
_
:
world
.
css_has_text
(
label_css
,
label_name
)
)
@step
(
u'I should see a score of "([^"]*)"$'
)
@step
(
u'I should see a score of "([^"]*)"$'
)
def
see_score
(
_step
,
score
):
def
see_score
(
_step
,
score
):
assert
world
.
browser
.
is_text_present
(
score
)
# The problem progress is changed by
# cms/static/xmodule_js/src/capa/display.js
# so give it some time to render on the page.
score_css
=
'section.problem-progress'
expected_text
=
'({})'
.
format
(
score
)
world
.
wait_for
(
lambda
_
:
world
.
css_has_text
(
score_css
,
expected_text
))
@step
(
u'[Mm]y "([^"]*)" answer is( NOT)? marked "([^"]*)"'
)
@step
(
u'[Mm]y "([^"]*)" answer is( NOT)? marked "([^"]*)"'
)
...
@@ -173,7 +179,7 @@ def assert_answer_mark(_step, problem_type, isnt_marked, correctness):
...
@@ -173,7 +179,7 @@ def assert_answer_mark(_step, problem_type, isnt_marked, correctness):
# At least one of the correct selectors should be present
# At least one of the correct selectors should be present
for
sel
in
PROBLEM_DICT
[
problem_type
][
correctness
]:
for
sel
in
PROBLEM_DICT
[
problem_type
][
correctness
]:
if
isnt_marked
:
if
bool
(
isnt_marked
)
:
has_expected
=
world
.
is_css_not_present
(
sel
)
has_expected
=
world
.
is_css_not_present
(
sel
)
else
:
else
:
has_expected
=
world
.
is_css_present
(
sel
)
has_expected
=
world
.
is_css_present
(
sel
)
...
...
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