def atest(c, suite=None, include=None, zip=None):
    """Runs Robot Framework acceptance tests.

    Args:
        suite: Select which suite to run.
        include: Select test by tag
        zip: Create zip file from output files.
    """
    args = [
        "--pythonpath",
        ".",
    ]
    if suite:
        args.extend(["--suite", suite])
    if include:
        args.extend(["--include", include])
    exit = False if zip else True
    os.mkdir(ATEST_OUTPUT)
    logfile = open(Path(ATEST_OUTPUT, "playwright-log.txt"), "w")
    os.environ["DEBUG"] = "pw:api"
    os.environ["PLAYWRIGHT_BROWSERS_PATH"] = "0"
    port = str(find_free_port())
    process = subprocess.Popen([
        "node",
        "Browser/wrapper/index.js",
        port,
    ], stdout=logfile, stderr=subprocess.STDOUT)
    os.environ["ROBOT_FRAMEWORK_BROWSER_NODE_PORT"] = port
    rc = _run_pabot(args, exit)
    process.kill()
    if zip:
        _clean_zip_dir()
        print(f"Zip file created to: {_create_zip()}")
    sys.exit(rc)
def start_test_server():
    global SERVERS
    port = str(find_free_port())
    # For some reason, we need to have cwd at project root for the server to run properly.
    root_dir = Path(os.path.dirname(__file__)) / ".." / ".."
    test_app_path = root_dir / "node" / "dynamic-test-app" / "dist" / "server.js"
    process = Popen(
        ["node", test_app_path, port], stdout=PIPE, stderr=STDOUT, cwd=root_dir
    )
    SERVERS[port] = process
    return port
Exemple #3
0
def start_test_server():
    global SERVERS
    port = str(find_free_port())
    # For some reason, we need to have cwd at project root for the server to run properly.
    root_dir = Path(os.path.dirname(__file__)) / ".." / ".."
    root_dir = root_dir.resolve()
    test_app_path = root_dir / "node" / "dynamic-test-app" / "dist" / "server.js"
    print(test_app_path)
    # TODO: remove str() when Python 3.7 support is dropped.
    process = Popen(
        ["node", str(test_app_path), port],
        stdout=PIPE,
        stderr=STDOUT,
        cwd=str(root_dir),
    )
    SERVERS[port] = process
    return port