Spaces:
Sleeping
Sleeping
File size: 13,777 Bytes
6f38c76 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | # 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.
|