Ejemplo n.º 1
0
def test_add_browser():
    conf = SeleniumConfiguration().add_browser(
        IosDeviceInfo("iPhone X", "portrait"))
    assert conf.browsers_info == [
        IosDeviceInfo(IosDeviceName.iPhone_X, ScreenOrientation.PORTRAIT)
    ]

    conf = SeleniumConfiguration().add_browser(
        ChromeEmulationInfo("iPhone 4", "portrait"))
    assert conf.browsers_info == [
        ChromeEmulationInfo(DeviceName.iPhone_4, ScreenOrientation.PORTRAIT)
    ]

    conf = (SeleniumConfiguration().set_baseline_env_name(
        "Default baseline").add_browser(
            400, 600, BrowserType.EDGE_CHROMIUM,
            "Baseline").add_browser(500, 600, BrowserType.SAFARI).add_browser(
                500, 600, BrowserType.FIREFOX).add_browser(
                    DesktopBrowserInfo(400, 600, BrowserType.EDGE_CHROMIUM)))
    assert conf.browsers_info == [
        DesktopBrowserInfo(400, 600, BrowserType.EDGE_CHROMIUM, "Baseline"),
        DesktopBrowserInfo(500, 600, BrowserType.SAFARI, "Default baseline"),
        DesktopBrowserInfo(500, 600, BrowserType.FIREFOX, "Default baseline"),
        DesktopBrowserInfo(400, 600, BrowserType.EDGE_CHROMIUM),
    ]
Ejemplo n.º 2
0
def test_add_browsers():
    browsers = [
        IosDeviceInfo("iPhone X", "portrait"),
        IosDeviceInfo("iPhone 11", "landscape"),
        DesktopBrowserInfo(400, 600, BrowserType.EDGE_CHROMIUM),
    ]
    conf = SeleniumConfiguration().add_browsers(*browsers)
    assert conf.browsers_info == browsers

    conf = SeleniumConfiguration().add_browsers(browsers)
    assert conf.browsers_info == browsers
Ejemplo n.º 3
0
def test_default_values_selenium_configuration():
    conf = SeleniumConfiguration()

    assert conf.disable_browser_fetching is True
    assert conf.enable_cross_origin_rendering is True
    assert conf.dont_use_cookies is False
    assert conf.layout_breakpoints is None
Ejemplo n.º 4
0
def test_set_value_to_sel_conf():
    conf = SeleniumConfiguration()
    conf.set_force_full_page_screenshot(True).set_wait_before_screenshots(
        10000000).set_stitch_mode(
            StitchMode.CSS).set_hide_scrollbars(True).set_hide_caret(True)
    assert conf.force_full_page_screenshot == True
    assert conf.wait_before_screenshots == 10000000
    assert conf.stitch_mode == StitchMode.CSS
    assert conf.hide_scrollbars == True
    assert conf.hide_caret == True
Ejemplo n.º 5
0
def test_set_value_to_sel_conf():
    conf = SeleniumConfiguration()
    conf.set_force_full_page_screenshot(True).set_wait_before_screenshots(
        10000000
    ).set_stitch_mode(StitchMode.CSS).set_hide_scrollbars(True).set_hide_caret(True)
    conf.set_disable_browser_fetching(True)
    conf.set_enable_cross_origin_rendering(False)

    assert conf.force_full_page_screenshot == True
    assert conf.wait_before_screenshots == 10000000
    assert conf.stitch_mode == StitchMode.CSS
    assert conf.hide_scrollbars == True
    assert conf.hide_caret == True
    assert conf.disable_browser_fetching is True
    assert conf.enable_cross_origin_rendering is False
Ejemplo n.º 6
0
def test_config_cloning():
    conf = SeleniumConfiguration()
    conf.set_viewport_size({"width": 200, "height": 400})
    conf.add_property("hello", "world")
    conf.default_match_settings.content_regions.append(Region.EMPTY())
    conf.add_browser(200, 400, BrowserType.EDGE_CHROMIUM)
    conf.set_visual_grid_options(VisualGridOption("option1", "val"))

    cloned_conf = conf.clone()

    assert id(conf.properties[0]) != id(cloned_conf.properties[0])
    assert id(conf.default_match_settings.content_regions) != id(
        cloned_conf.default_match_settings.content_regions
    )
    assert id(conf._browsers_info[0]) != id(cloned_conf._browsers_info[0])
    assert id(conf.viewport_size) != id(cloned_conf.viewport_size)
    assert id(conf.visual_grid_options[0]) != id(cloned_conf.visual_grid_options[0])
Ejemplo n.º 7
0
def test_layout_breakpoints_list():
    conf = SeleniumConfiguration()
    conf.set_layout_breakpoints(1, 2, 3)

    assert conf.layout_breakpoints == [1, 2, 3]
Ejemplo n.º 8
0
            "APPLITOOLS_BRANCH": "name",
            "APPLITOOLS_PARENT_BRANCH": "parent branch",
            "APPLITOOLS_BASELINE_BRANCH": "baseline branch",
            "APPLITOOLS_API_KEY": "api key",
            "APPLITOOLS_SERVER_URL": "server url",
        },
    ):
        config = Configuration()
    assert config.branch_name == "name"
    assert config.parent_branch_name == "parent branch"
    assert config.baseline_branch_name == "baseline branch"
    assert config.api_key == "api key"
    assert config.server_url == "server url"


@pytest.mark.parametrize("conf", [Configuration(), SeleniumConfiguration()])
def test_set_value_to_conf(conf):
    batch = BatchInfo()
    (conf.set_batch(batch).set_branch_name("branch name").set_agent_id(
        "agent id").set_parent_branch_name("parent branch name").
     set_baseline_branch_name("baseline branch name").set_baseline_env_name(
         "baseline env name").set_environment_name("env name").set_save_diffs(
             True).set_app_name("app name").set_test_name(
                 "test name").set_viewport_size({
                     "width": 400,
                     "height": 300
                 }).set_session_type(SessionType.PROGRESSION).set_ignore_caret(
                     False).set_host_app("host app").set_host_os(
                         "host os").set_match_timeout(100000).set_match_level(
                             MatchLevel.EXACT).set_ignore_displacements(True).
     set_save_new_tests(False).set_save_failed_tests(True).set_failure_reports(
Ejemplo n.º 9
0
def test_default_values_selenium_configuration():
    conf = SeleniumConfiguration()

    assert conf.disable_browser_fetching is False
    assert conf.enable_cross_origin_rendering is True