mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Selenium - implement managed_history decorator for tests.
Creates and deletes a history for tests - good for tests meant to aim at production servers that need to have useful metadata and need to be cleaned up.
This commit is contained in:
@@ -60,6 +60,28 @@ except ImportError:
|
||||
return x
|
||||
|
||||
|
||||
def managed_history(f):
|
||||
"""Ensure a Selenium test has a distinct, named history.
|
||||
|
||||
Cleanup the history after the job is complete as well unless
|
||||
GALAXY_TEST_NO_CLEANUP is set in the environment.
|
||||
"""
|
||||
|
||||
@wraps(f)
|
||||
def func_wrapper(self, *args, **kwds):
|
||||
self.home()
|
||||
history_name = f.__name__ + datetime.datetime.now().strftime("%Y%m%d%H%M%s")
|
||||
self.history_panel_create_new_with_name(history_name)
|
||||
try:
|
||||
f(self, *args, **kwds)
|
||||
finally:
|
||||
if "GALAXY_TEST_NO_CLEANUP" not in os.environ:
|
||||
current_history_id = self.current_history_id()
|
||||
self.api_delete("histories/%s" % current_history_id)
|
||||
|
||||
return func_wrapper
|
||||
|
||||
|
||||
@nottest
|
||||
def selenium_test(f):
|
||||
|
||||
|
||||
@@ -200,8 +200,7 @@ class HistoryGridTestCase(SharedStateSeleniumTestCase):
|
||||
|
||||
def create_history(self, name):
|
||||
self.home()
|
||||
self.click_history_option('Create New')
|
||||
self.history_panel_rename(name)
|
||||
self.history_panel_create_new_with_name(name)
|
||||
|
||||
def publish_current_history(self):
|
||||
self.click_history_option('Share or Publish')
|
||||
|
||||
@@ -297,8 +297,7 @@ class SavedHistoriesTestCase(SharedStateSeleniumTestCase):
|
||||
|
||||
def create_history(self, name):
|
||||
self.home()
|
||||
self.click_history_option('Create New')
|
||||
self.history_panel_rename(name)
|
||||
self.history_panel_create_new_with_name(name)
|
||||
|
||||
def select_filter(self, filter_key, filter_value):
|
||||
filter_selector = 'a[filter_key="%s"][filter_val="%s"]' % \
|
||||
|
||||
Reference in New Issue
Block a user