diff --git a/lib/galaxy/selenium/cli.py b/lib/galaxy/selenium/cli.py index 9445fa3ac65..5f52d69ce0f 100644 --- a/lib/galaxy/selenium/cli.py +++ b/lib/galaxy/selenium/cli.py @@ -77,6 +77,12 @@ class DriverWrapper(NavigatesGalaxy): def build_url(self, url=""): return urljoin(self.target_url, url) + def screenshot(self, label: str) -> None: + """No-op in this context, not saving debugging/testing screenshots. + + Consider a verbose or debug option for saving these. + """ + @property def default_timeout(self): return 15 diff --git a/lib/galaxy/selenium/context.py b/lib/galaxy/selenium/context.py index 6bddf6db63f..6ba867e8857 100644 --- a/lib/galaxy/selenium/context.py +++ b/lib/galaxy/selenium/context.py @@ -40,12 +40,6 @@ class GalaxySeleniumContext(NavigatesGalaxy): self.driver.save_screenshot(target) return target - def screenshot_if(self, label: Optional[str]) -> Optional[str]: - target = None - if label: - target = self.screenshot(label) - return target - @abstractmethod def _screenshot_path(self, label: str, extension=".png") -> str: """Path to store screenshots in.""" diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index cd159817070..8a38dc0b6b4 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -182,6 +182,16 @@ class NavigatesGalaxy(HasDriver): def build_url(self, url: str, for_selenium: bool = True) -> str: """Build URL to the target Galaxy.""" + @abstractmethod + def screenshot(self, label: str) -> None: + """Take a screenshot of the current browser with the specified label.""" + + def screenshot_if(self, label: Optional[str]) -> Optional[str]: + target = None + if label: + target = self.screenshot(label) + return target + default_password = DEFAULT_PASSWORD wait_types = WAIT_TYPES # set to True to reload each invocation (good for interactive test building) @@ -487,7 +497,8 @@ class NavigatesGalaxy(HasDriver): except SeleniumTimeoutException as e: history_item = self.wait_for_visible(history_item_selector) current_state = "UNKNOWN" - classes = history_item.get_attribute("class").split(" ") + raw_class_str = history_item.get_attribute("class") or "" + classes = raw_class_str.split(" ") for clazz in classes: if clazz.startswith("state-"): current_state = clazz[len("state-") :] @@ -1149,9 +1160,7 @@ class NavigatesGalaxy(HasDriver): self.components.libraries.folder.select_import_dir_item(name=name).wait_for_and_click() self.components.libraries.folder.import_dir_btn.wait_for_and_click() - def create_new_library(self, login=True): - if login: - self.admin_login() + def create_new_library(self): self.libraries_open() self.name = self._get_random_name(prefix="testcontents") self.libraries_index_create(self.name) @@ -1260,8 +1269,8 @@ class NavigatesGalaxy(HasDriver): self.libraries_dataset_import(self.navigation.libraries.folder.labels.from_import_dir) self.select_dataset_from_lib_import_modal(filenames) - def navigate_to_new_library(self, login=True): - self.create_new_library(login) + def navigate_to_new_library(self): + self.create_new_library() self.libraries_open_with_name(self.name) def wait_for_overlays_cleared(self): @@ -1398,8 +1407,8 @@ class NavigatesGalaxy(HasDriver): def tagging_add(self, tags, auto_closes=True, parent_selector=""): for i, tag in enumerate(tags): if auto_closes or i == 0: - tag_area = f"{parent_selector}.multiselect input[type='text']" - tag_area = self.wait_for_selector_clickable(tag_area) + tag_area_selector = f"{parent_selector}.multiselect input[type='text']" + tag_area = self.wait_for_selector_clickable(tag_area_selector) tag_area.click() tag_area.send_keys(tag) diff --git a/lib/galaxy/selenium/scripts/dump_tour.py b/lib/galaxy/selenium/scripts/dump_tour.py index cac64bf427d..825dc1dedb1 100755 --- a/lib/galaxy/selenium/scripts/dump_tour.py +++ b/lib/galaxy/selenium/scripts/dump_tour.py @@ -28,6 +28,8 @@ def main(argv=None): class DumpTourCallback: + driver_wrapper: cli.DriverWrapper + def __init__(self, driver_wrapper, output): self.driver_wrapper = driver_wrapper self.output = output diff --git a/lib/galaxy_test/selenium/test_custom_builds.py b/lib/galaxy_test/selenium/test_custom_builds.py index 25c40766f01..2e020f961d5 100644 --- a/lib/galaxy_test/selenium/test_custom_builds.py +++ b/lib/galaxy_test/selenium/test_custom_builds.py @@ -6,6 +6,12 @@ from .framework import ( class TestCustomBuilds(SharedStateSeleniumTestCase): + user_email: str + build_name1: str + build_name2: str + build_key1: str + build_key2: str + @selenium_test def test_build_add(self): self._login() diff --git a/lib/galaxy_test/selenium/test_library_contents.py b/lib/galaxy_test/selenium/test_library_contents.py index e03cef90c28..ed92184281f 100644 --- a/lib/galaxy_test/selenium/test_library_contents.py +++ b/lib/galaxy_test/selenium/test_library_contents.py @@ -30,6 +30,7 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions): long_description = self._get_random_name(prefix="new_sub_folder_description", len=45) # create mew folder + self.admin_login() self.navigate_to_new_library() self.assert_num_displayed_items_is(0) self.libraries_folder_create(sub_folder_name) @@ -63,7 +64,7 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions): self.admin_login() self.perform_upload(self.get_filename("1.txt")) self.wait_for_history() - self.navigate_to_new_library(login=False) + self.navigate_to_new_library() self.assert_num_displayed_items_is(0) self.sleep_for(self.wait_types.UX_RENDER) self.libraries_dataset_import(self.navigation.libraries.folder.labels.from_history) @@ -125,6 +126,7 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions): @requires_admin @requires_new_library def test_import_dataset_from_path(self): + self.admin_login() self.navigate_to_new_library() self.assert_num_displayed_items_is(0) self.sleep_for(self.wait_types.UX_RENDER) @@ -162,6 +164,7 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions): @requires_admin @requires_new_library def test_import_dataset_from_import_dir(self): + self.admin_login() self.navigate_to_new_library() self.assert_num_displayed_items_is(0) filenames = ["1.axt", "1.bed", "1.bam"] @@ -172,6 +175,7 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions): @requires_admin @requires_new_library def test_show_details(self): + self.admin_login() self.navigate_to_new_library() self.sleep_for(self.wait_types.UX_RENDER) self.components.libraries.folder.open_location_details_btn.wait_for_and_click() diff --git a/lib/galaxy_test/selenium/test_library_to_collections.py b/lib/galaxy_test/selenium/test_library_to_collections.py index a19506cb76b..2b2359c3088 100644 --- a/lib/galaxy_test/selenium/test_library_to_collections.py +++ b/lib/galaxy_test/selenium/test_library_to_collections.py @@ -33,6 +33,7 @@ class TestLibraryToCollections(SeleniumTestCase, UsesLibraryAssertions): self.list_of_pairs_export() def prepare_library_for_data_export(self, files_to_import, history_name=None): + self.admin_login() self.create_new_library() self.home() self.history_panel_create_new() diff --git a/mypy.ini b/mypy.ini index 7a4e6b12d41..591927279fe 100644 --- a/mypy.ini +++ b/mypy.ini @@ -261,8 +261,6 @@ check_untyped_defs = False check_untyped_defs = False [mypy-galaxy.tool_shed.tools.data_table_manager] check_untyped_defs = False -[mypy-galaxy.selenium.navigates_galaxy] -check_untyped_defs = False [mypy-galaxy.objectstore.s3_multipart_upload] check_untyped_defs = False [mypy-galaxy.model.database_utils] @@ -613,8 +611,6 @@ check_untyped_defs = False check_untyped_defs = False [mypy-galaxy_test.selenium.test_histories_list] check_untyped_defs = False -[mypy-galaxy_test.selenium.test_custom_builds] -check_untyped_defs = False [mypy-galaxy_test.api.test_history_contents] check_untyped_defs = False [mypy-galaxy_test.api.test_histories] diff --git a/test/integration_selenium/test_user_library_permissions.py b/test/integration_selenium/test_user_library_permissions.py index e17f7b616bb..c1d225421fa 100644 --- a/test/integration_selenium/test_user_library_permissions.py +++ b/test/integration_selenium/test_user_library_permissions.py @@ -84,6 +84,7 @@ class TestUserLibraryImport(SeleniumIntegrationTestCase): def create_lib_and_permit_adding(self, email): # logout of the current user, only admin can create new libraries self.logout() + self.admin_login() self.create_new_library() self.libraries_index_search_for(self.name) # open permission manage dialog