How to use set_config_directory method in toolium

Best Python code snippet using toolium_python

test_cases.py

Source:test_cases.py Github

copy

Full Screen

...30 # Configure logger and properties31 if not isinstance(self, SeleniumTestCase):32 # By default config directory is located in test path33 if not self.config_files.config_directory:34 self.config_files.set_config_directory(DriverManager.get_default_config_directory())35 self.driver_wrapper = DriverManager.get_default_wrapper()36 self.config_files = DriverManager.initialize_config_files(self.config_files)37 self.driver_wrapper.configure(self.config_files, is_selenium_test=False)38 # Get config and logger instances39 self.config = self.driver_wrapper.config40 self.logger = logging.getLogger(__name__)41 self.logger.info("Running new test: %s", self.get_subclassmethod_name())42 def tearDown(self):43 py2_exception = sys.exc_info()[1]44 try:45 # Python 3.4+46 exception_info = self._outcome.errors[-1][1] if len(self._outcome.errors) > 0 else None47 exception = exception_info[1] if exception_info else None48 except AttributeError:49 try:50 # Python 3.351 exceptions_list = self._outcomeForDoCleanups.failures + self._outcomeForDoCleanups.errors52 exception = exceptions_list[0][1] if exceptions_list else None53 except AttributeError:54 # Python 2.755 exception = py2_exception56 if not exception:57 self._test_passed = True58 self.logger.info("The test '%s' has passed", self.get_subclassmethod_name())59 else:60 self._test_passed = False61 error_message = get_message_exception(exception)62 self.logger.error("The test '%s' has failed: %s", self.get_subclassmethod_name(), error_message)63class SeleniumTestCase(BasicTestCase):64 driver = None65 utils = None66 @classmethod67 def tearDownClass(cls):68 super(SeleniumTestCase, cls).tearDownClass()69 DriverManager.close_drivers(scope='class', test_name=cls.get_subclass_name())70 def setUp(self):71 if not self.config_files.config_directory:72 self.config_files.set_config_directory(DriverManager.get_default_config_directory())73 self.driver_wrapper = DriverManager.connect_default_driver_wrapper(config_files=self.config_files)74 SeleniumTestCase.driver = self.driver_wrapper.driver75 self.utils = self.driver_wrapper.utils76 file_suffix = self.get_method_name()77 def assert_screenshot_page_element(self, filename, threshold=0, exclude_elements=None, force=False):78 if exclude_elements is None:79 exclude_elements = []80 VisualTest(self.driver_wrapper, force).assert_screenshot(self.web_element, filename, file_suffix,81 threshold, exclude_elements)82 PageElement.assert_screenshot = assert_screenshot_page_element83 # Call BasicTestCase setUp84 super(SeleniumTestCase, self).setUp()85 def tearDown(self):86 # Call BasicTestCase tearDown87 super(SeleniumTestCase, self).tearDown()88 # Close drivers89 DriverManager.close_drivers(scope='function', test_name=self.get_subclassmethod_name(),90 test_passed=self._test_passed)91 def assert_screenshot(self, element, filename, threshold=0, exclude_elements=None, driver_wrapper=None,92 force=False):93 if exclude_elements is None:94 exclude_elements = []95 file_suffix = self.get_method_name()96 VisualTest(driver_wrapper, force).assert_screenshot(element, filename, file_suffix, threshold, exclude_elements)97 def assert_full_screenshot(self, filename, threshold=0, exclude_elements=None, driver_wrapper=None, force=False):98 if exclude_elements is None:99 exclude_elements = []100 file_suffix = self.get_method_name()101 VisualTest(driver_wrapper, force).assert_screenshot(None, filename, file_suffix, threshold, exclude_elements)102class AppiumTestCase(SeleniumTestCase):103 app_strings = None104 @property105 def driver(self):106 return SeleniumTestCase.driver107 def setUp(self):108 self.driver_wrapper = DriverManager.get_default_wrapper()109 if not self.driver_wrapper.driver and not self.config_files.config_directory:110 # By default config directory is located in test path111 self.config_files.set_config_directory(DriverManager.get_default_config_directory())112 super(AppiumTestCase, self).setUp()...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

1import modularconfig.loaders2from modularconfig.config_manager import \3 get, \4 set_config_directory, using_config_directory, get_config_directory, \5 ensure...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run toolium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful