Skip to content

Commit

Permalink
fix seleniums and adjust navigation.yml for FilterMenu changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Sep 29, 2023
1 parent 70f5e91 commit a7abaef
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 15 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Common/FilterMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ watch(
<!-- is a MultiTags filter -->
<span v-else-if="validFilters[filter]?.type == 'MultiTags'">
<small>Filter by {{ validFilters[filter]?.placeholder }}:</small>
<b-input-group>
<b-input-group :id="`${identifier}-advanced-filter-${filter}`">
<StatelessTags
:value="multiTagFilters[filter]?.value"
:placeholder="`any ${validFilters[filter]?.placeholder}`"
Expand Down
16 changes: 7 additions & 9 deletions client/src/utils/navigation/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,8 @@ multi_history_panel:
published_histories:
selectors:
histories: '#published-histories-table tbody tr'
search_input:
selector: 'filter text input'
type: data-description
advanced_search_toggle:
selector: 'toggle advanced search'
type: data-description
search_input: '#published-histories input.search-query[data-description="filter text input"]'
advanced_search_toggle: '#published-histories [data-description="toggle advanced search"]'
advanced_search_name_input: '#published-histories-advanced-filter-name'
advanced_search_tag_input: '#published-histories-advanced-filter-tag'
advanced_search_submit: '#published-histories-advanced-filter-submit'
Expand Down Expand Up @@ -582,9 +578,11 @@ workflows:
new_button: '#workflow-create'
import_button: '#workflow-import'
save_button: '#workflow-save-button'
search_box:
selector: 'filter text input'
type: data-description
search_box: '.workflows-list input.search-query[data-description="filter text input"]'
clear_filter: '.workflows-list [data-description="reset query"]'
advanced_search_toggle: '.workflows-list [data-description="toggle advanced search"]'
advanced_search_name_input: '#workflows-advanced-filter-name'
advanced_search_tag_input: '#workflows-advanced-filter-tag .stateless-tags'
workflow_table: "#workflow-table"
workflow_rows: "#workflow-table > tbody > tr:not(.b-table-empty-row, [style*='display: none'])"
external_link: '.workflow-external-link'
Expand Down
4 changes: 2 additions & 2 deletions config/plugins/tours/core.history.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ steps:
intro: "You can remove a dataset from the history with the trash can symbol."
postclick: true

- element: "#current-history-panel input[data-description='filter text input']"
- element: "#current-history-panel .content-operations-filters input[data-description='filter text input']"
title: "Filter your datasets"
intro: "By default your history will hide all deleted datasets from you. You can visualize them by filtering."
textinsert: "deleted:true"
Expand All @@ -83,7 +83,7 @@ steps:
Please note that datasets marked as deleted can be purged by your administrator at any time.
postclick: true

- element: "#current-history-panel [data-description='filter text input']"
- element: "#current-history-panel .content-operations-filters input[data-description='filter text input']"
title: "Search your History"
intro: "You can filter your history by typing your search term in here. Galaxy supports more advanced filters that can be seen here."
textinsert: ""
Expand Down
17 changes: 16 additions & 1 deletion lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Any,
cast,
Dict,
List,
NamedTuple,
Optional,
Union,
Expand Down Expand Up @@ -1380,7 +1381,13 @@ def workflow_index_column_text(self, column_index, workflow_index=0):
return columns[column_index].text

def workflow_index_click_search(self):
return self.wait_for_and_click_selector('[data-description="filter text input"]')
return self.wait_for_and_click_selector(
'.workflows-list input.search-query[data-description="filter text input"]'
)

def workflow_index_get_current_filter(self):
filter_element = self.components.workflows.search_box.wait_for_and_click()
return filter_element.get_attribute("value")

def workflow_index_search_for(self, search_term=None):
return self._inline_search_for(
Expand All @@ -1389,6 +1396,14 @@ def workflow_index_search_for(self, search_term=None):
escape_to_clear=True,
)

def workflow_index_add_advanced_tag_filter(self, tags: List[str]):
for tag in tags:
tag_display = self.components.workflows.advanced_search_tag_input
if tag_display.is_absent:
self.components.workflows.advanced_search_toggle.wait_for_and_click()
tag_display.wait_for_and_click()
self.tagging_add([tag])

def workflow_index_click_import(self):
return self.components.workflows.import_button.wait_for_and_click()

Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy_test/selenium/test_collection_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def _wait_for_and_select(self, hids):
def _show_hidden_content(self):
"""Switches the hidden filter toggle on"""
self.sleep_for(self.wait_types.UX_RENDER)
filter_element = self.history_element("filter text input").wait_for_and_click()
filter_element = self.history_element(
attribute_value="filter text input", scope=".content-operations-filters"
).wait_for_and_click()
filter_element.send_keys("visible:false")
self.sleep_for(self.wait_types.UX_RENDER)
4 changes: 3 additions & 1 deletion lib/galaxy_test/selenium/test_history_related_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def test_history_related_filter(self):
unrelated_hda.assert_absent_or_hidden()

# test related filter on unrelated item using filterText: only unrelated item shows
filter_element = self.history_element("filter text input").wait_for_and_click()
filter_element = self.history_element(
attribute_value="filter text input", scope=".content-operations-filters"
).wait_for_and_click()
initial_value = filter_element.get_attribute("value")
assert initial_value == f"related:{CURRENT_HID}", initial_value
self.history_element("clear filters").wait_for_and_click()
Expand Down
28 changes: 28 additions & 0 deletions lib/galaxy_test/selenium/test_workflow_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,34 @@ def test_index_search_filters(self):
self._assert_showing_n_workflows(0)
self.screenshot("workflow_manage_search_name_alias")

@selenium_test
def test_index_advanced_search(self):
self.workflow_index_open()
self._workflow_import_from_url()
self.workflow_index_rename("searchforthis")
self._assert_showing_n_workflows(1)

self.workflow_index_add_tag("mytag")
self.components.workflows.advanced_search_toggle.wait_for_and_click()
# search by tag and name
self.components.workflows.advanced_search_name_input.wait_for_and_send_keys("searchforthis")
self.workflow_index_add_advanced_tag_filter(["mytag"])
self._assert_showing_n_workflows(1)
curr_value = self.workflow_index_get_current_filter()
assert curr_value == f"name:searchforthis tag:mytag", curr_value

# clear filter
self.components.workflows.clear_filter.wait_for_and_click()
curr_value = self.workflow_index_get_current_filter()
assert curr_value == f"", curr_value

self.components.workflows.advanced_search_toggle.wait_for_and_click()
# search by 2 tags, one of which is not present
self.workflow_index_add_advanced_tag_filter(["mytag", "DNEtag"])
curr_value = self.workflow_index_get_current_filter()
assert curr_value == f"tag:mytag tag:DNEtag", curr_value
self._assert_showing_n_workflows(0)

@selenium_test
def test_workflow_delete(self):
self.workflow_index_open()
Expand Down

0 comments on commit a7abaef

Please sign in to comment.