Beispiel #1
0
    def test_core_screenshot_hide_elements_internetexplorer(self):
        # Dali setup
        self.driver = Remote(
            desired_capabilities=DesiredCapabilities.INTERNETEXPLORER,
            command_executor="http://{host}:{port}/wd/hub".format(host=Config.server, port=Config.port)
        )
        self.core = DaliCore()
        self.core.init(self.driver.command_executor._url, json.dumps(self.driver.capabilities))

        options = TOptions(hide_elements=['#pic'])

        self.load_page("hide_elements1")
        self.first_screenshot = self.core.take(self.current_directory, options)

        self.load_page("hide_elements2")
        self.second_screenshot = self.core.take(self.current_directory, options)

        self.assertTrue(os.path.exists(self.first_screenshot))
        self.assertTrue(os.path.exists(self.second_screenshot))

        image1 = Image.open(self.first_screenshot)
        image2 = Image.open(self.second_screenshot)

        matrix1 = numpy.asarray(image1)
        matrix2 = numpy.asarray(image2)

        numpy.testing.assert_array_equal(matrix1, matrix2)
Beispiel #2
0
    def test_core_screenshot_disable_animation_opera(self):
        # Dali setup
        self.driver = Remote(
            desired_capabilities=DesiredCapabilities.OPERA,
            command_executor="http://{host}:{port}/wd/hub".format(host=Config.server, port=Config.port)
        )
        self.core = DaliCore()
        self.core.init(self.driver.command_executor._url, json.dumps(self.driver.capabilities))

        option = TOptions(disable_animation=True)

        self.load_page("animation")
        self.first_screenshot = self.core.take(self.current_directory, option)

        self.load_page("animation")
        #sleep to get another state of animation
        time.sleep(0.5)
        self.second_screenshot = self.core.take(self.current_directory, option)

        self.assertTrue(os.path.exists(self.first_screenshot))
        self.assertTrue(os.path.exists(self.second_screenshot))

        image1 = Image.open(self.first_screenshot)
        image2 = Image.open(self.second_screenshot)

        matrix1 = numpy.asarray(image1)
        matrix2 = numpy.asarray(image2)

        numpy.testing.assert_array_equal(matrix1, matrix2)
Beispiel #3
0
    def test_core_screenshot_resize_internetexplorer(self):
        # Dali setup
        self.driver = Remote(
            desired_capabilities=DesiredCapabilities.INTERNETEXPLORER,
            command_executor="http://{host}:{port}/wd/hub".format(
                host=Config.server, port=Config.port))
        self.core = DaliCore()
        self.core.init(self.driver.command_executor._url,
                       json.dumps(self.driver.capabilities))

        resolutions = ["800x600", "1024x768", "1280x1024", "1366x768"]
        for resolution in resolutions:
            self.core.resize(resolution)
            size = self.driver.get_window_size()
            width = size["width"]
            height = size["height"]
            actual_resolution = "{width}x{height}".format(width=width,
                                                          height=height)
            self.assertEqual(resolution, actual_resolution)
Beispiel #4
0
    def test_core_screenshot_image_chrome(self):
        # Dali setup
        self.driver = Remote(
            desired_capabilities=DesiredCapabilities.CHROME,
            command_executor="http://{host}:{port}/wd/hub".format(host=Config.server, port=Config.port)
        )
        self.core = DaliCore()
        self.core.init(self.driver.command_executor._url, json.dumps(self.driver.capabilities))

        self.load_page("picture1")
        self.first_screenshot = self.core.take(self.current_directory, TOptions())
        self.second_screenshot = self.core.take(self.current_directory, TOptions())

        self.assertTrue(os.path.exists(self.first_screenshot))
        self.assertTrue(os.path.exists(self.second_screenshot))

        image1 = Image.open(self.first_screenshot)
        image2 = Image.open(self.second_screenshot)

        matrix1 = numpy.asarray(image1)
        matrix2 = numpy.asarray(image2)

        numpy.testing.assert_array_equal(matrix1, matrix2)