-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test.html
More file actions
182 lines (159 loc) · 6.71 KB
/
Copy pathdebug_test.html
File metadata and controls
182 lines (159 loc) · 6.71 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
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
<!DOCTYPE html>
<html>
<head>
<title>Debug Test - Uniform Configurator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background: #f0f0f0;
}
.test-container {
background: white;
padding: 20px;
margin: 10px 0;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.status {
font-weight: bold;
padding: 5px 10px;
border-radius: 4px;
margin: 5px 0;
}
.success { background: #d4edda; color: #155724; }
.error { background: #f8d7da; color: #721c24; }
.warning { background: #fff3cd; color: #856404; }
iframe {
width: 100%;
height: 600px;
border: 1px solid #ccc;
border-radius: 4px;
}
#console-output {
background: #333;
color: #0f0;
padding: 10px;
border-radius: 4px;
font-family: monospace;
max-height: 200px;
overflow-y: auto;
white-space: pre-wrap;
}
</style>
</head>
<body>
<h1>🔍 Uniform Configurator Debug Test</h1>
<div class="test-container">
<h2>🌐 Server Status</h2>
<div id="server-status" class="status warning">Testing...</div>
<div id="api-status" class="status warning">Testing...</div>
</div>
<div class="test-container">
<h2>📱 Application Status</h2>
<div id="app-status" class="status warning">Loading...</div>
<div id="dom-status" class="status warning">Checking...</div>
</div>
<div class="test-container">
<h2>🖥️ Application Preview</h2>
<iframe id="app-frame" src="http://localhost:3026"></iframe>
</div>
<div class="test-container">
<h2>📋 Console Output</h2>
<div id="console-output">Waiting for console messages...</div>
</div>
<script>
let consoleMessages = [];
// Capture console messages
const originalLog = console.log;
const originalError = console.error;
const originalWarn = console.warn;
function logToDebug(type, ...args) {
const timestamp = new Date().toLocaleTimeString();
const message = `[${timestamp}] ${type.toUpperCase()}: ${args.join(' ')}`;
consoleMessages.push(message);
updateConsoleOutput();
}
console.log = function(...args) {
originalLog.apply(console, args);
logToDebug('log', ...args);
};
console.error = function(...args) {
originalError.apply(console, args);
logToDebug('error', ...args);
};
console.warn = function(...args) {
originalWarn.apply(console, args);
logToDebug('warn', ...args);
};
function updateConsoleOutput() {
document.getElementById('console-output').textContent = consoleMessages.join('\n');
}
// Test server connectivity
async function testServer() {
try {
const response = await fetch('http://localhost:3030/api/config');
if (response.ok) {
document.getElementById('server-status').textContent = '✅ Backend server (port 3030) - OK';
document.getElementById('server-status').className = 'status success';
} else {
throw new Error(`HTTP ${response.status}`);
}
} catch (error) {
document.getElementById('server-status').textContent = `❌ Backend server (port 3030) - ${error.message}`;
document.getElementById('server-status').className = 'status error';
}
try {
const response = await fetch('http://localhost:3026');
if (response.ok) {
document.getElementById('api-status').textContent = '✅ Frontend server (port 3026) - OK';
document.getElementById('api-status').className = 'status success';
} else {
throw new Error(`HTTP ${response.status}`);
}
} catch (error) {
document.getElementById('api-status').textContent = `❌ Frontend server (port 3026) - ${error.message}`;
document.getElementById('api-status').className = 'status error';
}
}
// Test iframe loading
document.getElementById('app-frame').onload = function() {
document.getElementById('app-status').textContent = '✅ Application iframe loaded';
document.getElementById('app-status').className = 'status success';
// Try to check DOM elements in iframe
try {
const iframe = document.getElementById('app-frame');
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const threeContainer = iframeDoc.getElementById('three-container');
const orderBtn = iframeDoc.getElementById('order-btn');
const submitBtn = iframeDoc.getElementById('submit-btn');
const addTextBtn = iframeDoc.getElementById('add-text-btn');
let domStatus = '✅ DOM Elements Found: ';
let missing = [];
if (!threeContainer) missing.push('three-container');
if (!orderBtn) missing.push('order-btn');
if (!submitBtn) missing.push('submit-btn');
if (!addTextBtn) missing.push('add-text-btn');
if (missing.length === 0) {
domStatus += 'All key elements present';
document.getElementById('dom-status').className = 'status success';
} else {
domStatus = `❌ Missing elements: ${missing.join(', ')}`;
document.getElementById('dom-status').className = 'status error';
}
document.getElementById('dom-status').textContent = domStatus;
} catch (error) {
document.getElementById('dom-status').textContent = `⚠️ Cannot access iframe content (CORS/Same-origin policy)`;
document.getElementById('dom-status').className = 'status warning';
}
};
document.getElementById('app-frame').onerror = function() {
document.getElementById('app-status').textContent = '❌ Application failed to load in iframe';
document.getElementById('app-status').className = 'status error';
};
// Initialize tests
testServer();
console.log('🔍 Debug test page initialized');
</script>
</body>
</html>