File size: 5,785 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
# Quick Start Guide - POC Execution

## πŸš€ Get Started in 5 Minutes

### Step 1: Extract and Setup (2 minutes)

```bash
# Extract the project
unzip langgraph_ui_regression.zip
cd langgraph_ui_regression

# Run setup script
chmod +x setup.sh
./setup.sh

# Or manually install dependencies
pip install -r requirements.txt
playwright install chromium
```

### Step 2: Configure Credentials (1 minute)

```bash
# Copy and edit environment file
cp .env.example .env
nano .env
```

**Add your credentials:**
```env
FIGMA_FILE_KEY=your_figma_file_key
FIGMA_ACCESS_TOKEN=your_figma_access_token
WEBSITE_URL=https://v0-replicate-checkout-design.vercel.app/
```

### Step 3: Run the System (2 minutes)

```bash
# Execute the workflow
python main.py

# Or with custom output directory
python main.py --output-dir ./my_reports --debug
```

### Step 4: Check Results

Reports are generated in `./reports/` directory:
- `report_YYYYMMDD_HHMMSS.json` - Machine-readable report
- `report_YYYYMMDD_HHMMSS.md` - Human-readable report

---

## πŸ“‹ What Happens During Execution

```
1. Agent 0: Creates test plan
   ↓
2. Agent 1: Extracts design specs from Figma
   ↓
3. Agent 2: Extracts CSS specs from website
   ↓
4. Agent 3: Compares and generates findings
   ↓
5. Reports: JSON + Markdown output
```

---

## 🎯 Expected Output

### Console Output
```
======================================================================
πŸš€ UI REGRESSION TESTING SYSTEM
======================================================================

πŸ“‹ Configuration:
  Figma File Key: abc123def456...
  Website URL: https://v0-replicate-checkout-design.vercel.app/
  Output Directory: ./reports
  Debug Mode: False

======================================================================

πŸ€– Agent 0: Super Agent - Generating Test Plan...
  βœ“ Configured 2 viewports
  βœ“ Configured 7 test categories
  βœ“ Test plan generated with 140 total tests

🎨 Agent 1: Design Inspector - Extracting Design Specs...
  βœ“ Loaded Figma file: Checkout Design
  βœ“ Extracted 156 design specifications
    - colors: 12 specs
    - typography: 24 specs
    - spacing: 18 specs
    - layout: 22 specs
    - borders: 15 specs
    - effects: 8 specs

🌐 Agent 2: Website Inspector - Extracting Website Specs...
  πŸ“± Processing desktop viewport (1440px)...
    βœ“ Loaded https://v0-replicate-checkout-design.vercel.app/
    βœ“ Extracted specs for desktop
  πŸ“± Processing mobile viewport (375px)...
    βœ“ Extracted specs for mobile

πŸ” Agent 3: Difference Analyzer - Comparing Specs...
  πŸ“Š Analyzing colors...
    βœ“ Found 5 differences
  πŸ“Š Analyzing typography...
    βœ“ Found 3 differences
  πŸ“Š Analyzing spacing...
    βœ“ Found 2 differences
  ...

  βœ“ Total findings: 15
    - High: 3
    - Medium: 7
    - Low: 5

πŸ“Š Generating Reports...

======================================================================
βœ… EXECUTION COMPLETED SUCCESSFULLY
======================================================================

πŸ“„ Reports:
  JSON: ./reports/report_20240103_120000.json
  Markdown: ./reports/report_20240103_120000.md

πŸ“ˆ Summary:
  Total Findings: 15
  High Severity: 3
  Medium Severity: 7
  Low Severity: 5
  Overall Score: 75/100

======================================================================
```

### Report Output

**Markdown Report Preview:**
```markdown
# UI Regression Testing Report

**Generated**: 2024-01-03 12:00:00

## Summary
- **Total Findings**: 15
- **πŸ”΄ High Severity**: 3
- **🟑 Medium Severity**: 7
- **🟒 Low Severity**: 5
- **Overall Score**: 75/100

## High Severity Issues

#### submit_button - backgroundColor
**Category**: colors
**Design Value**: `#FF0000`
**Website Value**: `#FF0001`
**Analysis**: Significant color mismatch affecting brand consistency...
```

---

## πŸ”§ Troubleshooting

### Problem: "ModuleNotFoundError: No module named 'langgraph'"

**Solution:**
```bash
pip install -r requirements.txt
```

### Problem: "Figma API authentication failed"

**Solution:**
1. Verify your Figma access token is correct
2. Ensure the token has access to the file
3. Check token hasn't expired

### Problem: "Website not loading"

**Solution:**
```bash
# Test the URL directly
curl https://v0-replicate-checkout-design.vercel.app/

# If it works, try running with debug mode
python main.py --debug
```

### Problem: "Playwright browser not found"

**Solution:**
```bash
playwright install chromium
```

---

## πŸ“Š Understanding the Reports

### JSON Report Structure
```json
{
  "metadata": { ... },
  "summary": {
    "total_findings": 15,
    "high_severity": 3,
    "medium_severity": 7,
    "low_severity": 5,
    "overall_score": 75
  },
  "findings": [
    {
      "component": "button",
      "category": "colors",
      "property": "backgroundColor",
      "severity": "high",
      "design_value": "#FF0000",
      "website_value": "#FF0001",
      "hf_analysis": "..."
    }
  ]
}
```

### Severity Levels

- πŸ”΄ **High**: Critical issues affecting functionality or brand consistency
- 🟑 **Medium**: Visual inconsistencies that should be addressed
- 🟒 **Low**: Minor differences that are visually acceptable

---

## 🎯 Next Steps After POC

1. **Review Findings**: Check the generated reports
2. **Fix Issues**: Address high and medium severity findings
3. **Re-run Tests**: Execute again to verify fixes
4. **Add Gradio Dashboard**: For visual comparison (Phase 7)
5. **CI/CD Integration**: Automate testing in your pipeline

---

## πŸ“ž Need Help?

1. Check the main **README.md** for detailed documentation
2. Enable debug mode: `python main.py --debug`
3. Review the generated reports for specific issues
4. Check the troubleshooting section above

---

**Ready to test? Run: `python main.py`** πŸš€