From 53f3c43e690f121ec954377bb0e7a4d561f1d697 Mon Sep 17 00:00:00 2001 From: guerler Date: Sun, 14 Jan 2024 11:34:59 +0300 Subject: [PATCH] Add multiple history delete and undelete test case --- client/src/components/Grid/GridList.vue | 2 +- lib/galaxy/selenium/navigates_galaxy.py | 10 ++++++ .../selenium/test_histories_list.py | 36 +++++++++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/client/src/components/Grid/GridList.vue b/client/src/components/Grid/GridList.vue index da7d31ab3c26..d5eb85074aa1 100644 --- a/client/src/components/Grid/GridList.vue +++ b/client/src/components/Grid/GridList.vue @@ -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))"> {{ batchOperation.title }} ({{ selected.size }}) diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index 77c5084db876..9377cee49e55 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -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, diff --git a/lib/galaxy_test/selenium/test_histories_list.py b/lib/galaxy_test/selenium/test_histories_list.py index aa2885a1a1dc..ae1118e8bf8b 100644 --- a/lib/galaxy_test/selenium/test_histories_list.py +++ b/lib/galaxy_test/selenium/test_histories_list.py @@ -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() @@ -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() @@ -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)