mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 10:24:38 +08:00
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:
@@ -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 {}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user