예제 #1
0
def bsl_context():
    if "BROWSERSTACK_LOCAL_IDENTIFIER" not in os.environ:
        raise pytest.skip(
            "Browserstack API key set, but no local identifier configured (BROWSERSTACK_LOCAL_IDENTIFIER)"
        )
    binary = find_binary("BrowserStackLocal")
    if not binary:
        raise pytest.skip(
            "Browserstack API key set, but no BrowserStackLocal binary found"
        )
    args = [
        binary,
        "--key",
        os.environ["BROWSERSTACK_API_KEY"],
        "--verbose",
        os.environ.get("BROWSERSTACK_LOCAL_VERBOSITY", "1"),
        "--local-identifier",
        os.environ["BROWSERSTACK_LOCAL_IDENTIFIER"],
        "--daemon",
    ]
    check_call(args + ["start"])
    try:
        yield
    finally:
        check_call(args + ["stop"])
예제 #2
0
 def ctx(root_url: str):
     binary = find_binary(driver)
     return get_session(service(binary=binary), browser(**browser_opts),
                        root_url)