def configure(self, tc_config_files, is_selenium_test=True, behave_properties=None): """Configure initial selenium instance using logging and properties files for Selenium or Appium tests :param tc_config_files: test case specific config files :param is_selenium_test: true if test is a selenium or appium test case :param behave_properties: dict with behave user data properties """ # Configure config and output directories DriverWrappersPool.configure_common_directories(tc_config_files) # Configure logger self.configure_logger(tc_config_files.config_log_filename, tc_config_files.output_log_filename) # Initialize the config object self.configure_properties(tc_config_files.config_properties_filenames, behave_properties) # Configure visual directories if is_selenium_test: driver_info = self.config.get('Driver', 'type') DriverWrappersPool.configure_visual_directories(driver_info) self.configure_visual_baseline()
def driver_wrapper(): """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 driver_wrapper = DriverWrappersPool.get_default_wrapper() # Configure wrapper root_path = os.path.dirname(os.path.realpath(__file__)) config_files = ConfigFiles() config_files.set_config_directory(os.path.join(root_path, 'conf')) config_files.set_output_directory(os.path.join(root_path, 'output')) config_files.set_config_log_filename('logging.conf') DriverWrappersPool.configure_common_directories(config_files) driver_wrapper.configure_properties() driver_wrapper.driver = mock.MagicMock() driver_wrapper.is_mobile_test = mock.MagicMock(return_value=False) return driver_wrapper
def setUp(self): 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)
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()
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()
def driver_wrapper(): # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None # Create a new wrapper new_driver_wrapper = DriverWrappersPool.get_default_wrapper() # Configure wrapper config_files = ConfigFiles() config_files.set_config_directory(os.path.join(root_path, 'conf')) config_files.set_output_directory(os.path.join(root_path, 'output')) config_files.set_config_log_filename('logging.conf') DriverWrappersPool.configure_common_directories(config_files) new_driver_wrapper.configure_properties() return new_driver_wrapper
def driver_wrapper(): # Create a new wrapper new_driver_wrapper = DriverWrappersPool.get_default_wrapper() # Configure wrapper 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')) DriverWrappersPool.configure_common_directories(config_files) yield new_driver_wrapper # Remove environment properties after test try: del os.environ["Config_log_filename"] except KeyError: pass
def driver_wrapper(): # Reset wrappers pool values DriverWrappersPool._empty_pool() DriverWrapper.config_properties_filenames = None # Create a new wrapper new_driver_wrapper = DriverWrappersPool.get_default_wrapper() # Configure wrapper 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')) config_files.set_config_log_filename('logging.conf') DriverWrappersPool.configure_common_directories(config_files) new_driver_wrapper.configure() return new_driver_wrapper
def configure(self, is_selenium_test=True, tc_config_files=ConfigFiles()): """Configure initial selenium instance using logging and properties files for Selenium or Appium tests :param is_selenium_test: true if test is a selenium or appium test case :param tc_config_files: test case specific config files """ # Configure config and output directories DriverWrappersPool.configure_common_directories(tc_config_files) # Configure logger self.configure_logger(tc_config_files.config_log_filename, tc_config_files.output_log_filename) # Initialize the config object self.configure_properties(tc_config_files.config_properties_filenames) # Configure visual directories if is_selenium_test: driver_info = self.config.get('Driver', 'type').replace('-', '_') DriverWrappersPool.configure_visual_directories(driver_info) self.configure_visual_baseline()
def setUp(self): 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)