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
3308bb4b
Commit
3308bb4b
authored
May 31, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed pull request comments and refactored the duplicate code
parent
a49acc73
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
54 deletions
+33
-54
common/djangoapps/terrain/steps.py
+5
-2
common/djangoapps/terrain/ui_helpers.py
+5
-2
lms/djangoapps/courseware/features/problems.feature
+10
-29
lms/djangoapps/courseware/features/problems.py
+5
-13
lms/djangoapps/courseware/features/problems_setup.py
+3
-0
lms/djangoapps/courseware/features/registration.py
+5
-8
No files found.
common/djangoapps/terrain/steps.py
View file @
3308bb4b
...
@@ -129,8 +129,11 @@ def should_have_link_with_id_and_text(step, link_id, text):
...
@@ -129,8 +129,11 @@ def should_have_link_with_id_and_text(step, link_id, text):
assert_equals
(
link
.
text
,
text
)
assert_equals
(
link
.
text
,
text
)
@step
(
r'should see "(.*)" (?:somewhere|anywhere) in (?:the|this) page'
)
@step
(
r'should( not)? see "(.*)" (?:somewhere|anywhere) (?:in|on) (?:the|this) page'
)
def
should_see_in_the_page
(
step
,
text
):
def
should_see_in_the_page
(
step
,
doesnt_appear
,
text
):
if
doesnt_appear
:
assert
world
.
browser
.
is_text_not_present
(
text
)
else
:
assert_in
(
text
,
world
.
css_text
(
'body'
))
assert_in
(
text
,
world
.
css_text
(
'body'
))
...
...
common/djangoapps/terrain/ui_helpers.py
View file @
3308bb4b
...
@@ -42,11 +42,11 @@ def css_has_text(css_selector, text):
...
@@ -42,11 +42,11 @@ def css_has_text(css_selector, text):
@world.absorb
@world.absorb
def
css_find
(
css
):
def
css_find
(
css
,
wait_time
=
5
):
def
is_visible
(
driver
):
def
is_visible
(
driver
):
return
EC
.
visibility_of_element_located
((
By
.
CSS_SELECTOR
,
css
,))
return
EC
.
visibility_of_element_located
((
By
.
CSS_SELECTOR
,
css
,))
world
.
browser
.
is_element_present_by_css
(
css
,
5
)
world
.
browser
.
is_element_present_by_css
(
css
,
wait_time
=
wait_time
)
wait_for
(
is_visible
)
wait_for
(
is_visible
)
return
world
.
browser
.
find_by_css
(
css
)
return
world
.
browser
.
find_by_css
(
css
)
...
@@ -56,6 +56,7 @@ def css_click(css_selector):
...
@@ -56,6 +56,7 @@ def css_click(css_selector):
"""
"""
Perform a click on a CSS selector, retrying if it initially fails
Perform a click on a CSS selector, retrying if it initially fails
"""
"""
assert
is_css_present
(
css_selector
)
try
:
try
:
world
.
browser
.
find_by_css
(
css_selector
)
.
click
()
world
.
browser
.
find_by_css
(
css_selector
)
.
click
()
...
@@ -81,6 +82,7 @@ def css_click_at(css, x=10, y=10):
...
@@ -81,6 +82,7 @@ def css_click_at(css, x=10, y=10):
@world.absorb
@world.absorb
def
css_fill
(
css_selector
,
text
):
def
css_fill
(
css_selector
,
text
):
assert
is_css_present
(
css_selector
)
world
.
browser
.
find_by_css
(
css_selector
)
.
first
.
fill
(
text
)
world
.
browser
.
find_by_css
(
css_selector
)
.
first
.
fill
(
text
)
...
@@ -101,6 +103,7 @@ def css_text(css_selector):
...
@@ -101,6 +103,7 @@ def css_text(css_selector):
@world.absorb
@world.absorb
def
css_visible
(
css_selector
):
def
css_visible
(
css_selector
):
assert
is_css_present
(
css_selector
)
return
world
.
browser
.
find_by_css
(
css_selector
)
.
visible
return
world
.
browser
.
find_by_css
(
css_selector
)
.
visible
...
...
lms/djangoapps/courseware/features/problems.feature
View file @
3308bb4b
...
@@ -86,51 +86,32 @@ Feature: Answer problems
...
@@ -86,51 +86,32 @@ Feature: Answer problems
|
script
|
incorrect
|
|
script
|
incorrect
|
Scenario
:
I
can answer a problem with one attempt correctly
Scenario
:
I
can answer a problem with one attempt correctly
and not reset
Given
I am viewing a
"multiple choice"
problem with
"1"
attempt
Given
I am viewing a
"multiple choice"
problem with
"1"
attempt
Then
I should see
"You have used 0 of 1 submissions"
somewhere in the page
And
The
"Final Check"
button does appear
When
I answer a
"multiple choice"
problem
"correctly"
When
I answer a
"multiple choice"
problem
"correctly"
Then
My
"multiple choice"
answer is marked
"correct"
Then
The
"Reset"
button does not appear
And
The
"multiple choice"
problem displays a
"correct"
answer
And
The
"Reset"
button does not appear
Scenario
:
I
can answer a problem with one attempt incorrectly
Given
I am viewing a
"multiple choice"
problem with
"1"
attempt
When
I answer a
"multiple choice"
problem
"incorrectly"
Then
My
"multiple choice"
answer is marked
"incorrect"
And
The
"multiple choice"
problem displays a
"incorrect"
answer
And
The
"Reset"
button does not appear
Scenario
:
I
can answer a problem with multiple attempts correctly
Scenario
:
I
can answer a problem with multiple attempts correctly
and still reset the problem
Given
I am viewing a
"multiple choice"
problem with
"3"
attempts
Given
I am viewing a
"multiple choice"
problem with
"3"
attempts
Then
I should see
"You have used 0 of 3 submissions"
somewhere in the page
Then
I should see
"You have used 0 of 3 submissions"
somewhere in the page
When
I answer a
"multiple choice"
problem
"correctly"
When
I answer a
"multiple choice"
problem
"correctly"
Then
My
"multiple choice"
answer is marked
"correct"
Then
The
"Reset"
button does appear
And
The
"multiple choice"
problem displays a
"correct"
answer
And
The
"Reset"
button does appear
Scenario
:
I
can
answer a problem with multiple attempts correctly on final guess
Scenario
:
I
can
view how many attempts I have left on a problem
Given
I am viewing a
"multiple choice"
problem with
"3"
attempts
Given
I am viewing a
"multiple choice"
problem with
"3"
attempts
Then
I should see
"You have used 0 of 3 submissions"
somewhere in the page
Then
I should see
"You have used 0 of 3 submissions"
somewhere in the page
When
I answer a
"multiple choice"
problem
"incorrectly"
When
I answer a
"multiple choice"
problem
"incorrectly"
Then
My
"multiple choice"
answer is marked
"incorrect"
And
I reset the problem
And
The
"multiple choice"
problem displays a
"incorrect"
answer
When
I reset the problem
Then
I should see
"You have used 1 of 3 submissions"
somewhere in the page
Then
I should see
"You have used 1 of 3 submissions"
somewhere in the page
When
I answer a
"multiple choice"
problem
"incorrectly"
When
I answer a
"multiple choice"
problem
"incorrectly"
Then
My
"multiple choice"
answer is marked
"incorrect"
And
I reset the problem
And
The
"multiple choice"
problem displays a
"incorrect"
answer
When
I reset the problem
Then
I should see
"You have used 2 of 3 submissions"
somewhere in the page
Then
I should see
"You have used 2 of 3 submissions"
somewhere in the page
And
The
"Final Check"
button does appear
And
The
"Final Check"
button does appear
When
I answer a
"multiple choice"
problem
"correctly"
When
I answer a
"multiple choice"
problem
"correctly"
Then
My
"multiple choice"
answer is marked
"correct"
Then
The
"Reset"
button does not appear
And
The
"multiple choice"
problem displays a
"correct"
answer
And
The
"Reset"
button does not appear
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
:
Giv
en
I am viewing a
"numerical"
that shows the answer
"always"
Wh
en
I am viewing a
"numerical"
that shows the answer
"always"
Then
The
"Show Answer"
button does appear
Then
The
"Show Answer"
button does appear
When
I press the
"Show Answer"
button
When
I press the
"Show Answer"
button
Then
The
"Hide Answer"
button does appear
Then
The
"Hide Answer"
button does appear
...
@@ -138,4 +119,4 @@ Feature: Answer problems
...
@@ -138,4 +119,4 @@ Feature: Answer problems
And
I should see
"4.14159"
somewhere in the page
And
I should see
"4.14159"
somewhere in the page
When
I press the
"Hide Answer"
button
When
I press the
"Hide Answer"
button
Then
The
"Show Answer"
button does appear
Then
The
"Show Answer"
button does appear
And
I
do
not see
"4.14159"
anywhere on the page
And
I
should
not see
"4.14159"
anywhere on the page
lms/djangoapps/courseware/features/problems.py
View file @
3308bb4b
...
@@ -8,7 +8,7 @@ Steps for problem.feature lettuce tests
...
@@ -8,7 +8,7 @@ Steps for problem.feature lettuce tests
from
lettuce
import
world
,
step
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
,
TEST_SECTION_NAME
from
common
import
i_am_registered_for_the_course
,
TEST_SECTION_NAME
from
problems_setup
import
*
from
problems_setup
import
PROBLEM_DICT
,
answer_problem
,
problem_has_answer
,
add_problem_to_course
@step
(
u'I am viewing a "([^"]*)" problem with "([^"]*)" attempt'
)
@step
(
u'I am viewing a "([^"]*)" problem with "([^"]*)" attempt'
)
...
@@ -116,23 +116,15 @@ def reset_problem(step):
...
@@ -116,23 +116,15 @@ def reset_problem(step):
world
.
css_click
(
'input.reset'
)
world
.
css_click
(
'input.reset'
)
@step
(
u'The "([^"]*)" button does
not
appear'
)
@step
(
u'The "([^"]*)" button does
( not)?
appear'
)
def
action_button_
not_present
(
step
,
buttonname
):
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
:
assert
not
world
.
is_css_present
(
button_css
)
assert
not
world
.
is_css_present
(
button_css
)
else
:
@step
(
u'The "([^"]*)" button does appear'
)
def
action_button_present
(
step
,
buttonname
):
button_css
=
'section.action input[value*="
%
s"]'
%
buttonname
assert
world
.
is_css_present
(
button_css
)
assert
world
.
is_css_present
(
button_css
)
@step
(
u'I do not see "([^"]*)" anywhere on the page'
)
def
i_do_not_see_text_anywhere_on_the_page
(
step
,
text
):
assert
world
.
browser
.
is_text_not_present
(
text
)
@step
(
u'My "([^"]*)" answer is marked "([^"]*)"'
)
@step
(
u'My "([^"]*)" answer is marked "([^"]*)"'
)
def
assert_answer_mark
(
step
,
problem_type
,
correctness
):
def
assert_answer_mark
(
step
,
problem_type
,
correctness
):
"""
"""
...
...
lms/djangoapps/courseware/features/problems_setup.py
View file @
3308bb4b
#pylint: disable=C0111
#pylint: disable=W0621
#EVERY PROBLEM TYPE MUST HAVE THE FOLLOWING:
#EVERY PROBLEM TYPE MUST HAVE THE FOLLOWING:
# -Section in Dictionary containing:
# -Section in Dictionary containing:
# -factory
# -factory
...
...
lms/djangoapps/courseware/features/registration.py
View file @
3308bb4b
...
@@ -19,16 +19,13 @@ def i_register_for_the_course(step, course):
...
@@ -19,16 +19,13 @@ def i_register_for_the_course(step, course):
assert
world
.
is_css_present
(
'section.container.dashboard'
)
assert
world
.
is_css_present
(
'section.container.dashboard'
)
@step
(
u'I should see the course numbered "([^"]*)" in my dashboard$'
)
@step
(
u'I should( NOT)? see the course numbered "([^"]*)" in my dashboard$'
)
def
i_should_see_that_course_in_my_dashboard
(
step
,
course
):
def
i_should_see_that_course_in_my_dashboard
(
step
,
doesnt_appear
,
course
):
course_link_css
=
'section.my-courses a[href*="
%
s"]'
%
course
assert
world
.
is_css_present
(
course_link_css
)
@step
(
u'I should NOT see the course numbered "([^"]*)" in my dashboard$'
)
def
i_should_not_see_that_course_in_my_dashboard
(
step
,
course
):
course_link_css
=
'section.my-courses a[href*="
%
s"]'
%
course
course_link_css
=
'section.my-courses a[href*="
%
s"]'
%
course
if
doesnt_appear
:
assert
not
world
.
is_css_present
(
course_link_css
)
assert
not
world
.
is_css_present
(
course_link_css
)
else
:
assert
world
.
is_css_present
(
course_link_css
)
@step
(
u'I unregister for the course numbered "([^"]*)"'
)
@step
(
u'I unregister for the course numbered "([^"]*)"'
)
...
...
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