WIP: selenium test decorators...

This commit is contained in:
John Chilton
2022-11-26 11:31:13 -05:00
parent 018d066e36
commit 5fb47ac23f
8 changed files with 40 additions and 9 deletions
@@ -37,7 +37,6 @@ class TestFolderContentsApi(ApiTestCase):
ldda = self._create_content_in_folder_with_payload(self.root_folder_id, data)
self._assert_has_keys(ldda, "name", "id")
@requires_new_library
def test_create_hdca_with_ldda_message(self, history_id):
contents = ["dataset01", "dataset02"]
+8 -2
View File
@@ -44,6 +44,10 @@ from galaxy_test.base.api import (
UsesCeleryTasks,
)
from galaxy_test.base.api_util import get_admin_api_key
from galaxy_test.base.decorators import (
requires_new_history,
using_requirement,
)
from galaxy_test.base.env import (
DEFAULT_WEB_HOST,
get_ip_address,
@@ -106,6 +110,7 @@ def managed_history(f):
Cleanup the history after the job is complete as well unless
GALAXY_TEST_NO_CLEANUP is set in the environment.
"""
f = requires_new_history(f)
@wraps(f)
def func_wrapper(self, *args, **kwds):
@@ -247,7 +252,7 @@ class TestWithSeleniumMixin(GalaxyTestSeleniumContext, UsesApiTestCaseMixin, Use
# is required for the test to run properly. Override admin user
# login info with GALAXY_TEST_SELENIUM_ADMIN_USER_EMAIL /
# GALAXY_TEST_SELENIUM_ADMIN_USER_PASSWORD
requires_admin = False
run_as_admin = False
def _target_url_from_selenium(self):
# Deal with the case when Galaxy has a different URL when being accessed by Selenium
@@ -262,7 +267,7 @@ class TestWithSeleniumMixin(GalaxyTestSeleniumContext, UsesApiTestCaseMixin, Use
self.target_url_from_selenium = self._target_url_from_selenium()
self.snapshots = []
self.setup_driver_and_session()
if self.requires_admin and GALAXY_TEST_SELENIUM_ADMIN_USER_EMAIL == DEFAULT_ADMIN_USER:
if self.run_as_admin and GALAXY_TEST_SELENIUM_ADMIN_USER_EMAIL == DEFAULT_ADMIN_USER:
self._setup_interactor()
self._setup_user(GALAXY_TEST_SELENIUM_ADMIN_USER_EMAIL)
self._try_setup_with_driver()
@@ -391,6 +396,7 @@ class TestWithSeleniumMixin(GalaxyTestSeleniumContext, UsesApiTestCaseMixin, Use
self.components.history_panel.empty_message.wait_for_visible()
def admin_login(self):
using_requirement("admin")
self.home()
self.submit_login(GALAXY_TEST_SELENIUM_ADMIN_USER_EMAIL, GALAXY_TEST_SELENIUM_ADMIN_USER_PASSWORD)
with self.main_panel():
+9 -1
View File
@@ -1,3 +1,4 @@
from galaxy_test.base.decorators import requires_admin
from galaxy_test.base.populators import flakey
from .framework import (
selenium_test,
@@ -7,9 +8,10 @@ from .framework import (
class TestAdminApp(SeleniumTestCase):
requires_admin = True
run_as_admin = True
@selenium_test
@requires_admin
def test_html_allowlist(self):
admin_component = self.components.admin
self.admin_login()
@@ -38,6 +40,7 @@ class TestAdminApp(SeleniumTestCase):
@selenium_test
@flakey
@requires_admin
def test_admin_toolshed(self):
"""
This tests installing a repository, checking for upgrades, and uninstalling.
@@ -99,6 +102,7 @@ class TestAdminApp(SeleniumTestCase):
self.screenshot("admin_toolshed_repo_uninstalled")
@selenium_test
@requires_admin
def test_admin_dependencies_display(self):
admin_component = self.components.admin
self.admin_login()
@@ -120,6 +124,7 @@ class TestAdminApp(SeleniumTestCase):
self.screenshot("admin_dependencies_unused")
@selenium_test
@requires_admin
def test_admin_jobs_display(self):
admin_component = self.components.admin
self.admin_login()
@@ -147,6 +152,7 @@ class TestAdminApp(SeleniumTestCase):
assert lock_label.wait_for_text() == original_label
@selenium_test
@requires_admin
def test_admin_server_display(self):
admin_component = self.components.admin
self.admin_login()
@@ -174,6 +180,7 @@ class TestAdminApp(SeleniumTestCase):
self.screenshot("admin_local_data")
@selenium_test
@requires_admin
def test_admin_user_display(self):
admin_component = self.components.admin
self.admin_login()
@@ -201,6 +208,7 @@ class TestAdminApp(SeleniumTestCase):
self.screenshot("admin_roles")
@selenium_test
@requires_admin
def test_admin_data_manager(self):
admin_component = self.components.admin
self.admin_login()
@@ -1,5 +1,9 @@
import os
from galaxy_test.base.decorators import (
requires_admin,
requires_new_library,
)
from .framework import (
retry_during_transitions,
selenium_test,
@@ -10,9 +14,11 @@ from .framework import (
class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
requires_admin = True
run_as_admin = True
@selenium_test
@requires_admin
@requires_new_library
def test_sub_folder(self):
def change_description(description):
self.components.libraries.folder.edit_folder_btn.wait_for_and_click()
@@ -52,6 +58,8 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
assert shrinked_description == self.components.libraries.folder.description_field_shrinked.wait_for_text()
@selenium_test
@requires_admin
@requires_new_library
def test_import_dataset_from_history(self):
self.admin_login()
self.perform_upload(self.get_filename("1.txt"))
@@ -78,6 +86,8 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
self.assert_num_displayed_items_is(1)
@selenium_test
@requires_admin
@requires_new_library
def download_dataset_from_library(self):
self.test_import_dataset_from_history()
@@ -90,6 +100,8 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
assert expected_filename in folder_files
@selenium_test
@requires_admin
@requires_new_library
def test_delete_dataset(self):
self.test_import_dataset_from_history()
@@ -111,6 +123,8 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
# Galaxy must be running so that test-data/1.txt would work but it just doesn't
# for some reason. https://jenkins.galaxyproject.org/job/jmchilton-selenium/79/artifact/79-test-errors/test_import_dataset_from_path2017100413221507137721/
@selenium_test
@requires_admin
@requires_new_library
def test_import_dataset_from_path(self):
self.navigate_to_new_library()
self.assert_num_displayed_items_is(0)
@@ -146,6 +160,8 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
assert table_as_dict["Genome build"] == "?", table_as_dict
@selenium_test
@requires_admin
@requires_new_library
def test_import_dataset_from_import_dir(self):
self.navigate_to_new_library()
self.assert_num_displayed_items_is(0)
@@ -154,6 +170,8 @@ class TestLibraryContents(SeleniumTestCase, UsesLibraryAssertions):
self.assert_num_displayed_items_is(len(filenames))
@selenium_test
@requires_admin
@requires_new_library
def test_show_details(self):
self.navigate_to_new_library()
self.sleep_for(self.wait_types.UX_RENDER)
@@ -7,7 +7,7 @@ from .framework import (
class TestAdminDependencyContainers(SeleniumIntegrationTestCase):
requires_admin = True
run_as_admin = True
@selenium_test
def test_admin_containers_display(self):
@@ -14,7 +14,7 @@ class TestPosixFileSourceSeleniumIntegration(PosixFileSourceSetup, SeleniumInteg
dataset_populator: "SeleniumSessionDatasetPopulator"
# For simplicity, otherwise need to setup a different file_sources_config_file
requires_admin = True
run_as_admin = True
@selenium_test
def test_upload_from_posix(self):
@@ -8,7 +8,7 @@ from .framework import (
class TestUserLibraryImport(SeleniumIntegrationTestCase):
requires_admin = True
run_as_admin = True
ensure_registered = True
@classmethod
@@ -12,7 +12,7 @@ if TYPE_CHECKING:
class TestWorkflowEditorToolUpgradeWithToolShedTool(SeleniumIntegrationTestCase, UsesShed):
dataset_populator: "SeleniumSessionDatasetPopulator"
requires_admin = True
run_as_admin = True
@classmethod
def handle_galaxy_config_kwds(cls, config):