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
0858dfde
Commit
0858dfde
authored
Sep 26, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1141 from edx/zoldak/fix-problem-test
Wrap logic for selecting options in acceptance tests
parents
2379e7c3
8e6c0ea9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
common/djangoapps/terrain/ui_helpers.py
+13
-0
lms/djangoapps/courseware/features/problems_setup.py
+2
-8
No files found.
common/djangoapps/terrain/ui_helpers.py
View file @
0858dfde
...
@@ -190,6 +190,19 @@ def css_click_at(css_selector, index=0, x_coord=10, y_coord=10, timeout=5):
...
@@ -190,6 +190,19 @@ def css_click_at(css_selector, index=0, x_coord=10, y_coord=10, timeout=5):
@world.absorb
@world.absorb
def
select_option
(
name
,
value
,
index
=
0
,
wait_time
=
30
):
'''
A method to select an option
This method will return True if the selection worked.
'''
select_css
=
"select[name='{}']"
.
format
(
name
)
option_css
=
"option[value='{}']"
.
format
(
value
)
css_selector
=
"{} {}"
.
format
(
select_css
,
option_css
)
return
css_click
(
css_selector
=
css_selector
,
index
=
index
,
wait_time
=
wait_time
)
@world.absorb
def
id_click
(
elem_id
):
def
id_click
(
elem_id
):
"""
"""
Perform a click on an element as specified by its id
Perform a click on an element as specified by its id
...
...
lms/djangoapps/courseware/features/problems_setup.py
View file @
0858dfde
...
@@ -166,9 +166,7 @@ def answer_problem(problem_type, correctness):
...
@@ -166,9 +166,7 @@ def answer_problem(problem_type, correctness):
if
problem_type
==
"drop down"
:
if
problem_type
==
"drop down"
:
select_name
=
"input_i4x-edx-model_course-problem-drop_down_2_1"
select_name
=
"input_i4x-edx-model_course-problem-drop_down_2_1"
option_text
=
'Option 2'
if
correctness
==
'correct'
else
'Option 3'
option_text
=
'Option 2'
if
correctness
==
'correct'
else
'Option 3'
# First wait for the element to be there on the page
world
.
select_option
(
select_name
,
option_text
)
world
.
wait_for_visible
(
"select#{}"
.
format
(
select_name
))
world
.
browser
.
select
(
select_name
,
option_text
)
elif
problem_type
==
"multiple choice"
:
elif
problem_type
==
"multiple choice"
:
if
correctness
==
'correct'
:
if
correctness
==
'correct'
:
...
@@ -244,7 +242,7 @@ def problem_has_answer(problem_type, answer_class):
...
@@ -244,7 +242,7 @@ def problem_has_answer(problem_type, answer_class):
if
answer_class
==
'blank'
:
if
answer_class
==
'blank'
:
assert
world
.
is_css_not_present
(
'option[selected="true"]'
)
assert
world
.
is_css_not_present
(
'option[selected="true"]'
)
else
:
else
:
actual
=
world
.
browser
.
find_by_css
(
'option[selected="true"]'
)
.
value
actual
=
world
.
css_value
(
'option[selected="true"]'
)
expected
=
'Option 2'
if
answer_class
==
'correct'
else
'Option 3'
expected
=
'Option 2'
if
answer_class
==
'correct'
else
'Option 3'
assert
actual
==
expected
assert
actual
==
expected
...
@@ -305,10 +303,6 @@ def problem_has_answer(problem_type, answer_class):
...
@@ -305,10 +303,6 @@ def problem_has_answer(problem_type, answer_class):
pass
pass
##############################
# HELPER METHODS
##############################
def
add_problem_to_course
(
course
,
problem_type
,
extraMeta
=
None
):
def
add_problem_to_course
(
course
,
problem_type
,
extraMeta
=
None
):
'''
'''
Add a problem to the course we have created using factories.
Add a problem to the course we have created using factories.
...
...
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