def prepare(self): self.result['set_name'] = _get_set_name(self.test_data) # initialize logger self.logger = test_logger.get_logger(self.report_directory, self.settings['cli_log_level'], self.settings['log_all_events']) # set execution module values self._set_execution_module_values() self._print_test_info() # add the 'project' directory to python path # to enable relative imports from the test # TODO sys.path.append( os.path.join(self.testdir, 'projects', self.project.path)) self.import_modules()
def interactive(settings, cli_browsers): """Starts the Golem interactive shell.""" browsers = utils.choose_browser_by_precedence( cli_browsers=cli_browsers, suite_browsers=[], settings_default_browser=settings['default_browser']) execution.browser_name = browsers[0] remote_browsers = settings_manager.get_remote_browsers(session.settings) default_browsers = gui_utils.get_supported_browsers_suggestions() browser_defs = define_browsers(browsers, remote_browsers, default_browsers) execution.browser_definition = browser_defs[0] execution.settings = settings execution.settings['interactive'] = True execution.logger = test_logger.get_logger( cli_log_level=execution.settings['cli_log_level'], log_all_events=execution.settings['log_all_events']) actions.interactive_mode()
def prepare(self): # Create report directory for the test file self.reportdir = test_report.create_test_file_report_dir( self.exec_report_dir, self.test.name, self.set_name) # Initialize logger for the test file self.logger = test_logger.get_logger(self.reportdir, self.settings['cli_log_level'], self.settings['log_all_events']) # set execution module values self._set_execution_module_values() self._print_test_info() # add the 'project' directory to python path # to enable relative imports from the test # TODO sys.path.append(os.path.join(self.testdir, 'projects', self.project.path)) self.import_test()
def test_driver_path_is_not_defined(self): execution.settings = settings_manager.assign_settings_default_values( {}) execution.logger = test_logger.get_logger() default_browsers = gui_utils.get_supported_browsers_suggestions() drivers = [ ('chromedriver_path', 'chrome'), ('chromedriver_path', 'chrome-headless'), ('edgedriver_path', 'edge'), ('geckodriver_path', 'firefox'), ('iedriver_path', 'ie'), ('operadriver_path', 'opera'), ] for setting_path, browser_name in drivers: execution.browser_definition = execution_runner.define_browsers( [browser_name], [], default_browsers, [])[0] with pytest.raises(Exception) as excinfo: browser.open_browser() expected = 'Exception: {setting_path} setting is not defined' assert expected in str(excinfo.value)
def test_executable_not_present(self): execution.settings = settings_manager.assign_settings_default_values( {}) execution.logger = test_logger.get_logger() default_browsers = gui_utils.get_supported_browsers_suggestions() drivers = [ ('chromedriver_path', './drivers/chromedriver*', 'chrome'), ('chromedriver_path', './drivers/chromedriver*', 'chrome-headless'), ('edgedriver_path', './drivers/edgedriver*', 'edge'), ('geckodriver_path', './drivers/geckodriver*', 'firefox'), ('iedriver_path', './drivers/iedriver*', 'ie'), ('operadriver_path', './drivers/operadriver*', 'opera'), ] for setting_key, setting_path, browser_name in drivers: execution.browser_definition = execution_runner.define_browsers( [browser_name], [], default_browsers, [])[0] execution.settings[setting_key] = setting_path with pytest.raises(Exception) as excinfo: browser.open_browser() expected = f'No executable file found using path {setting_path}' assert expected in str(excinfo.value)