Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
0858dfde
Commit
0858dfde
authored
11 years ago
by
Jay Zoldak
Browse files
Options
Downloads
Plain Diff
Merge pull request #1141 from edx/zoldak/fix-problem-test
Wrap logic for selecting options in acceptance tests
parents
2379e7c3
8e6c0ea9
No related branches found
Branches containing commit
Tags
release-2019-12-19-10.16
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/terrain/ui_helpers.py
+13
-0
13 additions, 0 deletions
common/djangoapps/terrain/ui_helpers.py
lms/djangoapps/courseware/features/problems_setup.py
+2
-8
2 additions, 8 deletions
lms/djangoapps/courseware/features/problems_setup.py
with
15 additions
and
8 deletions
common/djangoapps/terrain/ui_helpers.py
+
13
−
0
View file @
0858dfde
...
@@ -189,6 +189,19 @@ def css_click_at(css_selector, index=0, x_coord=10, y_coord=10, timeout=5):
...
@@ -189,6 +189,19 @@ def css_click_at(css_selector, index=0, x_coord=10, y_coord=10, timeout=5):
element
.
action_chains
.
perform
()
element
.
action_chains
.
perform
()
@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
@world.absorb
def
id_click
(
elem_id
):
def
id_click
(
elem_id
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/features/problems_setup.py
+
2
−
8
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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment