Ejemplo n.º 1
0
def test_ufg_options(driver):
    runner = VisualGridRunner(1)
    eyes = Eyes(runner)

    (eyes.configure.add_browser(800, 600,
                                BrowserType.CHROME).set_visual_grid_options(
                                    VisualGridOption("option1", "value1"),
                                    VisualGridOption("option2", False)))

    driver.get("https://google.com")
    with patch("applitools.core.server_connector.ServerConnector.render"
               ) as patched:
        eyes.open(driver, "Mock app", "Mock Test")
        eyes.check(
            "",
            Target.window().visual_grid_options(
                VisualGridOption("option3", "value3"),
                VisualGridOption("option4", 5),
                VisualGridOption("option1", 5),
            ),
        )
        eyes.close_async()
        res = runner.get_all_test_results()

        request_options = patched.call_args.args[0].options
        assert request_options == {
            "option1": 5,
            "option2": False,
            "option3": "value3",
            "option4": 5,
        }
def test_running_test_options_dict_values_updated_values():
    options = RunningTest._options_dict(
        (VisualGridOption("key1", "val1"), VisualGridOption("key2", "val2")),
        (VisualGridOption("key1", "val3"), VisualGridOption("key4", "val4")),
    )

    assert options == {"key1": "val3", "key2": "val2", "key4": "val4"}
Ejemplo n.º 3
0
def test_ufg_options(driver, fake_connector_class):
    runner = VisualGridRunner(1)
    eyes = Eyes(runner)
    eyes.server_connector = fake_connector_class()

    (
        eyes.configure.add_browser(
            800, 600, BrowserType.CHROME
        ).set_visual_grid_options(
            VisualGridOption("option1", "value1"), VisualGridOption("option2", False)
        )
    )

    driver.get("https://google.com")
    eyes.open(driver, "Mock app", "Mock Test")
    eyes.check(
        "",
        Target.window().visual_grid_options(
            VisualGridOption("option3", "value3"),
            VisualGridOption("option4", 5),
            VisualGridOption("option1", 5),
        ),
    )
    eyes.close_async()
    runner.get_all_test_results()

    request_options = eyes.server_connector.input_calls["render"][0][0].options
    assert request_options == {
        "option1": 5,
        "option2": False,
        "option3": "value3",
        "option4": 5,
    }
Ejemplo n.º 4
0
    def visual_grid_option(
            self,
            name,  # type: Text
            value,  # type: Text
            check_settings=None,  # type:Optional[SeleniumCheckSettings]
    ):
        # type: (...)->SeleniumCheckSettings
        """
        Returns a CheckSettings object with VisualGridOption specified in the arguments.

            | =Arguments=   | =Description=                              |                                                           |
            | name          | *Mandatory* - The VisualGridOption name.   |                                                     |                                                         |
            | value         | *Mandatory* - The VisualGridOption value.  |

        *Example:*
            | Eyes Check                  |
            | ...     Visual Grid Option  |  key name     value   |
            | ...     Visual Grid Option  |  key name2    value   |
        """
        return new_or_cur_check_settings(check_settings).visual_grid_options(
            VisualGridOption(name, value))
Ejemplo n.º 5
0
 def check_and_return(self, value, context=None):
     sanitized = self.scheme.check(value, context)
     return [VisualGridOption(**dct) for dct in sanitized]
def test_running_test_options_dict_one_one_combined():
    options = RunningTest._options_dict(
        (VisualGridOption("key1", "val1"),), (VisualGridOption("key2", "val2"),)
    )

    assert options == {"key1": "val1", "key2": "val2"}
def test_running_test_options_dict_none_one():
    options = RunningTest._options_dict(None, (VisualGridOption("key", "val"),))

    assert options == {"key": "val"}
def test_visual_grid_option(check_settings_keyword):
    res = SeleniumCheckSettings().visual_grid_options(
        VisualGridOption("KEY", "VALUE"))
    assert res == check_settings_keyword.visual_grid_option("KEY", "VALUE")