Fix another issue with sorting by owner for published histories Selenium test.

Locally this never happens, but remotely sometimes when sorting by owner the histories are sorted by owner but not in the same order as the test was asserting. I would assume this is likely a postgres vs. sqlite difference - perhaps the former doesn't sort the rows by the order they were created within equal sort classifications (i.e. same owner) but the latter does. I've fixed this - the test should not have been asserting such a strong condition I don't think.
This commit is contained in:
John Chilton
2017-09-09 08:28:01 -04:00
parent 900699037d
commit b9cff7ad91
@@ -82,16 +82,14 @@ class HistoryGridTestCase(SeleniumTestCase):
@selenium_test
def test_history_grid_sort_by_name(self):
self.navigate_to_published_histories_page()
sort_link = self.wait_for_selector('th#name-header > a')
sort_link.click()
self.wait_for_and_click_selector('th#name-header > a')
self.assert_grid_histories_are([HISTORY1_NAME, HISTORY2_NAME, HISTORY3_NAME])
@selenium_test
def test_history_grid_sort_by_owner(self):
self.navigate_to_published_histories_page()
sort_link = self.wait_for_selector('th#username-header > a')
sort_link.click()
self.assert_grid_histories_are([HISTORY1_NAME, HISTORY3_NAME, HISTORY2_NAME])
self.wait_for_and_click_selector('th#username-header > a')
self.assert_grid_histories_sorted_by_owner()
@selenium_test
def test_history_grid_tag_click(self):
@@ -125,6 +123,15 @@ class HistoryGridTestCase(SeleniumTestCase):
return names
@retry_assertion_during_transitions
def assert_grid_histories_sorted_by_owner(self):
histories = self.get_histories()
index_1, index_2, index_3 = [histories.index(n) for n in [HISTORY1_NAME, HISTORY2_NAME, HISTORY3_NAME]]
# 1 and 3 are owned by a owner whose username lexicographically
# precedes 2. So verify 1 and 3 come before 2.
assert index_1 < index_2
assert index_3 < index_2
@retry_assertion_during_transitions
def assert_grid_histories_are(self, expected_histories, sort_matters=True):
actual_histories = self.get_histories()