Use configuration to activate a filter for testing.

This commit is contained in:
Dave B
2020-06-03 13:35:19 -04:00
parent 05bce2f499
commit d638804ab4
6 changed files with 26 additions and 9 deletions
-2
View File
@@ -23,6 +23,4 @@ YARN_CACHE_FOLDER=~/.jenkins-yarn-cache
DOCKER_RUN_EXTRA_ARGS="${DOCKER_RUN_EXTRA_ARGS} --shm-size=2g -v $YARN_CACHE_FOLDER:$YARN_CACHE_FOLDER -e YARN_CACHE_FOLDER=$YARN_CACHE_FOLDER -e USE_SELENIUM=1 -e GALAXY_TEST_SELENIUM_RETRIES=${GALAXY_TEST_SELENIUM_RETRIES} -e GALAXY_TEST_ERRORS_DIRECTORY=${GALAXY_TEST_ERRORS_DIRECTORY} -e GALAXY_TEST_SCREENSHOTS_DIRECTORY=${GALAXY_TEST_SCREENSHOTS_DIRECTORY}"
export DOCKER_RUN_EXTRA_ARGS
cp lib/galaxy/tools/toolbox/filters/examples.py.sample lib/galaxy/tools/toolbox/filters/examples.py
./run_tests.sh --dockerize --db postgres --clean_pyc --skip_flakey_fails --selenium "$@"
+9
View File
@@ -0,0 +1,9 @@
def restrict_test( context, section ):
"""
Disable the Test Section section
This tool filter will disable the Test Section section.
"""
if section.name == 'Test Section':
return False
return True
+4
View File
@@ -53,6 +53,8 @@ GALAXY_TEST_DIRECTORY = os.path.join(galaxy_root, "test")
GALAXY_TEST_FILE_DIR = "test-data,https://github.com/galaxyproject/galaxy-test-data.git"
TOOL_SHED_TEST_DATA = os.path.join(galaxy_root, "lib", "tool_shed", "test", "test_data")
TEST_WEBHOOKS_DIR = os.path.join(galaxy_root, "test", "functional", "webhooks")
TEST_FILTER_MODULES = 'galaxy.selenium.toolbox,galaxy.tools.filters,galaxy.tools.toolbox.filters'
TEST_SECTION_FILTERS = 'filters:restrict_test'
FRAMEWORK_TOOLS_DIR = os.path.join(GALAXY_TEST_DIRECTORY, "functional", "tools")
FRAMEWORK_UPLOAD_TOOL_CONF = os.path.join(FRAMEWORK_TOOLS_DIR, "upload_tool_conf.xml")
FRAMEWORK_SAMPLE_TOOLS_CONF = os.path.join(FRAMEWORK_TOOLS_DIR, "samples_tool_conf.xml")
@@ -211,6 +213,8 @@ def setup_galaxy_config(
shed_tool_data_table_config = default_shed_tool_data_table_config
config = dict(
user_tool_section_filters=TEST_SECTION_FILTERS,
toolbox_filter_base_modules=TEST_FILTER_MODULES,
admin_users='test@bx.psu.edu',
allow_library_path_paste=True,
allow_user_creation=True,
@@ -13,18 +13,18 @@ class ManageInformationTestCase(SeleniumTestCase):
'''
Test applying and removing a toolbox filter.
This test applies the filter examples:restrict_text and confirms that
the text manipulation section is no longer displayed in the browser.
This test applies the filter galaxy.selenium.filters.toolbox:restrict_test and confirms that
the specified section is no longer displayed in the browser.
'''
self.register()
self.home()
# The text manipulation section should be visible and clickable at this stage
section = self.driver.find_element_by_link_text('Text Manipulation')
# The tool panel section should be visible and clickable at this stage
section = self.driver.find_element_by_link_text('Test Section')
self.action_chains().move_to_element(section).click().perform()
self.navigate_to_user_preferences()
self.components.preferences.toolbox_filters.wait_for_and_click()
self.sleep_for(self.wait_types.UX_RENDER)
sibling_text = "This tool filter will disable the Text Manipulation section."
sibling_text = 'This tool filter will disable the Test Section section.'
# This is the least terrible way I've found to get the right element.
filter_upload = self.driver.find_element_by_xpath("//span[contains(. ,'%s')]/../div//label" % sibling_text)
self.action_chains().move_to_element(filter_upload).click().perform()
self.sleep_for(self.wait_types.UX_RENDER)
@@ -32,7 +32,7 @@ class ManageInformationTestCase(SeleniumTestCase):
self.sleep_for(self.wait_types.UX_RENDER)
self.home()
# But now it should raise NoSuchElementException
self.assertRaises(NoSuchElementException, lambda: self.driver.find_element_by_link_text('Text Manipulation'))
self.assertRaises(NoSuchElementException, lambda: self.driver.find_element_by_link_text('Test Section'))
@selenium_test
def test_api_key(self):
@@ -1,6 +1,12 @@
<?xml version="1.0"?>
<toolbox tool_path="${tool_conf_dir}" is_shed_conf="false">
<tool file="upload.xml"/>
<section id="test" name="Test Section">
<tool file="multi_data_optional.xml" />
<tool file="paths_as_file.xml" />
<tool file="param_text_option.xml" />
<tool file="column_param.xml" />
</section>
<tool file="test_data_source.xml"/>
<tool file="simple_constructs.xml" />
<tool file="color_param.xml" />