Esempio n. 1
0
    def set_virtual_display(self):
        if is_windows():
            self.log.warning(
                "Cannot have virtual display on Windows, ignoring")
            return

        if self.engine in VirtualDisplay.SHARED_VIRTUAL_DISPLAY:
            self.virtual_display = VirtualDisplay.SHARED_VIRTUAL_DISPLAY[
                self.engine]
        else:
            width = self.parameters.get("width", 1024)
            height = self.parameters.get("height", 768)
            self.virtual_display = Display(size=(width, height))
            msg = "Starting virtual display[%s]: %s"
            self.log.info(msg, self.virtual_display.size,
                          self.virtual_display.new_display_var)
            self.virtual_display.start()

            # roll DISPLAY back for online report browser
            if self.virtual_display.old_display_var:
                os.environ["DISPLAY"] = self.virtual_display.old_display_var
            else:
                del os.environ["DISPLAY"]

            VirtualDisplay.SHARED_VIRTUAL_DISPLAY[
                self.engine] = self.virtual_display
            self.engine.shared_env.set(
                {"DISPLAY": self.virtual_display.new_display_var})
Esempio n. 2
0
 def set_virtual_display(self):
     if is_windows():
         self.log.warning("Cannot have virtual display on Windows, ignoring")
     else:
         if self.engine in VirtualDisplay.SHARED_VIRTUAL_DISPLAY:
             self.virtual_display = VirtualDisplay.SHARED_VIRTUAL_DISPLAY[self.engine]
         else:
             width = self.parameters.get("width", 1024)
             height = self.parameters.get("height", 768)
             self.virtual_display = Display(size=(width, height))
             msg = "Starting virtual display[%s]: %s"
             self.log.info(msg, self.virtual_display.size, self.virtual_display.new_display_var)
             self.virtual_display.start()
             VirtualDisplay.SHARED_VIRTUAL_DISPLAY[self.engine] = self.virtual_display
Esempio n. 3
0
 def set_virtual_display(self):
     display_conf = self.settings.get("virtual-display")
     if display_conf:
         if is_windows():
             self.log.warning("Cannot have virtual display on Windows, ignoring")
         else:
             if self.engine in SeleniumExecutor.SHARED_VIRTUAL_DISPLAY:
                 self.virtual_display = SeleniumExecutor.SHARED_VIRTUAL_DISPLAY[self.engine]
             else:
                 width = display_conf.get("width", 1024)
                 height = display_conf.get("height", 768)
                 self.virtual_display = Display(size=(width, height))
                 msg = "Starting virtual display[%s]: %s"
                 self.log.info(msg, self.virtual_display.size, self.virtual_display.new_display_var)
                 self.virtual_display.start()
                 SeleniumExecutor.SHARED_VIRTUAL_DISPLAY[self.engine] = self.virtual_display
Esempio n. 4
0
    def set_virtual_display(self):
        if is_windows():
            self.log.warning("Cannot have virtual display on Windows, ignoring")
            return

        if VirtualDisplay.SHARED_VIRTUAL_DISPLAY:
            self.virtual_display = VirtualDisplay.SHARED_VIRTUAL_DISPLAY
        else:
            width = self.parameters.get("width", 1024)
            height = self.parameters.get("height", 768)
            self.virtual_display = Display(size=(width, height))
            msg = "Starting virtual display[%s]: %s"
            self.log.info(msg, self.virtual_display.size, self.virtual_display.new_display_var)
            self.virtual_display.start()
            VirtualDisplay.SHARED_VIRTUAL_DISPLAY = self.virtual_display

            self.engine.shared_env.set({'DISPLAY': os.environ['DISPLAY']})   # backward compatibility
Esempio n. 5
0
    def prepare(self):
        display_conf = self.settings.get("virtual-display")
        if display_conf:
            if is_windows():
                self.log.warning("Cannot have virtual display on Windows, ignoring")
            else:
                width = display_conf.get("width", 1024)
                height = display_conf.get("height", 768)
                self.virtual_display = Display(size=(width, height))

        self.scenario = self.get_scenario()
        self._verify_script()
        self.kpi_file = self.engine.create_artifact("selenium_tests_report", ".csv")
        self.err_jtl = self.engine.create_artifact("selenium_tests_err", ".xml")
        script_type = self.detect_script_type(self.scenario.get(Scenario.SCRIPT))

        if script_type == ".py":
            runner_class = NoseTester
            runner_config = self.settings.get("selenium-tools").get("nose")
        elif script_type == ".jar" or script_type == ".java":
            runner_class = JUnitTester
            runner_config = self.settings.get("selenium-tools").get("junit")
            runner_config['props-file'] = self.engine.create_artifact("customrunner", ".properties")
        else:
            raise ValueError("Unsupported script type: %s" % script_type)

        runner_config["script-type"] = script_type
        self.runner_working_dir = self.engine.create_artifact(runner_config.get("working-dir", "classes"), "")
        runner_config["working-dir"] = self.runner_working_dir
        runner_config.get("artifacts-dir", self.engine.artifacts_dir)
        runner_config.get("working-dir", self.runner_working_dir)
        runner_config.get("report-file", self.kpi_file)
        runner_config.get("err-file", self.err_jtl)
        runner_config.get("stdout", self.engine.create_artifact("junit", ".out"))
        runner_config.get("stderr", self.engine.create_artifact("junit", ".err"))

        self._cp_resource_files(self.runner_working_dir)

        self.runner = runner_class(runner_config, self.scenario, self.get_load(), self.log)
        self.runner.prepare()
        self.reader = JTLReader(self.kpi_file, self.log, self.err_jtl)
        if isinstance(self.engine.aggregator, ConsolidatingAggregator):
            self.engine.aggregator.add_underling(self.reader)