LayoutLens Documentationยถ

PyPI Version License Documentation Status

LayoutLens is a production-ready AI-powered UI testing framework that enables natural language visual testing. It captures screenshots using Playwright and analyzes them with OpenAIโ€™s GPT-4 Vision API to validate layouts, accessibility, responsive design, and visual consistency.

Key Achievement: 95.2% accuracy on professional ground truth benchmark suite.

๐Ÿš€ Quick Startยถ

pip install layoutlens
playwright install chromium
export OPENAI_API_KEY="your-key"
from layoutlens import LayoutLens

tester = LayoutLens()
result = tester.test_page("page.html", queries=["Is the layout responsive?"])
print(f"Success rate: {result.success_rate:.1%}")

โœจ Key Featuresยถ

  • Natural Language Testing: Ask questions like โ€œIs the button properly aligned?โ€

  • Multi-Viewport Support: Test across mobile, tablet, and desktop

  • Comprehensive Benchmarks: 31 test cases across 9 UI categories

  • 95.2% Accuracy: Validated on professional ground truth suite

  • CI/CD Ready: GitHub Actions and Jenkins integration

๐Ÿ“– Documentationยถ

๐Ÿ“Š Performance Metricsยถ

  • โœ… 95.2% accuracy on ground truth benchmark suite

  • โœ… 31 HTML test files across 9 specialized categories

  • โœ… ~23 seconds average processing time per test

  • โœ… Multi-viewport testing with responsive design validation

  • โœ… Production ready with professional documentation

Indices and tablesยถ