- Add AIReportSystem.js for detailed AI response capture and report generation - Add AIReportInterface.js UI component for report access and export - Integrate AI reporting into LLMValidator and SmartPreviewOrchestrator - Add missing modules to Application.js configuration (unifiedDRS, smartPreviewOrchestrator) - Create missing content/chapters/sbs.json for book metadata - Enhance Application.js with debug logging for module loading - Add multi-format export capabilities (text, HTML, JSON) - Implement automatic learning insights extraction from AI feedback - Add session management and performance tracking for AI reports 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
652 lines
20 KiB
HTML
652 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>🧪 Class Generator 2.0 - Test Suite</title>
|
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🧪</text></svg>">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
color: #333;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
color: white;
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 2.5em;
|
|
margin-bottom: 10px;
|
|
text-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
|
}
|
|
|
|
.header p {
|
|
font-size: 1.2em;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.test-controls {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 30px;
|
|
margin-bottom: 30px;
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
text-align: center;
|
|
}
|
|
|
|
.test-controls h2 {
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
}
|
|
|
|
.control-buttons {
|
|
display: flex;
|
|
gap: 15px;
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.btn {
|
|
padding: 12px 24px;
|
|
border: none;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
font-size: 1em;
|
|
font-weight: 500;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover:not(:disabled) {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: #6c757d;
|
|
color: white;
|
|
}
|
|
|
|
.btn-secondary:hover:not(:disabled) {
|
|
background: #5a6268;
|
|
}
|
|
|
|
.btn-outline {
|
|
background: transparent;
|
|
border: 2px solid #667eea;
|
|
color: #667eea;
|
|
}
|
|
|
|
.btn-outline:hover:not(:disabled) {
|
|
background: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
.test-status {
|
|
margin-top: 20px;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
background: #f8f9fa;
|
|
border: 2px solid #e9ecef;
|
|
}
|
|
|
|
.test-status.running {
|
|
background: #e3f2fd;
|
|
border-color: #2196f3;
|
|
color: #1976d2;
|
|
}
|
|
|
|
.test-status.success {
|
|
background: #e8f5e8;
|
|
border-color: #4caf50;
|
|
color: #2e7d32;
|
|
}
|
|
|
|
.test-status.failure {
|
|
background: #ffebee;
|
|
border-color: #f44336;
|
|
color: #c62828;
|
|
}
|
|
|
|
.progress-indicator {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.spinner {
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid #f3f3f3;
|
|
border-top: 2px solid #1976d2;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.test-results {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
display: none;
|
|
}
|
|
|
|
.test-results.visible {
|
|
display: block;
|
|
}
|
|
|
|
.info-panel {
|
|
background: linear-gradient(135deg, #fff3e0, #ffe0b2);
|
|
border-left: 4px solid #ff9800;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.info-panel h3 {
|
|
margin-bottom: 15px;
|
|
color: #e65100;
|
|
}
|
|
|
|
.info-panel ul {
|
|
padding-left: 20px;
|
|
color: #bf360c;
|
|
}
|
|
|
|
.info-panel li {
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.architecture-status {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 20px;
|
|
margin-top: 30px;
|
|
}
|
|
|
|
.status-card {
|
|
background: white;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
text-align: center;
|
|
border-left: 4px solid #ddd;
|
|
}
|
|
|
|
.status-card.tested {
|
|
border-left-color: #4caf50;
|
|
}
|
|
|
|
.status-card.not-tested {
|
|
border-left-color: #ff9800;
|
|
}
|
|
|
|
.status-card.failed {
|
|
border-left-color: #f44336;
|
|
}
|
|
|
|
.footer {
|
|
text-align: center;
|
|
color: white;
|
|
margin-top: 40px;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.container {
|
|
padding: 10px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 2em;
|
|
}
|
|
|
|
.control-buttons {
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.btn {
|
|
width: 200px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header class="header">
|
|
<h1>🧪 Class Generator 2.0</h1>
|
|
<p>Comprehensive Test Suite - Architecture & Modules Validation</p>
|
|
</header>
|
|
|
|
<div class="test-controls">
|
|
<h2>Test Execution</h2>
|
|
<div class="control-buttons">
|
|
<button id="runAllTests" class="btn btn-primary">
|
|
<span>🚀</span>
|
|
Run All Tests
|
|
</button>
|
|
<button id="runCoreTests" class="btn btn-outline">
|
|
<span>🏗️</span>
|
|
Core Architecture Only
|
|
</button>
|
|
<button id="runDRSTests" class="btn btn-outline">
|
|
<span>🎮</span>
|
|
DRS Modules Only
|
|
</button>
|
|
<button id="clearResults" class="btn btn-secondary">
|
|
<span>🗑️</span>
|
|
Clear Results
|
|
</button>
|
|
</div>
|
|
|
|
<div id="testStatus" class="test-status" style="display: none;">
|
|
<div class="progress-indicator">
|
|
<div class="spinner"></div>
|
|
<span>Initializing test environment...</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="info-panel">
|
|
<h3>📋 What This Tests</h3>
|
|
<ul>
|
|
<li><strong>Core Architecture:</strong> Module.js, EventBus.js, ModuleLoader.js validation</li>
|
|
<li><strong>DRS Modules:</strong> TextModule, AudioModule, ImageModule, GrammarModule functionality</li>
|
|
<li><strong>Integration:</strong> Module contracts, dependency injection, event communication</li>
|
|
<li><strong>Performance:</strong> Loading times, memory management, execution efficiency</li>
|
|
<li><strong>Quality:</strong> Code architecture adherence and best practices</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="testResults" class="test-results">
|
|
<!-- Test results will be populated here -->
|
|
</div>
|
|
|
|
<div class="architecture-status">
|
|
<div class="status-card not-tested">
|
|
<h3>🏗️ Core Architecture</h3>
|
|
<p>Module system integrity and event communication validation</p>
|
|
<div id="coreStatus">Not Tested</div>
|
|
</div>
|
|
<div class="status-card not-tested">
|
|
<h3>🎮 DRS Modules</h3>
|
|
<p>Exercise modules functionality and interface compliance</p>
|
|
<div id="drsStatus">Not Tested</div>
|
|
</div>
|
|
<div class="status-card not-tested">
|
|
<h3>⚡ Performance</h3>
|
|
<p>Execution speed and memory efficiency metrics</p>
|
|
<div id="perfStatus">Not Tested</div>
|
|
</div>
|
|
<div class="status-card not-tested">
|
|
<h3>🔄 Integration</h3>
|
|
<p>Cross-module communication and dependency management</p>
|
|
<div id="intStatus">Not Tested</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="footer">
|
|
<p>Class Generator 2.0 - Ultra-Modular Educational Platform</p>
|
|
<p>Built with Vanilla JavaScript, ES6 Modules, and Strict Architecture Patterns</p>
|
|
</footer>
|
|
</div>
|
|
|
|
<script type="module">
|
|
import { runAllTests } from './src/testing/runTests.js';
|
|
|
|
// Test execution state
|
|
let currentTestRun = null;
|
|
|
|
// DOM elements
|
|
const runAllBtn = document.getElementById('runAllTests');
|
|
const runCoreBtn = document.getElementById('runCoreTests');
|
|
const runDRSBtn = document.getElementById('runDRSTests');
|
|
const clearBtn = document.getElementById('clearResults');
|
|
const testStatus = document.getElementById('testStatus');
|
|
const testResults = document.getElementById('testResults');
|
|
|
|
// Status cards
|
|
const coreStatus = document.getElementById('coreStatus');
|
|
const drsStatus = document.getElementById('drsStatus');
|
|
const perfStatus = document.getElementById('perfStatus');
|
|
const intStatus = document.getElementById('intStatus');
|
|
|
|
// Button event handlers
|
|
runAllBtn.addEventListener('click', () => executeTests('all'));
|
|
runCoreBtn.addEventListener('click', () => executeTests('core'));
|
|
runDRSBtn.addEventListener('click', () => executeTests('drs'));
|
|
clearBtn.addEventListener('click', clearResults);
|
|
|
|
/**
|
|
* Execute tests with progress tracking
|
|
*/
|
|
async function executeTests(testType = 'all') {
|
|
if (currentTestRun) {
|
|
alert('Tests are already running. Please wait for completion.');
|
|
return;
|
|
}
|
|
|
|
// Show progress
|
|
showTestProgress('Initializing test environment...');
|
|
|
|
// Disable buttons
|
|
setButtonsDisabled(true);
|
|
|
|
try {
|
|
currentTestRun = true;
|
|
|
|
// Update progress
|
|
updateTestProgress('Loading test modules...');
|
|
|
|
// Run tests
|
|
const results = await runAllTests(testResults);
|
|
|
|
// Update status cards
|
|
updateStatusCards(results);
|
|
|
|
// Show results
|
|
showTestResults(results);
|
|
|
|
// Update progress
|
|
updateTestProgress(
|
|
results.summary.success
|
|
? '✅ All tests completed successfully!'
|
|
: '⚠️ Tests completed with some failures',
|
|
results.summary.success ? 'success' : 'failure'
|
|
);
|
|
|
|
} catch (error) {
|
|
console.error('Test execution failed:', error);
|
|
updateTestProgress(`❌ Test execution failed: ${error.message}`, 'failure');
|
|
|
|
// Show error in results
|
|
testResults.innerHTML = `
|
|
<div class="error-report">
|
|
<h2>❌ Test Execution Error</h2>
|
|
<div class="error-details">
|
|
<p><strong>Error:</strong> ${error.message}</p>
|
|
<pre>${error.stack}</pre>
|
|
</div>
|
|
<div class="error-actions">
|
|
<button onclick="location.reload()" class="btn btn-primary">🔄 Reload Page</button>
|
|
<button onclick="window.open('browser-console', '_blank')" class="btn btn-outline">🔍 Open Browser Console</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
testResults.classList.add('visible');
|
|
} finally {
|
|
currentTestRun = null;
|
|
setButtonsDisabled(false);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Show test progress indicator
|
|
*/
|
|
function showTestProgress(message, status = 'running') {
|
|
testStatus.style.display = 'block';
|
|
testStatus.className = `test-status ${status}`;
|
|
|
|
if (status === 'running') {
|
|
testStatus.innerHTML = `
|
|
<div class="progress-indicator">
|
|
<div class="spinner"></div>
|
|
<span>${message}</span>
|
|
</div>
|
|
`;
|
|
} else {
|
|
testStatus.innerHTML = `
|
|
<div class="progress-indicator">
|
|
<span>${message}</span>
|
|
</div>
|
|
`;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Update test progress message
|
|
*/
|
|
function updateTestProgress(message, status = 'running') {
|
|
if (status === 'running') {
|
|
testStatus.querySelector('span').textContent = message;
|
|
} else {
|
|
showTestProgress(message, status);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Show test results
|
|
*/
|
|
function showTestResults(results) {
|
|
testResults.classList.add('visible');
|
|
|
|
// Results are already rendered by the test framework
|
|
// Just ensure visibility and add any additional info
|
|
|
|
const summaryDiv = document.createElement('div');
|
|
summaryDiv.className = 'execution-summary';
|
|
summaryDiv.innerHTML = `
|
|
<div class="summary-header">
|
|
<h2>📊 Execution Summary</h2>
|
|
<p>Completed at ${new Date().toLocaleString()}</p>
|
|
</div>
|
|
<div class="quick-stats">
|
|
<div class="stat">
|
|
<strong>${results.overall.totalTests}</strong> Total Tests
|
|
</div>
|
|
<div class="stat">
|
|
<strong>${results.overall.duration}ms</strong> Total Duration
|
|
</div>
|
|
<div class="stat">
|
|
<strong>${Math.round((results.overall.passedTests / results.overall.totalTests) * 100)}%</strong> Pass Rate
|
|
</div>
|
|
</div>
|
|
`;
|
|
|
|
testResults.insertBefore(summaryDiv, testResults.firstChild);
|
|
}
|
|
|
|
/**
|
|
* Update status cards based on test results
|
|
*/
|
|
function updateStatusCards(results) {
|
|
const coreTests = results.suites.find(s => s.suiteName.includes('Core'));
|
|
const drsTests = results.suites.find(s => s.suiteName.includes('DRS'));
|
|
|
|
// Core Architecture Status
|
|
if (coreTests) {
|
|
const coreCard = coreStatus.parentElement;
|
|
if (coreTests.success) {
|
|
coreCard.className = 'status-card tested';
|
|
coreStatus.innerHTML = '✅ All Tests Passed';
|
|
} else {
|
|
coreCard.className = 'status-card failed';
|
|
coreStatus.innerHTML = '❌ Issues Detected';
|
|
}
|
|
}
|
|
|
|
// DRS Modules Status
|
|
if (drsTests) {
|
|
const drsCard = drsStatus.parentElement;
|
|
if (drsTests.success) {
|
|
drsCard.className = 'status-card tested';
|
|
drsStatus.innerHTML = '✅ All Tests Passed';
|
|
} else {
|
|
drsCard.className = 'status-card failed';
|
|
drsStatus.innerHTML = '❌ Issues Detected';
|
|
}
|
|
}
|
|
|
|
// Performance Status
|
|
const perfCard = perfStatus.parentElement;
|
|
if (results.overall.duration < 5000) {
|
|
perfCard.className = 'status-card tested';
|
|
perfStatus.innerHTML = '✅ Excellent Performance';
|
|
} else if (results.overall.duration < 15000) {
|
|
perfCard.className = 'status-card tested';
|
|
perfStatus.innerHTML = '⚠️ Acceptable Performance';
|
|
} else {
|
|
perfCard.className = 'status-card failed';
|
|
perfStatus.innerHTML = '❌ Poor Performance';
|
|
}
|
|
|
|
// Integration Status (based on overall results)
|
|
const intCard = intStatus.parentElement;
|
|
if (results.summary.success) {
|
|
intCard.className = 'status-card tested';
|
|
intStatus.innerHTML = '✅ Well Integrated';
|
|
} else {
|
|
intCard.className = 'status-card failed';
|
|
intStatus.innerHTML = '❌ Integration Issues';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Clear test results
|
|
*/
|
|
function clearResults() {
|
|
testResults.classList.remove('visible');
|
|
testResults.innerHTML = '';
|
|
testStatus.style.display = 'none';
|
|
|
|
// Reset status cards
|
|
document.querySelectorAll('.status-card').forEach(card => {
|
|
card.className = 'status-card not-tested';
|
|
});
|
|
coreStatus.textContent = 'Not Tested';
|
|
drsStatus.textContent = 'Not Tested';
|
|
perfStatus.textContent = 'Not Tested';
|
|
intStatus.textContent = 'Not Tested';
|
|
}
|
|
|
|
/**
|
|
* Enable/disable control buttons
|
|
*/
|
|
function setButtonsDisabled(disabled) {
|
|
runAllBtn.disabled = disabled;
|
|
runCoreBtn.disabled = disabled;
|
|
runDRSBtn.disabled = disabled;
|
|
clearBtn.disabled = disabled;
|
|
}
|
|
|
|
// Add execution summary styles
|
|
const additionalStyles = document.createElement('style');
|
|
additionalStyles.textContent = `
|
|
.execution-summary {
|
|
background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
|
|
border: 2px solid #4caf50;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.summary-header {
|
|
text-align: center;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.summary-header h2 {
|
|
margin-bottom: 5px;
|
|
color: #2e7d32;
|
|
}
|
|
|
|
.quick-stats {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
flex-wrap: wrap;
|
|
gap: 15px;
|
|
}
|
|
|
|
.stat {
|
|
text-align: center;
|
|
}
|
|
|
|
.stat strong {
|
|
display: block;
|
|
font-size: 1.5em;
|
|
color: #1b5e20;
|
|
}
|
|
|
|
.error-report {
|
|
background: #ffebee;
|
|
border: 2px solid #f44336;
|
|
border-radius: 8px;
|
|
padding: 30px;
|
|
text-align: center;
|
|
}
|
|
|
|
.error-report h2 {
|
|
color: #c62828;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.error-details {
|
|
background: white;
|
|
border-radius: 4px;
|
|
padding: 20px;
|
|
margin: 20px 0;
|
|
text-align: left;
|
|
}
|
|
|
|
.error-details pre {
|
|
background: #f5f5f5;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
overflow-x: auto;
|
|
font-size: 0.85em;
|
|
max-height: 200px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.error-actions {
|
|
display: flex;
|
|
gap: 15px;
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
`;
|
|
document.head.appendChild(additionalStyles);
|
|
|
|
// Show welcome message
|
|
console.log('🧪 Class Generator 2.0 Test Suite loaded');
|
|
console.log('Click "Run All Tests" to validate the architecture and modules');
|
|
</script>
|
|
</body>
|
|
</html> |