-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdebug-assessment-report.html
More file actions
320 lines (288 loc) · 9.42 KB
/
debug-assessment-report.html
File metadata and controls
320 lines (288 loc) · 9.42 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Assessment Report - Debug Console</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f5f5f5;
}
.debug-panel {
background: white;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.test-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.test-card {
background: white;
padding: 15px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.test-btn {
background: #007bff;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
width: 100%;
margin-top: 10px;
}
.test-btn:hover {
background: #0056b3;
}
.status {
padding: 10px;
margin: 10px 0;
border-radius: 5px;
}
.status.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.status.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.status.warning {
background: #fff3cd;
color: #856404;
border: 1px solid #ffeaa7;
}
.log-output {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 5px;
padding: 15px;
height: 200px;
overflow-y: auto;
font-family: monospace;
font-size: 12px;
}
</style>
</head>
<body>
<h1>Assessment Report - Functionality Check</h1>
<div class="debug-panel">
<h3>System Status</h3>
<div id="system-status"></div>
<button class="test-btn" onclick="runSystemCheck()">
Run System Check
</button>
</div>
<div class="test-grid">
<div class="test-card">
<h4>Firebase Connection</h4>
<p>Test Firebase authentication and database connection</p>
<button class="test-btn" onclick="testFirebaseConnection()">
Test Connection
</button>
<div id="firebase-status"></div>
</div>
<div class="test-card">
<h4>Authentication Check</h4>
<p>Check if user authentication is working</p>
<button class="test-btn" onclick="testAuthentication()">
Test Auth
</button>
<div id="auth-status"></div>
</div>
<div class="test-card">
<h4>Data Fetching</h4>
<p>Test data retrieval from Firestore</p>
<button class="test-btn" onclick="testDataFetching()">
Test Data Fetch
</button>
<div id="data-status"></div>
</div>
<div class="test-card">
<h4>UI Components</h4>
<p>Test user interface components</p>
<button class="test-btn" onclick="testUIComponents()">Test UI</button>
<div id="ui-status"></div>
</div>
<div class="test-card">
<h4>Error Handling</h4>
<p>Test error scenarios and recovery</p>
<button class="test-btn" onclick="testErrorHandling()">
Test Errors
</button>
<div id="error-status"></div>
</div>
<div class="test-card">
<h4>Network Issues</h4>
<p>Simulate network problems</p>
<button class="test-btn" onclick="testNetworkIssues()">
Test Network
</button>
<div id="network-status"></div>
</div>
</div>
<div class="debug-panel">
<h3>Console Log</h3>
<div id="log-output" class="log-output"></div>
<button class="test-btn" onclick="clearLog()">Clear Log</button>
</div>
<script>
// Capture console logs
const originalLog = console.log;
const originalError = console.error;
const originalWarn = console.warn;
function logToOutput(message, type = "log") {
const logOutput = document.getElementById("log-output");
const timestamp = new Date().toLocaleTimeString();
const logEntry = document.createElement("div");
logEntry.style.color =
type === "error" ? "red" : type === "warn" ? "orange" : "black";
logEntry.textContent = `[${timestamp}] ${type.toUpperCase()}: ${message}`;
logOutput.appendChild(logEntry);
logOutput.scrollTop = logOutput.scrollHeight;
}
console.log = function (...args) {
originalLog.apply(console, args);
logToOutput(args.join(" "), "log");
};
console.error = function (...args) {
originalError.apply(console, args);
logToOutput(args.join(" "), "error");
};
console.warn = function (...args) {
originalWarn.apply(console, args);
logToOutput(args.join(" "), "warn");
};
function setStatus(elementId, message, type) {
const element = document.getElementById(elementId);
if (element) {
element.innerHTML = `<div class="status ${type}">${message}</div>`;
}
}
function runSystemCheck() {
logToOutput("Starting system check...", "log");
// Check if required elements exist
const checks = [
{ name: "Assessment Report Container", id: "assessment-report" },
{ name: "No Results Message", id: "no-results-message" },
];
let allPassed = true;
let results = [];
checks.forEach((check) => {
const element = document.getElementById(check.id);
const passed = element !== null;
allPassed = allPassed && passed;
results.push(`${check.name}: ${passed ? "✓ PASS" : "✗ FAIL"}`);
logToOutput(
`${check.name}: ${passed ? "Found" : "Missing"}`,
passed ? "log" : "error"
);
});
const statusElement = document.getElementById("system-status");
statusElement.innerHTML = `
<div class="status ${allPassed ? "success" : "error"}">
<strong>System Check ${
allPassed ? "PASSED" : "FAILED"
}</strong><br>
${results.join("<br>")}
</div>
`;
}
function testFirebaseConnection() {
logToOutput("Testing Firebase connection...", "log");
try {
// Check if Firebase modules are loaded
const hasFirebaseApp =
typeof window.firebase !== "undefined" ||
typeof initializeApp !== "undefined";
const hasAuth = typeof getAuth !== "undefined";
const hasFirestore = typeof getFirestore !== "undefined";
if (hasFirebaseApp && hasAuth && hasFirestore) {
setStatus(
"firebase-status",
"Firebase modules loaded successfully ✓",
"success"
);
logToOutput("Firebase modules are available", "log");
} else {
setStatus(
"firebase-status",
"Firebase modules not loaded ✗",
"error"
);
logToOutput("Firebase modules missing", "error");
}
} catch (error) {
setStatus(
"firebase-status",
`Firebase error: ${error.message}`,
"error"
);
logToOutput(`Firebase connection error: ${error.message}`, "error");
}
}
function testAuthentication() {
logToOutput("Testing authentication...", "log");
setStatus(
"auth-status",
"Auth test simulated (requires Firebase) ⚠️",
"warning"
);
}
function testDataFetching() {
logToOutput("Testing data fetching...", "log");
setStatus(
"data-status",
"Data fetch test simulated (requires Firebase) ⚠️",
"warning"
);
}
function testUIComponents() {
logToOutput("Testing UI components...", "log");
const reportContainer = document.getElementById("assessment-report");
const noResultsMessage = document.getElementById("no-results-message");
if (reportContainer && noResultsMessage) {
setStatus("ui-status", "All UI components found ✓", "success");
logToOutput("UI components test passed", "log");
} else {
setStatus("ui-status", "Some UI components missing ✗", "error");
logToOutput("UI components test failed", "error");
}
}
function testErrorHandling() {
logToOutput("Testing error handling...", "log");
try {
// Simulate an error
throw new Error("Test error for error handling");
} catch (error) {
setStatus("error-status", "Error handling working ✓", "success");
logToOutput(`Caught test error: ${error.message}`, "log");
}
}
function testNetworkIssues() {
logToOutput("Simulating network issues...", "log");
setStatus(
"network-status",
"Network simulation completed ⚠️",
"warning"
);
}
function clearLog() {
document.getElementById("log-output").innerHTML = "";
}
// Run initial system check
setTimeout(runSystemCheck, 1000);
</script>
</body>
</html>