91e75e620b
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
33 lines
900 B
Python
33 lines
900 B
Python
"""Integration tests for the synchronous API wrappers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from cua_sandbox.sync import localhost
|
|
|
|
|
|
class TestSyncLocalhost:
|
|
def test_screenshot(self):
|
|
with localhost() as host:
|
|
data = host.screenshot()
|
|
assert isinstance(data, bytes)
|
|
assert data[:4] == b"\x89PNG"
|
|
|
|
def test_mouse_click(self):
|
|
with localhost() as host:
|
|
host.mouse.click(50, 50)
|
|
|
|
def test_shell_run(self):
|
|
with localhost() as host:
|
|
result = host.shell.run("echo sync-test")
|
|
assert result.success
|
|
assert "sync-test" in result.stdout
|
|
|
|
def test_keyboard_type(self):
|
|
with localhost() as host:
|
|
host.keyboard.type("x")
|
|
|
|
def test_dimensions(self):
|
|
with localhost() as host:
|
|
w, h = host.get_dimensions()
|
|
assert w > 0 and h > 0
|