Commit c07cb190 by raeeschachar

Fixed test default sort preference failing on chrome

parent d7c570aa
......@@ -380,14 +380,18 @@ class DiscussionSortPreferencePage(CoursePage):
"""
Return the text of option that is selected for sorting.
"""
options = self.q(css="body.discussion .forum-nav-sort-control option")
return options.filter(lambda el: el.is_selected())[0].get_attribute("value")
# Using this workaround (execute script) to make this test work with Chrome browser
selected_value = self.browser.execute_script(
'var selected_value = $(".forum-nav-sort-control").val(); return selected_value')
return selected_value
def change_sort_preference(self, sort_by):
"""
Change the option of sorting by clicking on new option.
"""
self.q(css="body.discussion .forum-nav-sort-control option[value='{0}']".format(sort_by)).click()
self.q(css=".forum-nav-sort-control option[value='{0}']".format(sort_by)).click()
# Click initiates an ajax call, waiting for it to complete
self.wait_for_ajax()
def refresh_page(self):
"""
......
......@@ -1228,7 +1228,6 @@ class DiscussionSortPreferenceTest(UniqueCourseTest):
self.sort_page = DiscussionSortPreferencePage(self.browser, self.course_id)
self.sort_page.visit()
@flaky # TODO fix this, see TNL-4682
def test_default_sort_preference(self):
"""
Test to check the default sorting preference of user. (Default = date )
......@@ -1247,7 +1246,6 @@ class DiscussionSortPreferenceTest(UniqueCourseTest):
selected_sort = self.sort_page.get_selected_sort_preference()
self.assertEqual(selected_sort, sort_type)
@flaky # TODO fix this, see TNL-4682
def test_last_preference_saved(self):
"""
Test that user last preference is saved.
......
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