From 0cac09d9ebf60aa6e84d585a6f78dc8d84324e87 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 15 May 2023 09:29:11 -0400 Subject: [PATCH] Improve robustness and abstractions used by collection edit tests. --- .../Collections/common/ChangeDatatypeTab.vue | 14 +++-- .../Collections/common/CollectionEditView.vue | 14 ++++- client/src/utils/navigation/navigation.yml | 10 ++-- .../selenium/test_collection_edit.py | 59 +++++++------------ 4 files changed, 47 insertions(+), 50 deletions(-) diff --git a/client/src/components/Collections/common/ChangeDatatypeTab.vue b/client/src/components/Collections/common/ChangeDatatypeTab.vue index c6d2c2d22d6..08af177adcc 100644 --- a/client/src/components/Collections/common/ChangeDatatypeTab.vue +++ b/client/src/components/Collections/common/ChangeDatatypeTab.vue @@ -3,16 +3,14 @@
Change Datatype/Extension of all elements in collection
-
{{ l("New Type") }}: element.id == this.datatypeFromElements); this.currentDatatype = this.datatypeFromElements; diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 6a50660bad4..63aba7e5f16 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -10,7 +10,9 @@ - +
@@ -24,13 +26,19 @@
- + - + diff --git a/client/src/utils/navigation/navigation.yml b/client/src/utils/navigation/navigation.yml index 29771100eb8..7b067540580 100644 --- a/client/src/utils/navigation/navigation.yml +++ b/client/src/utils/navigation/navigation.yml @@ -312,15 +312,13 @@ edit_dataset_attributes: edit_collection_attributes: selectors: alert_info: 'div.alert-info' - database_genome_tab: - type: xpath - selector: '//a[contains(text(), "Database/Build")]' - datatypes_tab: - type: xpath - selector: '//a[contains(text(), "Datatypes")]' + database_genome_tab: '.collection-edit-change-genome-nav' + datatypes_tab: '.collection-edit-change-datatype-nav' data_value: type: xpath selector: '//span[contains(text(), "${data_change}")]' + genome_select_search: ".database-dropdown input.multiselect__input" + datatype_select_search: '.datatype-dropdown input.multiselect__input' save_dbkey_btn: '.save-dbkey-edit' save_datatype_btn: '.save-datatype-edit' diff --git a/lib/galaxy_test/selenium/test_collection_edit.py b/lib/galaxy_test/selenium/test_collection_edit.py index 8fa221df878..0763467588f 100644 --- a/lib/galaxy_test/selenium/test_collection_edit.py +++ b/lib/galaxy_test/selenium/test_collection_edit.py @@ -9,7 +9,7 @@ class TestCollectionEdit(SeleniumTestCase): @selenium_test def test_change_dbkey_simple_list(self): - self.create_simple_list_collection() + self._create_simple_list_collection("1.fasta", "fasta") self.open_collection_edit_view() self.navigate_to_database_tab() alert_element = self.components.edit_collection_attributes.alert_info.wait_for_visible() @@ -25,7 +25,7 @@ class TestCollectionEdit(SeleniumTestCase): @selenium_test def test_change_datatype_simple_list(self): - self.create_simple_list_collection_txt() + self._create_simple_list_collection("1.txt", "txt") self.open_collection_edit_view() self.navigate_to_datatype_tab() alert_element = self.components.edit_collection_attributes.alert_info.wait_for_visible() @@ -39,30 +39,19 @@ class TestCollectionEdit(SeleniumTestCase): self.change_datatype_value_and_click_submit(dataValue, dataNew) self.check_current_data_value(dataNew) self.wait_for_history() - self.find_element_by_selector("span.content-title").click() - self.wait_for_selector_clickable("div.content-item") - self.find_element_by_selector("div.content-item").click() + self.history_panel_expand_collection(2) + self.history_panel_ensure_showing_item_details(1) item = self.history_panel_item_component(hid=1) item.datatype.wait_for_visible() - assert self.find_element_by_selector("span.datatype > span").text == dataNew + assert item.datatype.wait_for_text() == dataNew - def create_simple_list_collection(self): - self.perform_upload(self.get_filename("1.fasta")) - self._wait_for_and_select([1]) - self._collection_dropdown("build list") - self.collection_builder_set_name("my cool list") - self.screenshot("collection_builder_list") - self.collection_builder_create() - self._wait_for_hid_visible(2) - - def create_simple_list_collection_txt(self): - self.perform_upload(self.get_filename("1.txt")) + def _create_simple_list_collection(self, filename, ext): + self.perform_upload(self.get_filename(filename), ext=ext) self._wait_for_and_select([1]) self._collection_dropdown("build list") self.collection_builder_set_name("my cool list") - self.screenshot("collection_builder_list") self.collection_builder_create() self._wait_for_hid_visible(2) @@ -70,33 +59,29 @@ class TestCollectionEdit(SeleniumTestCase): self.components.history_panel.collection_menu_edit_attributes.wait_for_and_click() def navigate_to_database_tab(self): - self.components.edit_collection_attributes.database_genome_tab.wait_for_and_click() + self._edit_attributes.database_genome_tab.wait_for_and_click() def navigate_to_datatype_tab(self): - self.components.edit_collection_attributes.datatypes_tab.wait_for_and_click() + self._edit_attributes.datatypes_tab.wait_for_and_click() def check_current_data_value(self, dataValue): - self.components.edit_collection_attributes.data_value(data_change=dataValue).wait_for_visible() + self._edit_attributes.data_value(data_change=dataValue).wait_for_visible() def change_dbkey_value_and_click_submit(self, dataValue, dataNew): - self.components.edit_collection_attributes.data_value(data_change=dataValue).wait_for_and_click() - self.find_element_by_selector( - "div.database-dropdown > div.multiselect__tags > input.multiselect__input" - ).send_keys(dataNew) - self.find_element_by_selector( - "div.database-dropdown > div.multiselect__tags > input.multiselect__input" - ).send_keys(self.keys.ENTER) - self.components.edit_collection_attributes.save_dbkey_btn.wait_for_and_click() + self._edit_attributes.data_value(data_change=dataValue).wait_for_and_click() + self._edit_attributes.genome_select_search.wait_for_and_send_keys(dataNew) + self._edit_attributes.genome_select_search.wait_for_and_send_keys(self.keys.ENTER) + self._edit_attributes.save_dbkey_btn.wait_for_and_click() def change_datatype_value_and_click_submit(self, dataValue, dataNew): - self.components.edit_collection_attributes.data_value(data_change=dataValue).wait_for_and_click() - self.find_element_by_selector( - "div.datatype-dropdown > div.multiselect__tags > input.multiselect__input" - ).send_keys(dataNew) - self.find_element_by_selector( - "div.datatype-dropdown > div.multiselect__tags > input.multiselect__input" - ).send_keys(self.keys.ENTER) - self.components.edit_collection_attributes.save_datatype_btn.wait_for_and_click() + self._edit_attributes.data_value(data_change=dataValue).wait_for_and_click() + self._edit_attributes.datatype_select_search.wait_for_and_send_keys(dataNew) + self._edit_attributes.datatype_select_search.wait_for_and_send_keys(self.keys.ENTER) + self._edit_attributes.save_datatype_btn.wait_for_and_click() + + @property + def _edit_attributes(self): + return self.components.edit_collection_attributes def _wait_for_and_select(self, hids): """