mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Merge pull request #9782 from davebx/selenium_test_toolbox_filters
Add selenium test for user toolbox filters.
This commit is contained in:
@@ -849,6 +849,11 @@ class NavigatesGalaxy(HasDriver):
|
||||
self.wait_for_and_click_selector("#workflow-save-button")
|
||||
self.sleep_for(self.wait_types.DATABASE_OPERATION)
|
||||
|
||||
def navigate_to_user_preferences(self):
|
||||
self.home()
|
||||
self.click_masthead_user()
|
||||
self.components.masthead.preferences.wait_for_and_click()
|
||||
|
||||
def admin_open(self):
|
||||
self.components.masthead.admin.wait_for_and_click()
|
||||
|
||||
|
||||
@@ -71,10 +71,15 @@ preferences:
|
||||
sign_out: "#edit-preferences-sign-out"
|
||||
change_password: "#edit-preferences-password"
|
||||
manage_information: '#edit-preferences-information'
|
||||
toolbox_filters: '#edit-preferences-toolbox-filters'
|
||||
manage_api_key: '#edit-preferences-api-key'
|
||||
current_email: "#user-preferences-current-email"
|
||||
get_new_key: '#submit'
|
||||
|
||||
toolbox_filters:
|
||||
selectors:
|
||||
submit: '#submit'
|
||||
|
||||
change_user_email:
|
||||
selectors:
|
||||
submit: '#submit'
|
||||
|
||||
@@ -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
|
||||
@@ -1,6 +1,25 @@
|
||||
import logging
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
def restrict_encode( context, tool ):
|
||||
"""
|
||||
Disable the random interval ENCODE tool
|
||||
|
||||
This tool filter will disable all the ENCODE tool when enabled.
|
||||
"""
|
||||
if tool.id == 'random_intervals1':
|
||||
return False
|
||||
return True
|
||||
|
||||
def restrict_text( context, section ):
|
||||
"""
|
||||
Disable the Text Manipulation section
|
||||
|
||||
This tool filter will disable the Text Manipulation section.
|
||||
"""
|
||||
if section.name == 'Text Manipulation':
|
||||
return False
|
||||
return True
|
||||
|
||||
def restrict_upload_to_admins( context, tool ):
|
||||
"""
|
||||
|
||||
@@ -118,11 +118,6 @@ class ManageInformationTestCase(SeleniumTestCase):
|
||||
input_field = self.get_address_input_field(get_address_form(), input_field_label)
|
||||
self.assertTrue(input_field.get_attribute('value') == address_fields[input_field_label])
|
||||
|
||||
def navigate_to_user_preferences(self):
|
||||
self.home()
|
||||
self.click_masthead_user()
|
||||
self.components.masthead.preferences.wait_for_and_click()
|
||||
|
||||
def navigate_to_manage_information(self):
|
||||
self.navigate_to_user_preferences()
|
||||
self.components.preferences.manage_information.wait_for_and_click()
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
from .framework import (
|
||||
selenium_test,
|
||||
SeleniumIntegrationTestCase
|
||||
)
|
||||
|
||||
TEST_FILTER_MODULES = 'galaxy.selenium.toolbox'
|
||||
TEST_SECTION_FILTERS = 'filters:restrict_test'
|
||||
|
||||
|
||||
class ToolboxFiltersSeleniumIntegrationTestCase(SeleniumIntegrationTestCase):
|
||||
|
||||
@classmethod
|
||||
def handle_galaxy_config_kwds(cls, config):
|
||||
config["user_tool_section_filters"] = TEST_SECTION_FILTERS
|
||||
config["toolbox_filter_base_modules"] = TEST_FILTER_MODULES
|
||||
|
||||
@selenium_test
|
||||
def test_toolbox_filters(self):
|
||||
'''
|
||||
Test applying and removing a toolbox filter.
|
||||
|
||||
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()
|
||||
# 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 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)
|
||||
self.components.toolbox_filters.submit.wait_for_and_click()
|
||||
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('Test Section'))
|
||||
Reference in New Issue
Block a user