Spaces:
Sleeping
Sleeping
| # UI Regression Testing System - Complete Package Contents | |
| ## π¦ Package Overview | |
| This is the complete, production-ready UI Regression Testing System with: | |
| - β HF Vision Model Integration (image captioning) | |
| - β Persistent Screenshot Storage (with auto-cleanup) | |
| - β Multi-agent workflow orchestration | |
| - β Comprehensive Gradio UI (8 tabs) | |
| - β Multi-format reporting | |
| - β Framework mapping (114-point) | |
| **Package Size**: ~1.1MB (ZIP) / 108KB (TAR.GZ) | |
| **Total Files**: 35+ Python modules + 8 documentation files | |
| **Python Version**: 3.11+ | |
| --- | |
| ## π Directory Structure | |
| ``` | |
| ui-regression-testing-hf/ | |
| βββ π Core Application Files | |
| β βββ app.py # Main Gradio interface (8 tabs) | |
| β βββ app_methods_extension.py # HF/Storage methods | |
| β βββ state_schema.py # Workflow state definition | |
| β βββ main.py # CLI entry point | |
| β βββ workflow.py # LangGraph workflow | |
| β | |
| βββ π€ Multi-Agent System | |
| β βββ agents/ | |
| β βββ agent_0_super_agent.py # Test planning | |
| β βββ agent_1_design_inspector.py # Figma screenshot capture | |
| β βββ agent_2_website_inspector.py # Website screenshot capture | |
| β βββ agent_3_difference_analyzer.py # Basic visual comparison | |
| β βββ agent_3_difference_analyzer_enhanced.py # Enhanced detection | |
| β βββ agent_3_integrated.py # Integrated (HF + Storage) | |
| β | |
| βββ π Analysis & Detection | |
| β βββ hf_vision_analyzer.py # HF Vision model integration | |
| β βββ css_extractor.py # CSS property extraction | |
| β βββ image_comparison_enhanced.py # Enhanced image comparison | |
| β βββ screenshot_annotator.py # Screenshot annotation | |
| β | |
| βββ π Reporting & Storage | |
| β βββ report_generator.py # Report generation | |
| β βββ report_generator_enhanced.py # Enhanced reporting | |
| β βββ storage_manager.py # Screenshot storage & cleanup | |
| β βββ test_verification.py # Framework verification | |
| β | |
| βββ π§ Utilities | |
| β βββ utils/ | |
| β βββ figma_client.py # Figma API client | |
| β βββ website_capturer.py # Website screenshot capture | |
| β | |
| βββ π Documentation (8 files) | |
| β βββ README.md # Main readme | |
| β βββ README_ENHANCED.md # Enhanced features guide | |
| β βββ QUICKSTART.md # Quick start guide | |
| β βββ SETUP.md # Setup instructions | |
| β βββ DEPLOYMENT_GUIDE.md # HF Spaces deployment | |
| β βββ FRAMEWORK_MAPPING.md # 114-point framework | |
| β βββ HF_AND_STORAGE_ANALYSIS.md # HF & Storage details | |
| β βββ SYSTEM_SUMMARY.md # System overview | |
| β βββ PACKAGE_CONTENTS.md # This file | |
| β | |
| βββ βοΈ Configuration | |
| β βββ requirements.txt # Python dependencies | |
| β βββ setup.sh # Setup script | |
| β βββ .gitignore # Git ignore rules | |
| β | |
| βββ π Data Directories (auto-created) | |
| βββ data/ | |
| βββ screenshots/ # Persistent storage | |
| β βββ {execution_id}/ | |
| β βββ {viewport}_{type}_{timestamp}.png | |
| β βββ metadata/ | |
| βββ comparisons/ # Comparison images | |
| βββ annotated/ # Annotated screenshots | |
| ``` | |
| --- | |
| ## π― Core Features | |
| ### 1. **HF Vision Model Integration** (`hf_vision_analyzer.py`) | |
| - Image captioning (semantic analysis) | |
| - Object detection (component identification) | |
| - Image classification (visual categorization) | |
| - Comparison and difference extraction | |
| ### 2. **Persistent Screenshot Storage** (`storage_manager.py`) | |
| - Automatic screenshot archiving | |
| - Metadata tracking | |
| - Auto-cleanup of old files (7+ days) | |
| - Storage statistics and monitoring | |
| - Execution history retrieval | |
| ### 3. **Multi-Agent Workflow** (`agents/`) | |
| - Agent 0: Test planning and categorization | |
| - Agent 1: Figma screenshot capture | |
| - Agent 2: Website screenshot capture | |
| - Agent 3: Integrated difference analysis (HF + Storage + CSS) | |
| ### 4. **Comprehensive UI** (`app.py`) | |
| - 8 tabs for different views | |
| - Real-time progress tracking | |
| - Comparison image gallery | |
| - Detailed differences list | |
| - HF Vision analysis results | |
| - Storage management interface | |
| - Help documentation | |
| ### 5. **Analysis Methods** | |
| - Screenshot pixel comparison | |
| - CSS property extraction | |
| - HF Vision model analysis | |
| - Hybrid detection combining all methods | |
| --- | |
| ## π File Descriptions | |
| ### Core Application | |
| | File | Purpose | Lines | | |
| |------|---------|-------| | |
| | `app.py` | Main Gradio UI with 8 tabs | ~550 | | |
| | `app_methods_extension.py` | HF/Storage methods | ~150 | | |
| | `state_schema.py` | Workflow state definition | ~200 | | |
| | `main.py` | CLI entry point | ~100 | | |
| | `workflow.py` | LangGraph workflow | ~150 | | |
| ### Agents | |
| | File | Purpose | Lines | | |
| |------|---------|-------| | |
| | `agent_0_super_agent.py` | Test planning | ~150 | | |
| | `agent_1_design_inspector.py` | Figma capture | ~200 | | |
| | `agent_2_website_inspector.py` | Website capture | ~200 | | |
| | `agent_3_difference_analyzer.py` | Basic analysis | ~250 | | |
| | `agent_3_difference_analyzer_enhanced.py` | Enhanced analysis | ~300 | | |
| | `agent_3_integrated.py` | Integrated (HF + Storage) | ~350 | | |
| ### Analysis Modules | |
| | File | Purpose | Lines | | |
| |------|---------|-------| | |
| | `hf_vision_analyzer.py` | HF Vision integration | ~400 | | |
| | `css_extractor.py` | CSS extraction | ~300 | | |
| | `image_comparison_enhanced.py` | Image comparison | ~250 | | |
| | `screenshot_annotator.py` | Screenshot annotation | ~200 | | |
| ### Reporting & Storage | |
| | File | Purpose | Lines | | |
| |------|---------|-------| | |
| | `report_generator.py` | Report generation | ~300 | | |
| | `report_generator_enhanced.py` | Enhanced reporting | ~350 | | |
| | `storage_manager.py` | Storage management | ~450 | | |
| | `test_verification.py` | Framework verification | ~200 | | |
| ### Utilities | |
| | File | Purpose | Lines | | |
| |------|---------|-------| | |
| | `figma_client.py` | Figma API client | ~150 | | |
| | `website_capturer.py` | Website capture | ~200 | | |
| **Total Code**: ~5,000+ lines of Python | |
| --- | |
| ## π Quick Start | |
| ### 1. Extract Package | |
| ```bash | |
| # From TAR.GZ | |
| tar -xzf ui-regression-testing-complete.tar.gz | |
| cd ui-regression-testing-hf | |
| # Or from ZIP | |
| unzip ui-regression-testing-complete.zip | |
| cd ui-regression-testing-hf | |
| ``` | |
| ### 2. Install Dependencies | |
| ```bash | |
| pip install -r requirements.txt | |
| python -m playwright install | |
| ``` | |
| ### 3. Run Application | |
| ```bash | |
| # Gradio UI (recommended) | |
| python app.py | |
| # Access at http://localhost:7860 | |
| # Or CLI | |
| python main.py | |
| ``` | |
| ### 4. Provide Credentials | |
| - Figma API Key (from https://www.figma.com/developers/api) | |
| - Figma File ID (from your Figma file URL) | |
| - Website URL (publicly accessible) | |
| - HF Token (optional, from https://huggingface.co/settings/tokens) | |
| --- | |
| ## π Dependencies | |
| ### Core Dependencies | |
| - `python-dotenv>=1.0.0` - Environment variables | |
| - `requests>=2.31.0` - HTTP requests | |
| - `langgraph>=0.0.50` - Workflow orchestration | |
| - `langchain>=0.1.0` - LLM framework | |
| - `playwright>=1.40.0` - Web automation | |
| ### Data Processing | |
| - `numpy>=1.24.3` - Numerical computing | |
| - `pandas>=2.1.3` - Data analysis | |
| - `pillow>=11.0.0` - Image processing | |
| - `opencv-python>=4.8.0` - Computer vision | |
| - `scikit-image>=0.21.0` - Image processing | |
| ### ML & Vision | |
| - `transformers>=4.30.0` - HF models | |
| - `torch>=2.0.0` - PyTorch | |
| - `huggingface-hub>=0.19.0` - HF API | |
| ### UI & Reporting | |
| - `gradio>=4.0.0` - Web UI | |
| - `scipy>=1.11.0` - Scientific computing | |
| **Total Size**: ~2GB (with all dependencies) | |
| --- | |
| ## π¨ UI Tabs (8 Total) | |
| 1. **π Run Test** - Configuration and test execution | |
| 2. **π Results Summary** - Overall statistics | |
| 3. **π Detected Differences** - Detailed list | |
| 4. **πΈ Comparison Images** - Annotated screenshots | |
| 5. **π Full Report** - Comprehensive analysis | |
| 6. **π€ HF Vision Analysis** - Model results | |
| 7. **πΎ Storage & Data** - Storage management | |
| 8. **π Help & Documentation** - User guide | |
| --- | |
| ## π Capabilities | |
| ### Detection Methods | |
| - β Screenshot pixel comparison | |
| - β CSS property extraction | |
| - β HF Vision image captioning | |
| - β Object detection | |
| - β Hybrid analysis | |
| ### Categories Detected (10) | |
| 1. Layout & Structure | |
| 2. Typography | |
| 3. Colors & Contrast | |
| 4. Spacing & Sizing | |
| 5. Borders & Outlines | |
| 6. Shadows & Effects | |
| 7. Components & Elements | |
| 8. Buttons & Interactive | |
| 9. Forms & Inputs | |
| 10. Images & Media | |
| ### Report Formats | |
| - Markdown (`.md`) | |
| - JSON (`.json`) | |
| - HTML (`.html`) | |
| - Framework mapping reports | |
| --- | |
| ## πΎ Storage Features | |
| ### Automatic Storage | |
| - Screenshots saved per execution | |
| - Metadata tracked (timestamp, size, type) | |
| - Organized by execution ID | |
| ### Storage Management | |
| - Auto-cleanup of 7+ day old files | |
| - Storage statistics dashboard | |
| - Execution history retrieval | |
| - Export execution data | |
| ### Storage Location | |
| ``` | |
| data/screenshots/ | |
| βββ {execution_id}/ | |
| β βββ desktop_figma_20240104_101530.png | |
| β βββ desktop_website_20240104_101530.png | |
| β βββ mobile_figma_20240104_101530.png | |
| β βββ mobile_website_20240104_101530.png | |
| β βββ metadata/ | |
| β βββ {execution_id}_*.json | |
| ``` | |
| --- | |
| ## π§ Configuration | |
| ### Environment Variables | |
| ```bash | |
| FIGMA_ACCESS_TOKEN=figd_... | |
| HUGGINGFACE_API_KEY=hf_... | |
| ``` | |
| ### Customizable Settings | |
| - Viewport sizes (1440px, 375px, custom) | |
| - Detection sensitivity | |
| - Report format | |
| - Framework categories | |
| - Storage retention (days) | |
| --- | |
| ## π Documentation Files | |
| | File | Purpose | | |
| |------|---------| | |
| | `README.md` | Main documentation | | |
| | `README_ENHANCED.md` | Enhanced features | | |
| | `QUICKSTART.md` | Quick start guide | | |
| | `SETUP.md` | Setup instructions | | |
| | `DEPLOYMENT_GUIDE.md` | HF Spaces deployment | | |
| | `FRAMEWORK_MAPPING.md` | 114-point framework | | |
| | `HF_AND_STORAGE_ANALYSIS.md` | Technical details | | |
| | `SYSTEM_SUMMARY.md` | System overview | | |
| | `PACKAGE_CONTENTS.md` | This file | | |
| --- | |
| ## π Deployment Options | |
| ### Local Development | |
| ```bash | |
| python app.py | |
| ``` | |
| ### HF Spaces | |
| 1. Create new Space | |
| 2. Select Docker SDK | |
| 3. Push code to Space repo | |
| 4. Auto-builds and deploys | |
| ### Docker | |
| ```bash | |
| docker build -t ui-regression-testing . | |
| docker run -p 7860:7860 ui-regression-testing | |
| ``` | |
| ### Cloud Platforms | |
| - AWS (Lambda, EC2, ECS) | |
| - Google Cloud (Cloud Run, App Engine) | |
| - Azure (Container Instances, App Service) | |
| --- | |
| ## π Testing Your Installation | |
| ### Verify Installation | |
| ```bash | |
| python -c "import gradio; import transformers; import playwright; print('β All dependencies installed')" | |
| ``` | |
| ### Run Test | |
| ```bash | |
| python app.py | |
| # Open http://localhost:7860 | |
| # Fill in test credentials | |
| # Click "Start Regression Test" | |
| ``` | |
| ### Expected Output | |
| - Progress log showing all agents | |
| - Comparison images | |
| - Detected differences list | |
| - Similarity score | |
| - HF Vision analysis results | |
| - Storage information | |
| --- | |
| ## π Performance Metrics | |
| | Metric | Value | | |
| |--------|-------| | |
| | Figma capture | 5-10s | | |
| | Website capture | 10-15s | | |
| | Difference analysis | 5-10s | | |
| | Report generation | 2-5s | | |
| | **Total time** | **30-50s** | | |
| | **Memory usage** | ~500MB-1GB | | |
| | **Storage per run** | ~1.2MB | | |
| --- | |
| ## π― Success Criteria | |
| - β Detects all 13 user-annotated differences | |
| - β Maps to 114-point framework | |
| - β Generates multiple report formats | |
| - β Provides intuitive UI | |
| - β Deployable to HF Spaces | |
| - β Persistent screenshot storage | |
| - β HF Vision model integration | |
| - β Auto-cleanup functionality | |
| --- | |
| ## π Support & Resources | |
| ### Documentation | |
| - See `README_ENHANCED.md` for user guide | |
| - See `FRAMEWORK_MAPPING.md` for framework details | |
| - See `DEPLOYMENT_GUIDE.md` for deployment | |
| - See `HF_AND_STORAGE_ANALYSIS.md` for technical details | |
| ### Troubleshooting | |
| - Check Help & Documentation tab in UI | |
| - Review code comments and docstrings | |
| - Check error messages in progress log | |
| ### External Resources | |
| - [Gradio Documentation](https://www.gradio.app/) | |
| - [LangGraph Documentation](https://langchain-ai.github.io/langgraph/) | |
| - [Hugging Face Models](https://huggingface.co/models) | |
| - [Figma API](https://www.figma.com/developers/api) | |
| --- | |
| ## π Learning Resources | |
| ### Concepts Covered | |
| - Multi-agent workflows | |
| - Web automation | |
| - Image processing | |
| - CSS extraction | |
| - HF vision models | |
| - Gradio UI development | |
| - Report generation | |
| - Storage management | |
| ### Technologies | |
| - Python 3.11 | |
| - LangGraph | |
| - Gradio 6.0 | |
| - Playwright | |
| - Transformers | |
| - OpenCV | |
| - PIL/Pillow | |
| --- | |
| ## π Version Information | |
| - **System Version**: 2.0 (Enhanced with HF Vision + Storage) | |
| - **Release Date**: January 4, 2026 | |
| - **Python Version**: 3.11+ | |
| - **Status**: Production Ready | |
| --- | |
| ## π Features Summary | |
| | Feature | Status | Details | | |
| |---------|--------|---------| | |
| | Multi-agent workflow | β | 4 agents (planning, capture, capture, analysis) | | |
| | HF Vision integration | β | Image captioning + object detection | | |
| | Persistent storage | β | Auto-cleanup, metadata tracking | | |
| | Gradio UI | β | 8 tabs, real-time updates | | |
| | Multi-format reports | β | Markdown, JSON, HTML | | |
| | Framework mapping | β | 114-point framework | | |
| | CSS extraction | β | Property-level analysis | | |
| | Screenshot annotation | β | Visual markup | | |
| | Deployable | β | HF Spaces, Docker, Cloud | | |
| | Extensible | β | Modular architecture | | |
| --- | |
| **Ready to deploy! π** | |
| For questions or issues, refer to the documentation files or review the code comments. | |