本文整理汇总了Python中toolium.driver_wrappers_pool.DriverWrappersPool.get_default_wrapper方法的典型用法代码示例。如果您正苦于以下问题:Python DriverWrappersPool.get_default_wrapper方法的具体用法?Python DriverWrappersPool.get_default_wrapper怎么用?Python DriverWrappersPool.get_default_wrapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toolium.driver_wrappers_pool.DriverWrappersPool
的用法示例。
在下文中一共展示了DriverWrappersPool.get_default_wrapper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def setUp(self):
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
if not self.driver_wrapper.driver and not self.config_files.config_directory:
# By default config directory is located in test path
self.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())
super(AppiumTestCase, self).setUp()
AppiumTestCase.app_strings = self.driver_wrapper.app_strings
示例2: __init__
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def __init__(self, driver_wrapper=None):
"""Initialize Utils instance
:param driver_wrapper: driver wrapper instance
"""
self.driver_wrapper = driver_wrapper if driver_wrapper else DriverWrappersPool.get_default_wrapper()
# Configure logger
self.logger = logging.getLogger(__name__)
示例3: setUp
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def setUp(self):
# Configure logger and properties
if not isinstance(self, SeleniumTestCase):
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
self.driver_wrapper.configure(False, self.config_files)
# Get config and logger instances
self.config = self.driver_wrapper.config
self.logger = logging.getLogger(__name__)
self.logger.info("Running new test: {0}".format(self.get_subclassmethod_name()))
示例4: driver_wrapper
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def driver_wrapper():
# Configure properties
config_files = ConfigFiles()
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
config_files.set_config_directory(os.path.join(root_path, 'conf'))
config_files.set_config_properties_filenames('properties.cfg')
driver_wrapper = DriverWrappersPool.get_default_wrapper()
driver_wrapper.configure(config_files)
return driver_wrapper
示例5: driver_wrapper
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def driver_wrapper():
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
driver_wrapper = DriverWrappersPool.get_default_wrapper()
driver_wrapper.driver = mock.MagicMock()
return driver_wrapper
示例6: setUp
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def setUp(self):
"""Create a new mock element and a new driver before each test"""
global mock_element
mock_element = mock.MagicMock(spec=WebElement)
mock_element.find_element.return_value = child_element
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
self.driver_wrapper.driver = mock.MagicMock()
示例7: setUp
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def setUp(self):
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
# Create default wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
# Configure properties
config_files = ConfigFiles()
root_path = os.path.dirname(os.path.realpath(__file__))
config_files.set_config_directory(os.path.join(root_path, 'conf'))
config_files.set_output_directory(os.path.join(root_path, 'output'))
self.driver_wrapper.configure(tc_config_files=config_files)
示例8: test_singleton
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def test_singleton(self):
# Request default wrapper
new_wrapper = DriverWrappersPool.get_default_wrapper()
# Modify new wrapper
new_driver_type = 'opera'
new_wrapper.config.set('Driver', 'type', new_driver_type)
# Check that both wrappers are the same object
assert_equal(new_driver_type, self.driver_wrapper.config.get('Driver', 'type'))
assert_equal(new_driver_type, new_wrapper.config.get('Driver', 'type'))
assert_equal(self.driver_wrapper, new_wrapper)
assert_equal(DriverWrappersPool.driver_wrappers[0], self.driver_wrapper)
示例9: setUp
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def setUp(self):
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
config_files = ConfigFiles()
config_files.set_config_directory(os.path.join(self.root_path, 'conf'))
config_files.set_output_directory(os.path.join(self.root_path, 'output'))
DriverWrappersPool.configure_common_directories(config_files)
self.driver_wrapper.configure_properties()
示例10: save_jira_conf
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def save_jira_conf():
"""Read Jira configuration from properties file and save it"""
global enabled, execution_url, summary_prefix, labels, comments, fix_version, build, only_if_changes, attachments
config = DriverWrappersPool.get_default_wrapper().config
enabled = config.getboolean_optional('Jira', 'enabled')
execution_url = config.get_optional('Jira', 'execution_url')
summary_prefix = config.get_optional('Jira', 'summary_prefix')
labels = config.get_optional('Jira', 'labels')
comments = config.get_optional('Jira', 'comments')
fix_version = config.get_optional('Jira', 'fixversion')
build = config.get_optional('Jira', 'build')
only_if_changes = config.getboolean_optional('Jira', 'onlyifchanges')
attachments = []
示例11: test_singleton
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def test_singleton(driver_wrapper):
# Request default wrapper
new_wrapper = DriverWrappersPool.get_default_wrapper()
# Modify new wrapper
new_driver_type = 'opera'
new_wrapper.config.set('Driver', 'type', new_driver_type)
# Check that both wrappers are the same object
assert new_driver_type == driver_wrapper.config.get('Driver', 'type')
assert new_driver_type == new_wrapper.config.get('Driver', 'type')
assert driver_wrapper == new_wrapper
assert DriverWrappersPool.driver_wrappers[0] == driver_wrapper
示例12: __init__
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def __init__(self, driver_wrapper=None, force=False):
self.driver_wrapper = driver_wrapper if driver_wrapper else DriverWrappersPool.get_default_wrapper()
self.force = force
if not self.driver_wrapper.config.getboolean_optional('VisualTests', 'enabled') and not self.force:
return
if 'PerceptualEngine' not in globals():
raise Exception('The visual tests are enabled, but needle is not installed')
self.utils = self.driver_wrapper.utils
self.logger = logging.getLogger(__name__)
self.output_directory = DriverWrappersPool.visual_output_directory
# Update baseline with real platformVersion value
if '{platformVersion}' in self.driver_wrapper.baseline_name:
platform_version = self.driver_wrapper.driver.desired_capabilities['platformVersion']
baseline_name = self.driver_wrapper.baseline_name.replace('{platformVersion}', platform_version)
self.driver_wrapper.baseline_name = baseline_name
self.driver_wrapper.visual_baseline_directory = os.path.join(DriverWrappersPool.visual_baseline_directory,
baseline_name)
self.baseline_directory = self.driver_wrapper.visual_baseline_directory
engine_type = self.driver_wrapper.config.get_optional('VisualTests', 'engine', 'pil')
if engine_type == 'perceptualdiff':
self.engine = PerceptualEngine()
elif engine_type == 'imagemagick':
if 'MagickEngine' not in globals():
self.logger.warn("Engine '{}' not found, using pil instead. It should be installed "
"the master version of needle, not the 0.3.".format(engine_type))
self.engine = PilEngine()
else:
self.engine = MagickEngine()
elif engine_type == 'pil':
self.engine = PilEngine()
else:
self.logger.warn(
"Engine '{}' not found, using pil instead. Review your properties.cfg file.".format(engine_type))
self.engine = PilEngine()
self.save_baseline = self.driver_wrapper.config.getboolean_optional('VisualTests', 'save')
# Create folders
if not os.path.exists(self.baseline_directory):
os.makedirs(self.baseline_directory)
if not os.path.exists(self.output_directory):
os.makedirs(self.output_directory)
# Copy html template to output directory
orig_template_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'resources', self.template_name)
dst_template_path = os.path.join(self.output_directory, self.report_name)
if not os.path.exists(dst_template_path):
shutil.copyfile(orig_template_path, dst_template_path)
self._add_summary_to_report()
示例13: __init__
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def __init__(self):
if not DriverWrappersPool.is_empty():
# Copy config object and other properties from default driver
default_wrapper = DriverWrappersPool.get_default_wrapper()
self.config = default_wrapper.config.deepcopy()
self.logger = default_wrapper.logger
self.config_properties_filenames = default_wrapper.config_properties_filenames
self.config_log_filename = default_wrapper.config_log_filename
self.output_log_filename = default_wrapper.output_log_filename
self.visual_baseline_directory = default_wrapper.visual_baseline_directory
self.baseline_name = default_wrapper.baseline_name
# Create utils instance and add wrapper to the pool
self.utils = Utils(self)
DriverWrappersPool.add_wrapper(self)
示例14: test_jira_disabled
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def test_jira_disabled(self):
# Configure jira module
config = DriverWrappersPool.get_default_wrapper().config
try:
config.add_section('Jira')
except Exception:
pass
config.set('Jira', 'enabled', 'false')
# Execute method with jira annotation
MockTestClass().mock_test_pass()
# Check jira status
expected_status = {}
assert_equal(expected_status, jira.jira_tests_status)
示例15: test_jira_annotation_fail
# 需要导入模块: from toolium.driver_wrappers_pool import DriverWrappersPool [as 别名]
# 或者: from toolium.driver_wrappers_pool.DriverWrappersPool import get_default_wrapper [as 别名]
def test_jira_annotation_fail(self):
# Configure jira module
config = DriverWrappersPool.get_default_wrapper().config
try:
config.add_section('Jira')
except Exception:
pass
config.set('Jira', 'enabled', 'true')
# Execute method with jira annotation
assert_raises(AssertionError, MockTestClass().mock_test_fail)
# Check jira status
expected_status = {'TOOLIUM-3': ('TOOLIUM-3', 'Fail', "The test 'test name' has failed: test error", [])}
assert_equal(expected_status, jira.jira_tests_status)