class SeleniumTestCase(BZTestCase):
    def setUp(self):
        super(SeleniumTestCase, self).setUp()
        engine_obj = EngineEmul()
        paths = [__dir__() + "/../../bzt/10-base.json", local_paths_config()]
        engine_obj.configure(
            paths
        )  # FIXME: avoid using whole engine in particular module test!
        self.obj = SeleniumExecutor()
        self.obj.settings = engine_obj.config.get("modules").get("selenium")
        self.obj.settings.merge(
            {"virtual-display": {
                "width": 1024,
                "height": 768
            }})
        engine_obj.create_artifacts_dir(paths)
        self.obj.engine = engine_obj

    def configure(self, config):
        self.obj.engine.config.merge(config)
        self.obj.execution = self.obj.engine.config.get('execution')
        if isinstance(self.obj.execution, list):
            self.obj.execution = self.obj.execution[0]

    def tearDown(self):
        self.obj.free_virtual_display()
class SeleniumTestCase(BZTestCase):
    def setUp(self):
        super(SeleniumTestCase, self).setUp()
        self.engine_obj = EngineEmul()
        self.paths = [__dir__() + "/../../bzt/10-base.json", local_paths_config()]
        self.engine_obj.configure(self.paths)  # FIXME: avoid using whole engine in particular module test!
        self.engine_obj.config.get("modules").get("selenium").merge({"virtual-display": {"width": 1024, "height": 768}})
        self.selenium_config = self.engine_obj.config["modules"]["selenium"]
        self.engine_obj.create_artifacts_dir(self.paths)
        self.obj = SeleniumExecutor()
        self.obj.engine = self.engine_obj
        self.obj.settings = self.selenium_config

    def tearDown(self):
        self.obj.free_virtual_display()
示例#3
0
class SeleniumTestCase(BZTestCase):
    def setUp(self):
        super(SeleniumTestCase, self).setUp()
        engine_obj = EngineEmul()
        paths = [
            __dir__() + "/../../bzt/resources/base-config.yml",
            local_paths_config()
        ]
        engine_obj.configure(
            paths
        )  # FIXME: avoid using whole engine in particular module test!
        self.obj = SeleniumExecutor()
        self.obj.settings = engine_obj.config.get("modules").get("selenium")
        self.obj.settings.merge(
            {"virtual-display": {
                "width": 1024,
                "height": 768
            }})
        engine_obj.create_artifacts_dir(paths)
        self.obj.engine = engine_obj

    def configure(self, config):
        self.obj.engine.config.merge(config)
        self.obj.execution = self.obj.engine.config.get('execution')
        if isinstance(self.obj.execution, list):
            self.obj.execution = self.obj.execution[0]

    def tearDown(self):
        exc, _, _ = sys.exc_info()
        if exc:
            try:
                stdout_path = os.path.join(self.obj.engine.artifacts_dir,
                                           "selenium.out")
                if os.path.exists(stdout_path):
                    stdout = open(stdout_path).read()
                    logging.info('Selenium stdout: """\n%s\n"""', stdout)
            except BaseException:
                pass
            try:
                stdout_path = os.path.join(self.obj.engine.artifacts_dir,
                                           "selenium.err")
                if os.path.exists(stdout_path):
                    stderr = open(stdout_path).read()
                    logging.info('Selenium stderr: """\n%s\n"""', stderr)
            except BaseException:
                pass
        if isinstance(self.obj, SeleniumExecutor):
            self.obj.free_virtual_display()
示例#4
0
class SeleniumTestCase(BZTestCase):
    def setUp(self):
        super(SeleniumTestCase, self).setUp()
        self.engine_obj = EngineEmul()
        self.paths = [
            __dir__() + "/../../bzt/10-base.json",
            local_paths_config()
        ]
        self.engine_obj.configure(
            self.paths
        )  # FIXME: avoid using whole engine in particular module test!
        self.engine_obj.config.get("modules").get("selenium").merge(
            {"virtual-display": {
                "width": 1024,
                "height": 768
            }})
        self.selenium_config = self.engine_obj.config["modules"]["selenium"]
        self.engine_obj.create_artifacts_dir(self.paths)
        self.obj = SeleniumExecutor()
        self.obj.engine = self.engine_obj
        self.obj.settings = self.selenium_config

    def tearDown(self):
        self.obj.free_virtual_display()