Skip to content

Commit

Permalink
Add multiple history delete and undelete test case
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Jan 15, 2024
1 parent 07af273 commit 53f3c43
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Grid/GridList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ watch(operationMessage, () => {
class="mr-2"
size="sm"
variant="primary"
:data-description="`grid action ${batchOperation.title.toLowerCase()}`"
:data-description="`grid batch ${batchOperation.title.toLowerCase()}`"
@click="onBatchOperation(batchOperation, Array.from(selected))">
<Icon :icon="batchOperation.icon" class="mr-1" />
<span v-localize>{{ batchOperation.title }} ({{ selected.size }})</span>
Expand Down
10 changes: 10 additions & 0 deletions lib/galaxy/selenium/navigates_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,16 @@ def select_grid_cell(self, grid_name, item_name, column_index=3):

return cell

def check_grid_rows(self, grid_name, item_names):
grid = self.wait_for_selector(grid_name)
for row in grid.find_elements(By.TAG_NAME, "tr"):
td = row.find_elements(By.TAG_NAME, "td")
item_name = td[1].text
if item_name in item_names:
checkbox = td[0].find_element(self.by.TAG_NAME, "input")
# bootstrap vue checkbox seems to be hidden by label, but the label is not interactable
self.driver.execute_script("$(arguments[0]).click();", checkbox)

def published_grid_search_for(self, search_term=None):
return self._inline_search_for(
self.navigation.grids.free_text_search,
Expand Down
36 changes: 34 additions & 2 deletions lib/galaxy_test/selenium/test_histories_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,40 @@ def test_permanently_delete_history(self):

self.assert_histories_in_grid([self.history4_name])

@selenium_test
def test_delete_and_undelete_multiple_histories(self):
self._login()
self.navigate_to_histories_page()

delete_button_selector = 'button[data-description="grid batch delete"]'
undelete_button_selector = 'button[data-description="grid batch restore"]'

# Select multiple histories
self.check_grid_rows("#histories-grid", [self.history2_name, self.history3_name])

# Delete multiple histories
self.wait_for_and_click_selector(delete_button_selector)
alert = self.driver.switch_to.alert
alert.accept()

# Display deleted histories
self.components.histories.advanced_search_toggle.wait_for_and_click()
self.components.histories.advanced_search_filter(filter="deleted").wait_for_and_click()
self.components.histories.advanced_search_submit.wait_for_and_click()

# Select multiple histories
self.sleep_for(self.wait_types.UX_RENDER)
self.check_grid_rows("#histories-grid", [self.history2_name, self.history3_name])

# Undelete multiple histories
self.wait_for_and_click_selector(undelete_button_selector)
alert = self.driver.switch_to.alert
alert.accept()

# Verify deleted histories have been undeleted
self.components.histories.reset_input.wait_for_and_click()
self.assert_histories_in_grid([self.history2_name, self.history3_name])

@selenium_test
def test_sort_by_name(self):
self._login()
Expand All @@ -141,7 +175,6 @@ def test_sort_by_name(self):
def test_standard_search(self):
self._login()
self.navigate_to_histories_page()
self.sleep_for(self.wait_types.UX_RENDER)
self.components.histories.search_input.wait_for_and_send_keys(self.history2_name)
self.assert_grid_histories_are([self.history2_name])
self.components.histories.reset_input.wait_for_and_click()
Expand All @@ -152,7 +185,6 @@ def test_standard_search(self):
def test_advanced_search(self):
self._login()
self.navigate_to_histories_page()
self.sleep_for(self.wait_types.UX_RENDER)
# search by name
self.components.histories.advanced_search_toggle.wait_for_and_click()
self.components.histories.advanced_search_name_input.wait_for_and_send_keys(self.history3_name)
Expand Down

0 comments on commit 53f3c43

Please sign in to comment.