Files
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:03:19 +08:00

65 lines
2.1 KiB
Python

"""Integration tests specifically for the HTTP transport against a running computer-server.
Skipped unless CUA_TEST_HTTP_URL is set.
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.asyncio
class TestHTTPTransport:
async def test_screenshot(self, http_transport):
data = await http_transport.screenshot()
assert isinstance(data, bytes)
assert data[:4] == b"\x89PNG"
async def test_screen_size(self, http_transport):
size = await http_transport.get_screen_size()
assert size["width"] > 0
assert size["height"] > 0
async def test_get_environment(self, http_transport):
env = await http_transport.get_environment()
assert env in ("windows", "mac", "linux", "browser")
async def test_send_click(self, http_transport):
await http_transport.send("left_click", x=100, y=100)
# Should not raise
async def test_send_type(self, http_transport):
await http_transport.send("type_text", text="hello")
async def test_send_get_screen_size(self, http_transport):
result = await http_transport.send("get_screen_size")
assert "width" in result or isinstance(result, dict)
class TestHTTPSandboxFullInterface:
"""Same interface tests as the main suite, but explicitly via HTTP sandbox."""
async def test_screenshot(self, http_sandbox):
data = await http_sandbox.screenshot()
assert data[:4] == b"\x89PNG"
async def test_mouse_click(self, http_sandbox):
await http_sandbox.mouse.click(100, 100)
async def test_keyboard_type(self, http_sandbox):
await http_sandbox.keyboard.type("http-test")
async def test_clipboard(self, http_sandbox):
await http_sandbox.clipboard.set("http-clip")
val = await http_sandbox.clipboard.get()
assert val == "http-clip"
async def test_shell(self, http_sandbox):
result = await http_sandbox.shell.run("echo http-shell")
assert result.success
async def test_window_title(self, http_sandbox):
title = await http_sandbox.window.get_active_title()
assert isinstance(title, str)