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
This commit is contained in:
@@ -10,6 +10,7 @@ from datetime import datetime
|
||||
from path import path
|
||||
from bok_choy.javascript import js_defined
|
||||
from bok_choy.web_app_test import WebAppTest
|
||||
from bok_choy.promise import EmptyPromise
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from pymongo import MongoClient
|
||||
from xmodule.partitions.partitions import UserPartition
|
||||
@@ -215,6 +216,28 @@ def select_option_by_value(browser_query, value):
|
||||
select = Select(browser_query.first.results[0])
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -40,7 +40,6 @@ class SettingsMilestonesTest(StudioCourseTest):
|
||||
|
||||
self.assertTrue(self.settings_detail.pre_requisite_course_options)
|
||||
|
||||
@skip("Flaky test. See SOL-449")
|
||||
def test_prerequisite_course_save_successfully(self):
|
||||
"""
|
||||
Scenario: Selecting course from Pre-Requisite course drop down save the selected course as pre-requisite
|
||||
|
||||
Reference in New Issue
Block a user