Example #1
0
    def _display_connection_info(self):
        """
        Log information for how to connect to the interactive runner.
        Currently only the API is implemented so we log how to access the
        API schema. In future we will log how to access the UI page.
        """
        host, port = self.http_handler_info

        self.logger.debug(
            "\nInteractive Testplan API is running. View the API schema:\n%s",
            networking.format_access_urls(host, port, "/api/v1/interactive/"),
        )
        self.logger.critical(
            "\nInteractive Testplan web UI is running. Access it at:\n%s",
            networking.format_access_urls(host, port, "/interactive/"),
        )
Example #2
0
    def display(self, json_path):
        """Display a generated JSON in the web UI"""
        # Start the web server.

        data_path = os.path.dirname(json_path)
        report_name = os.path.basename(json_path)

        self._web_server_thread = web_app.WebServer(port=self.cfg.ui_port,
                                                    data_path=data_path,
                                                    report_name=report_name)

        self._web_server_thread.start()
        wait(
            self._web_server_thread.ready,
            self.cfg.web_server_startup_timeout,
            raise_on_timeout=True,
        )

        (host, port) = self._web_server_thread.server.bind_addr
        self._report_url = "http://localhost:{}/testplan/local".format(port)

        self.logger.exporter_info(
            "View the JSON report in the browser:\n%s",
            networking.format_access_urls(host, port, "/testplan/local"),
        )
Example #3
0
    def _display_connection_info(self):
        """
        Log information for how to connect to the interactive runner.
        Currently only the API is implemented so we log how to access the
        API schema. In future we will log how to access the UI page.
        """
        host, port = self.http_handler_info
        if host is None or port is None:
            raise RuntimeError(
                "Interactive Testplan web service is not available")

        self.logger.info(
            "\nInteractive Testplan API is running. View the API schema:\n%s",
            networking.format_access_urls(host, port, "/api/v1/interactive/"),
        )
        self.logger.critical(
            "\nInteractive Testplan web UI is running. Access it at:\n%s",
            networking.format_access_urls(host, port, "/interactive/"),
        )
Example #4
0
    def _display_connection_info(self):
        """
        Log information for how to connect to the interactive runner.
        Currently only the API is implemented so we log how to access the
        API schema. In future we will log how to access the UI page.
        """
        host, port = self._http_handler.host, self._http_handler.port

        self.logger.warning(
            'Interactive web viewer is not yet implemented. Interactive mode '
            'currently only allows control of a Testplan via its HTTP API.')

        self.logger.test_info(
            'Interactive Testplan API is running. View the API schema:\n%s',
            networking.format_access_urls(host, port, "/api/v1/interactive/"),
        )
Example #5
0
    def display(self):
        """Start a web server locally for JSON report."""
        if self._web_server_thread and self._web_server_thread.ready:
            TESTPLAN_LOGGER.test_info(
                "The JSON report is already served at: %s", self._report_url)
            return

        if not self.ui_installed:
            TESTPLAN_LOGGER.warning(
                "Cannot display web UI for report locally since"
                " the Testplan UI is not installed.\n"
                "Install the UI by running `install-testplan-ui`")
            self._report_url = None
            return

        data_path = os.path.dirname(self._json_path)
        report_name = os.path.basename(self._json_path)

        self._web_server_thread = WebServer(port=self._ui_port,
                                            data_path=data_path,
                                            report_name=report_name)

        self._web_server_thread.start()
        wait(
            self._web_server_thread.ready,
            self._web_server_startup_timeout,
            raise_on_timeout=True,
        )

        (host, port) = self._web_server_thread.server.bind_addr
        self._report_url = f"http://localhost:{port}/testplan/local"

        TESTPLAN_LOGGER.test_info(
            "View the JSON report in the browser:\n%s",
            format_access_urls(host, port, "/testplan/local"),
        )