Files
galaxy/test/selenium_tests/test_anon_history.py
T
John Chilton 97cf3b94d1 Selenium - fix transiently failing test caused by not waiting on anonymous history loading.
After logging out - may need to a wait a second to give the UI and backend a chance to create a new history for the now anoymous user. Pause and let that happen.

xref https://jenkins.galaxyproject.org/job/selenium/585/artifact/585-test-errors/test_clean_anon_history_after_logout2017092412041506269041/
2017-09-24 17:00:53 -04:00

62 lines
2.5 KiB
Python

from .framework import SeleniumTestCase
from .framework import selenium_test
class AnonymousHistoriesTestCase(SeleniumTestCase):
@selenium_test
def test_anon_history_landing(self):
self.home()
self.assert_initial_history_panel_state_correct()
tag_icon_selector = self.test_data["historyPanel"]["selectors"]["history"]["tagIcon"]
anno_icon_selector = self.test_data["historyPanel"]["selectors"]["history"]["annoIcon"]
self.assert_selector_absent(tag_icon_selector)
self.assert_selector_absent(anno_icon_selector)
name_selector = self.test_data["historyPanel"]["selectors"]["history"]["name"]
name_element = self.wait_for_selector(name_selector)
# name should NOT be editable when clicked by anon-user
editable_text_class = self.test_data["selectors"]["editableText"]
assert editable_text_class not in name_element.get_attribute("class")
name_element.click()
@selenium_test
def test_anon_history_upload(self):
self.home()
self.perform_upload(self.get_filename("1.txt"))
self.wait_for_history()
hda = self.latest_history_item()
self.home()
element = self.wait_for_selector(self.hda_div_selector(hda["id"]))
assert 'state-ok' in element.get_attribute("class")
# empty should be NO LONGER be displayed
empty_msg_selector = self.test_data["historyPanel"]["selectors"]["history"]["emptyMsg"]
self.assert_selector_absent_or_hidden(empty_msg_selector)
@selenium_test
def test_anon_history_after_registration(self):
self._upload_file_anonymous_then_register_user()
hda = self.latest_history_item()
self.home()
element = self.wait_for_selector(self.hda_div_selector(hda["id"]))
assert 'state-ok' in element.get_attribute("class")
@selenium_test
def test_clean_anon_history_after_logout(self):
self._upload_file_anonymous_then_register_user()
self.logout_if_needed()
# Give Galaxy a chance to load the new empty history for that now
# anonymous user. Make sure this new history is empty.
self.history_panel_wait_for_history_loaded()
history_contents = self.current_history_contents()
assert len(history_contents) == 0
def _upload_file_anonymous_then_register_user(self):
self.home()
self.perform_upload(self.get_filename("1.txt"))
self.wait_for_history()
self.register()