-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ui_integration.py
More file actions
64 lines (55 loc) · 1.6 KB
/
Copy pathtest_ui_integration.py
File metadata and controls
64 lines (55 loc) · 1.6 KB
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
#!/usr/bin/env python
"""
Test script to verify UI integration and URL generation.
"""
from src.pvb_flow.ui.handlers import handle_open_mermaid_chart
# Test with a simple diagram
test_diagram = """flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
style A fill:#4A90D9
style B fill:#4A90D9
style C fill:#50C878
style D fill:#FF9F43
style E fill:#E74C3C
"""
print("=" * 80)
print("Testing UI Integration")
print("=" * 80)
print()
# Test URL generation
url = handle_open_mermaid_chart(test_diagram)
if url:
print("✅ URL Generation: SUCCESS")
print()
print("Generated URL (first 100 chars):")
print(url[:100] + "...")
print()
print(f"Full URL length: {len(url)} characters")
print()
print("Expected behavior:")
print(" 1. User clicks '🔗 Open in Mermaid Chart' button")
print(" 2. Python handler generates this URL")
print(" 3. JavaScript receives URL and calls window.open(url, '_blank')")
print(" 4. New tab opens with MermaidChart.com playground")
print(" 5. Diagram is loaded and ready to edit/export")
else:
print("❌ URL Generation: FAILED")
print("No URL generated")
print()
print("=" * 80)
# Test with empty diagram
print()
print("Testing with empty diagram...")
empty_url = handle_open_mermaid_chart("")
if not empty_url:
print("✅ Empty diagram handling: SUCCESS (returns empty string)")
else:
print("❌ Empty diagram handling: FAILED (should return empty string)")
print()
print("=" * 80)
print("All integration tests completed!")
print("=" * 80)