def open(self, driver): # type: (EyesWebDriver) -> EyesWebDriver self._test_uuid = uuid.uuid4() if self.configuration.is_disabled: return driver logger.open_() argument_guard.not_none(driver) logger.debug("VisualGridEyes.open(%s)" % self.configuration) self._driver = driver browsers_info = self.configuration.browsers_info if self.configuration.viewport_size: self._set_viewport_size(self.configuration.viewport_size) elif browsers_info: viewports = [bi.viewport_size for bi in browsers_info] if viewports: self.configuration.viewport_size = viewports[0] else: self.configuration.viewport_size = self._get_viewport_size() for b_info in browsers_info: test = RunningTest(self._create_vgeyes_connector(b_info), self.configuration, b_info) test.on_results_received( lambda r: self.vg_manager.aggregate_result(test, r)) test.test_uuid = self._test_uuid self.test_list.append(test) self._is_opened = True self.vg_manager.open(self) logger.info("VisualGridEyes opening {} tests...".format( len(self.test_list))) return driver
def _open_base(self): if self.configure.is_disabled: logger.debug("open_base(): ignored (disabled)") return logger.open_() self._log_open_base() retry = 0 while retry < self._MAX_ITERATIONS: try: self._validate_session_open() self._init_providers() self._is_viewport_size_set = False self._before_open() try: if self.configure.viewport_size: self._ensure_running_session() except Exception as e: logger.exception(e) retry += 1 continue self._is_opened = True self._after_open() return None except EyesError as e: logger.exception(e) logger.close() raise e raise EyesError("eyes.open_base() failed")
def manage_logging(enable_eyes_log=None, enable_http_debug_log=None): if enable_eyes_log is True: logger.set_logger(StdoutLogger()) logger.open_() elif enable_eyes_log is False: logger.close() logger.set_logger(None) if enable_http_debug_log is True: six.moves.http_client.HTTPConnection.debuglevel = 1 elif enable_http_debug_log is False: six.moves.http_client.HTTPConnection.debuglevel = 0
def open_base( self, app_name, # type: Text test_name, # type: Text viewport_size=None, # type: Optional[ViewPort] session_type=SessionType.SEQUENTIAL, # type: SessionType ): # type: (...) -> None """ Starts a test. :param app_name: The name of the application under test. :param test_name: The test name. :param viewport_size: The client's viewport size (i.e., the visible part of the document's body) or None to allow any viewport size. :param session_type: The type of test (e.g., Progression for timing tests) or Sequential by default. :return: An updated web driver :raise EyesError: If the session was already open. """ logger.open_() if self.configuration.is_disabled: logger.debug("open_base(): ignored (disabled)") return if self._server_connector is None: raise EyesError("Server connector not set.") # If there's no default application name, one must be provided for the current test. if self.configuration.app_name is None: argument_guard.not_none(app_name) self.configuration.app_name = app_name argument_guard.not_none(test_name) self.configuration.test_name = test_name logger.info("\nAgent: {}\n".format(self.full_agent_id)) logger.info( "open_base(%s, %s, %s, %s)" % (app_name, test_name, viewport_size, self.configuration.failure_reports) ) self.configuration.session_type = session_type self.configuration.viewport_size = viewport_size self._open_base()
def open(self, driver): # type: (EyesWebDriver) -> EyesWebDriver self._test_uuid = uuid.uuid4() logger.open_() argument_guard.not_none(driver) logger.debug("VisualGridEyes.open(%s)" % self.configure) self._driver = driver self._set_viewport_size() for b_info in self.configure.browsers_info: test = RunningTest(self._create_vgeyes_connector(b_info), self.configure, b_info) test.on_results_received(self.vg_manager.aggregate_result) test.test_uuid = self._test_uuid self.test_list.append(test) self._is_opened = True self.vg_manager.open(self) logger.info("VisualGridEyes opening {} tests...".format( len(self.test_list))) return driver
def __init__(self): logger.open_()
def __init__(self): logger.open_() self._batch_server_connectors = {}