From 30ba4b825e5880e394f531028616d9ef04e88ab5 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 25 Jun 2021 11:06:28 +0200 Subject: [PATCH] Fix TRS search if search term contains - Such as `organization: iwc-workflows`. --- lib/galaxy/selenium/navigation.yml | 1 + lib/galaxy/util/search.py | 2 +- test/integration_selenium/test_trs_import.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index aa1b6d4925c..81867365802 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -390,6 +390,7 @@ trs_search: selector: "//td[contains(text(), '${workflow_name}')]" import_button: ".workflow-import" select_server_button: "#dropdownTrsServer" + import_version: '[data-version-name*="${version}"]' select_server: type: xpath selector: "//a[contains(@class, 'dropdown-item') and text() = '${server}']" diff --git a/lib/galaxy/util/search.py b/lib/galaxy/util/search.py index 32fe2b192ca..e0bda0d956d 100644 --- a/lib/galaxy/util/search.py +++ b/lib/galaxy/util/search.py @@ -17,7 +17,7 @@ def parse_filters(search_term, filters): search_term_without_filters = None search_space = search_term.replace('"', "'") filter_keys = "|".join(list(filters.keys())) - pattern = fr"({filter_keys}):(\w+|\'.*?\')" + pattern = fr"({filter_keys}):([\w-]+|\'.*?\')" reserved = re.compile(pattern) while True: match = reserved.search(search_space) diff --git a/test/integration_selenium/test_trs_import.py b/test/integration_selenium/test_trs_import.py index ba423e31832..e5385088ce0 100644 --- a/test/integration_selenium/test_trs_import.py +++ b/test/integration_selenium/test_trs_import.py @@ -16,6 +16,7 @@ TRS_CONFIG = """ link_url: https://workflowhub.eu """ TRS_ID_DOCKSTORE = "workflow/github.com/iwc-workflows/sars-cov-2-pe-illumina-artic-variant-calling/COVID-19-PE-ARTIC-ILLUMINA" +TRS_NAME = "sars-cov-2-pe-illumina-artic-variant-calling/COVID-19-PE-ARTIC-ILLUMINA" TRS_VERSION_DOCKSTORE = 'v0.4' TRS_ID_WORKFLOWHUB = "110" TRS_VERSION_WORKFLOWHUB = "4" @@ -65,6 +66,15 @@ class TrsImportTestCase(SeleniumIntegrationTestCase): self.workflow_index_open() self.assert_workflow_imported("Test Workflow") + def test_import_by_organization_search_dockstore(self): + self.trs_search() + self.components.trs_search.search.wait_for_and_send_keys('organization:iwc-workflows') + self.components.trs_search.search_result(workflow_name=TRS_NAME).wait_for_and_click() + self.components.trs_search.import_version(version="v0.4").wait_for_and_click() + self.sleep_for(self.wait_types.UX_RENDER) + self.workflow_index_open() + self.assert_workflow_imported(WORKFLOW_NAME) + def test_import_by_search_workflowhub(self): self.trs_search() self.components.trs_search.select_server_button.wait_for_and_click()