Commit 0b28c3fd by Zia Fazal

trying to fix a flaky test

removed flaky decorator

added promise to make sure value is selected

refined promise callback

return False if option has not value
parent a70cabc1
...@@ -10,6 +10,7 @@ from datetime import datetime ...@@ -10,6 +10,7 @@ from datetime import datetime
from path import path from path import path
from bok_choy.javascript import js_defined from bok_choy.javascript import js_defined
from bok_choy.web_app_test import WebAppTest from bok_choy.web_app_test import WebAppTest
from bok_choy.promise import EmptyPromise
from opaque_keys.edx.locator import CourseLocator from opaque_keys.edx.locator import CourseLocator
from pymongo import MongoClient from pymongo import MongoClient
from xmodule.partitions.partitions import UserPartition from xmodule.partitions.partitions import UserPartition
...@@ -215,6 +216,28 @@ def select_option_by_value(browser_query, value): ...@@ -215,6 +216,28 @@ def select_option_by_value(browser_query, value):
select = Select(browser_query.first.results[0]) select = Select(browser_query.first.results[0])
select.select_by_value(value) select.select_by_value(value)
def options_selected():
"""
Returns True if all options in select element where value attribute
matches `value`. if any option is not selected then returns False
and select it. if value is not an option choice then it returns False.
"""
all_options_selected = True
has_option = False
for opt in select.options:
if opt.get_attribute('value') == value:
has_option = True
if not opt.is_selected():
all_options_selected = False
opt.click()
# if value is not an option choice then it should return false
if all_options_selected and not has_option:
all_options_selected = False
return all_options_selected
# Make sure specified option is actually selected
EmptyPromise(options_selected, "Option is selected").fulfill()
def is_option_value_selected(browser_query, value): def is_option_value_selected(browser_query, value):
""" """
......
...@@ -40,7 +40,6 @@ class SettingsMilestonesTest(StudioCourseTest): ...@@ -40,7 +40,6 @@ class SettingsMilestonesTest(StudioCourseTest):
self.assertTrue(self.settings_detail.pre_requisite_course_options) self.assertTrue(self.settings_detail.pre_requisite_course_options)
@skip("Flaky test. See SOL-449")
def test_prerequisite_course_save_successfully(self): def test_prerequisite_course_save_successfully(self):
""" """
Scenario: Selecting course from Pre-Requisite course drop down save the selected course as pre-requisite Scenario: Selecting course from Pre-Requisite course drop down save the selected course as pre-requisite
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment