Setup a mechansim for using selenium populators outside testing contexts.

An extended version of the library functions in #10783 - to allow interacting with workflows, etc.. creating using the API from Selenium. Should make my test prototyping environment in #10784 a bit closer to test case enviornments and allow more rapid development of test cases.
This commit is contained in:
John Chilton
2021-01-16 20:12:52 -05:00
parent d8da53ef64
commit 106337e91d
2 changed files with 26 additions and 14 deletions
+6 -1
View File
@@ -1,4 +1,5 @@
from typing import Optional
from six.moves.urllib.parse import urljoin
from .driver_factory import ConfiguredDriver
@@ -35,7 +36,11 @@ class GalaxySeleniumContext(NavigatesGalaxy):
class GalaxySeleniumContextImpl(GalaxySeleniumContext):
"""Minimal, simplified GalaxySeleniumContext useful outside the context of test cases."""
"""Minimal, simplified GalaxySeleniumContext useful outside the context of test cases.
A variant of this concept that can also populate content via the API
to then interact with via the Selenium is :class:galaxy_test.selenium.framework:`GalaxySeleniumContextImpl`.
"""
def __init__(self, from_dict: Optional[dict] = None) -> None:
from_dict = from_dict or {}
+20 -13
View File
@@ -185,7 +185,26 @@ class TestSnapshot:
write_file_func("%s-stack.txt" % prefix, str(self.stack))
class TestWithSeleniumMixin(GalaxySeleniumContext, UsesApiTestCaseMixin):
class GalaxyTestSeleniumContext(GalaxySeleniumContext):
"""Extend GalaxySeleniumContext with Selenium-aware galaxy_test.base.populators."""
@property
def dataset_populator(self) -> populators.BaseDatasetPopulator:
"""A dataset populator connected to the Galaxy session described by Selenium context."""
return SeleniumSessionDatasetPopulator(self)
@property
def dataset_collection_populator(self) -> populators.BaseDatasetCollectionPopulator:
"""A dataset collection populator connected to the Galaxy session described by Selenium context."""
return SeleniumSessionDatasetCollectionPopulator(self)
@property
def workflow_populator(self) -> populators.BaseWorkflowPopulator:
"""A workflow populator connected to the Galaxy session described by Selenium context."""
return SeleniumSessionWorkflowPopulator(self)
class TestWithSeleniumMixin(GalaxyTestSeleniumContext, UsesApiTestCaseMixin):
# If run one-off via nosetests, the next line ensures test
# tools and datatypes are used instead of configured tools.
framework_tool_and_types = True
@@ -355,18 +374,6 @@ class TestWithSeleniumMixin(GalaxySeleniumContext, UsesApiTestCaseMixin):
with self.main_panel():
self.assert_no_error_message()
@property
def dataset_populator(self):
return SeleniumSessionDatasetPopulator(self)
@property
def dataset_collection_populator(self):
return SeleniumSessionDatasetCollectionPopulator(self)
@property
def workflow_populator(self):
return SeleniumSessionWorkflowPopulator(self)
def workflow_upload_yaml_with_random_name(self, content, **kwds):
workflow_populator = self.workflow_populator
name = self._get_random_name()