62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
"""Tests for UITestAgent."""
|
|
|
|
import pytest
|
|
|
|
from app.agents.ui_test_agent import UITestAgent
|
|
|
|
|
|
@pytest.fixture
|
|
def ui_test_agent():
|
|
return UITestAgent()
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_initialization(ui_test_agent):
|
|
"""Test UITestAgent initializes correctly."""
|
|
assert ui_test_agent.name == "ui_test_agent"
|
|
assert ui_test_agent.version == "1.0.0"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_health_check(ui_test_agent):
|
|
"""Test UITestAgent health check."""
|
|
result = await ui_test_agent.health_check()
|
|
assert isinstance(result, bool)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_run(ui_test_agent):
|
|
"""Test UITestAgent run."""
|
|
result = await ui_test_agent.run({"action": "layout"})
|
|
assert hasattr(result, "success")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_visual_regression(ui_test_agent):
|
|
"""Test UITestAgent visual regression."""
|
|
result = await ui_test_agent._visual_regression_test("desktop")
|
|
assert hasattr(result, "success")
|
|
assert "passed" in result.data
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_accessibility(ui_test_agent):
|
|
"""Test UITestAgent accessibility check."""
|
|
result = await ui_test_agent._accessibility_check()
|
|
assert hasattr(result, "success")
|
|
assert "issues" in result.data
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_layout(ui_test_agent):
|
|
"""Test UITestAgent layout validation."""
|
|
result = await ui_test_agent._layout_validation()
|
|
assert hasattr(result, "success")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_ui_test_agent_responsive(ui_test_agent):
|
|
"""Test UITestAgent responsive test."""
|
|
result = await ui_test_agent._responsive_test()
|
|
assert hasattr(result, "success")
|
|
assert "viewports" in result.data |