Wrap logic for selecting options in acceptance tests

This commit is contained in:
Jay Zoldak
2013-09-26 16:07:20 -04:00
parent 2379e7c3fc
commit 8e6c0ea937
2 changed files with 15 additions and 8 deletions

View File

@@ -166,9 +166,7 @@ def answer_problem(problem_type, correctness):
if problem_type == "drop down":
select_name = "input_i4x-edx-model_course-problem-drop_down_2_1"
option_text = 'Option 2' if correctness == 'correct' else 'Option 3'
# First wait for the element to be there on the page
world.wait_for_visible("select#{}".format(select_name))
world.browser.select(select_name, option_text)
world.select_option(select_name, option_text)
elif problem_type == "multiple choice":
if correctness == 'correct':
@@ -244,7 +242,7 @@ def problem_has_answer(problem_type, answer_class):
if answer_class == 'blank':
assert world.is_css_not_present('option[selected="true"]')
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'
assert actual == expected
@@ -305,10 +303,6 @@ def problem_has_answer(problem_type, answer_class):
pass
##############################
# HELPER METHODS
##############################
def add_problem_to_course(course, problem_type, extraMeta=None):
'''
Add a problem to the course we have created using factories.