- Add .gitignore to exclude node_modules, dist, logs, and system files - Add comprehensive project documentation including README, deployment guide, and development setup - Add .kiro project specifications for amazon-product-bar-extension, appwrite-cloud-storage, appwrite-userid-repair, blacklist-feature, and enhanced-item-management - Add .kiro steering documents for product, structure, styling, and tech guidelines - Add VSCode settings configuration for consistent development environment - Add manifest.json and babel/vite configuration for extension build setup - Add complete source code implementation including AppWrite integration, storage managers, UI components, and services - Add comprehensive test suite with Jest configuration and 30+ test files covering all major modules - Add test HTML files for integration testing and validation - Add coverage reports and build validation scripts - Add AppWrite setup and repair documentation for database schema management - Add migration guides and responsive accessibility implementation documentation - Establish foundation for Amazon product bar extension with full feature set including blacklist management, enhanced item workflows, and real-time synchronization
378 lines
14 KiB
HTML
378 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Exact Error Reproduction Test</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 20px;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: #f5f5f5;
|
|
}
|
|
|
|
.test-container {
|
|
max-width: 1000px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 2rem;
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.workflow-status {
|
|
background: #f8f9fa;
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
margin: 1rem 0;
|
|
font-family: monospace;
|
|
}
|
|
|
|
.step {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0.5rem;
|
|
margin: 0.25rem 0;
|
|
}
|
|
|
|
.step-icon {
|
|
margin-right: 0.5rem;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.step.completed {
|
|
color: #28a745;
|
|
}
|
|
|
|
.step.active {
|
|
color: #ffc107;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.step.error {
|
|
color: #dc3545;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.error-details {
|
|
background: #f8d7da;
|
|
border: 1px solid #f5c6cb;
|
|
color: #721c24;
|
|
padding: 1rem;
|
|
border-radius: 6px;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.success-details {
|
|
background: #d4edda;
|
|
border: 1px solid #c3e6cb;
|
|
color: #155724;
|
|
padding: 1rem;
|
|
border-radius: 6px;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.test-button {
|
|
background: #ff9900;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 24px;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
margin: 0.5rem;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.test-button:hover {
|
|
background: #ff7700;
|
|
}
|
|
|
|
.workflow-container {
|
|
border: 2px solid #007bff;
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
margin: 1rem 0;
|
|
min-height: 200px;
|
|
background: white;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="test-container">
|
|
<h1>🔍 Exact Error Reproduction Test</h1>
|
|
|
|
<div class="error-details">
|
|
<strong>Reproduzierter Fehler:</strong> "Unerwarteter Fehler beim Erstellen des Enhanced Items"<br>
|
|
<strong>Schritt:</strong> ✏️ Titel auswählen... ❌<br>
|
|
<strong>Kontext:</strong> Enhanced Item Workflow bricht im Titel-Auswahl-Schritt ab
|
|
</div>
|
|
|
|
<button class="test-button" onclick="reproduceExactError()">🔄 Reproduce Exact Error</button>
|
|
<button class="test-button" onclick="testWithFixes()">✅ Test With Fixes</button>
|
|
<button class="test-button" onclick="clearTest()">Clear</button>
|
|
|
|
<div class="workflow-status" id="workflowStatus">
|
|
<h4>Workflow Status</h4>
|
|
<div id="statusSteps">
|
|
<div class="step" id="step-validate">
|
|
<span class="step-icon">🔍</span>
|
|
<span>URL validieren...</span>
|
|
</div>
|
|
<div class="step" id="step-extract">
|
|
<span class="step-icon">📦</span>
|
|
<span>Produktdaten extrahieren...</span>
|
|
</div>
|
|
<div class="step" id="step-ai">
|
|
<span class="step-icon">🤖</span>
|
|
<span>KI-Titelvorschläge generieren...</span>
|
|
</div>
|
|
<div class="step" id="step-select">
|
|
<span class="step-icon">✏️</span>
|
|
<span>Titel auswählen...</span>
|
|
</div>
|
|
<div class="step" id="step-save">
|
|
<span class="step-icon">💾</span>
|
|
<span>Item speichern...</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="workflow-container" id="workflowContainer">
|
|
<h4>Workflow Execution Area</h4>
|
|
<p>Klicken Sie auf einen Test-Button, um zu beginnen...</p>
|
|
</div>
|
|
|
|
<div id="resultContainer"></div>
|
|
</div>
|
|
|
|
<script type="module">
|
|
// Mock environment setup
|
|
const mockStorage = {
|
|
data: {},
|
|
getItem(key) { return this.data[key] || null; },
|
|
setItem(key, value) { this.data[key] = value; },
|
|
removeItem(key) { delete this.data[key]; },
|
|
clear() { this.data = {}; }
|
|
};
|
|
|
|
if (typeof localStorage === 'undefined') {
|
|
window.localStorage = mockStorage;
|
|
}
|
|
|
|
// Mock event bus
|
|
window.amazonExtEventBus = {
|
|
events: {},
|
|
emit(event, data) { console.log('Event:', event, data); },
|
|
on(event, callback) { }
|
|
};
|
|
|
|
// Load modules
|
|
let TitleSelectionManager, EnhancedAddItemWorkflow;
|
|
|
|
async function loadModules() {
|
|
try {
|
|
const titleModule = await import('./src/TitleSelectionManager.js');
|
|
TitleSelectionManager = titleModule.TitleSelectionManager;
|
|
|
|
const workflowModule = await import('./src/EnhancedAddItemWorkflow.js');
|
|
EnhancedAddItemWorkflow = workflowModule.EnhancedAddItemWorkflow;
|
|
|
|
console.log('✅ Modules loaded successfully');
|
|
return true;
|
|
} catch (error) {
|
|
console.error('❌ Failed to load modules:', error);
|
|
showResult('❌ Failed to load modules: ' + error.message, 'error');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function updateStepStatus(stepId, status) {
|
|
const step = document.getElementById(`step-${stepId}`);
|
|
if (step) {
|
|
step.className = `step ${status}`;
|
|
if (status === 'completed') {
|
|
step.innerHTML = step.innerHTML.replace('...', ' ✅');
|
|
} else if (status === 'error') {
|
|
step.innerHTML = step.innerHTML.replace('...', ' ❌');
|
|
} else if (status === 'active') {
|
|
step.innerHTML = step.innerHTML.replace('...', ' ⏳');
|
|
}
|
|
}
|
|
}
|
|
|
|
function resetSteps() {
|
|
const steps = ['validate', 'extract', 'ai', 'select', 'save'];
|
|
steps.forEach(stepId => {
|
|
const step = document.getElementById(`step-${stepId}`);
|
|
if (step) {
|
|
step.className = 'step';
|
|
step.innerHTML = step.innerHTML.replace(/ [✅❌⏳]/, '...');
|
|
}
|
|
});
|
|
}
|
|
|
|
function showResult(message, type) {
|
|
const resultContainer = document.getElementById('resultContainer');
|
|
const resultDiv = document.createElement('div');
|
|
resultDiv.className = type === 'error' ? 'error-details' : 'success-details';
|
|
resultDiv.innerHTML = `<strong>Result:</strong> ${message}`;
|
|
resultContainer.appendChild(resultDiv);
|
|
}
|
|
|
|
// Simulate the exact error scenario
|
|
window.reproduceExactError = async function() {
|
|
console.log('=== Reproducing Exact Error Scenario ===');
|
|
resetSteps();
|
|
document.getElementById('resultContainer').innerHTML = '';
|
|
|
|
const container = document.getElementById('workflowContainer');
|
|
container.innerHTML = '<h4>🔄 Reproducing Original Error...</h4>';
|
|
|
|
try {
|
|
// Step 1: URL validation ✅
|
|
updateStepStatus('validate', 'active');
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
updateStepStatus('validate', 'completed');
|
|
|
|
// Step 2: Product extraction ✅
|
|
updateStepStatus('extract', 'active');
|
|
await new Promise(resolve => setTimeout(resolve, 800));
|
|
updateStepStatus('extract', 'completed');
|
|
|
|
// Step 3: AI generation ✅
|
|
updateStepStatus('ai', 'active');
|
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
updateStepStatus('ai', 'completed');
|
|
|
|
// Step 4: Title selection ❌ (This is where the original error occurred)
|
|
updateStepStatus('select', 'active');
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
|
|
// Simulate the original error conditions
|
|
const titleManager = new TitleSelectionManager();
|
|
|
|
// Create a scenario that would have caused the original error
|
|
// (before our fixes were implemented)
|
|
|
|
// 1. Try to use InteractivityEnhancer without proper error handling
|
|
if (titleManager.interactivityEnhancer) {
|
|
// This would have failed in the original code
|
|
console.log('InteractivityEnhancer available - this should work now');
|
|
} else {
|
|
console.log('InteractivityEnhancer not available - graceful fallback');
|
|
}
|
|
|
|
// 2. Create title selection UI
|
|
const suggestions = [
|
|
'ROCKBROS Fahrradhandschuhe - Premium Qualität',
|
|
'Hochwertige Fahrradhandschuhe von ROCKBROS',
|
|
'ROCKBROS Handschuhe für Radfahrer'
|
|
];
|
|
const originalTitle = 'ROCKBROS Fahrradhandschuhe Herren Damen Halbfinger MTB Handschuhe';
|
|
|
|
const selectionUI = titleManager.createSelectionUI(suggestions, originalTitle);
|
|
container.appendChild(selectionUI);
|
|
|
|
// 3. Show title selection (this would have failed before)
|
|
titleManager.showTitleSelection(selectionUI);
|
|
|
|
// 4. Set up callback
|
|
titleManager.onTitleSelected((selectedTitle) => {
|
|
console.log('✅ Title selected successfully:', selectedTitle);
|
|
updateStepStatus('select', 'completed');
|
|
updateStepStatus('save', 'completed');
|
|
showResult('✅ Error reproduction test PASSED - the fixes work!', 'success');
|
|
});
|
|
|
|
// Auto-select first option after 2 seconds to complete the test
|
|
setTimeout(() => {
|
|
if (titleManager.titleOptions && titleManager.titleOptions.length > 0) {
|
|
titleManager.selectTitle(0);
|
|
titleManager.confirmSelection();
|
|
}
|
|
}, 2000);
|
|
|
|
console.log('✅ Title selection step completed without errors');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Error in reproduction test:', error);
|
|
updateStepStatus('select', 'error');
|
|
showResult(`❌ Error still occurs: ${error.message}`, 'error');
|
|
}
|
|
};
|
|
|
|
// Test with all fixes applied
|
|
window.testWithFixes = async function() {
|
|
console.log('=== Testing With All Fixes Applied ===');
|
|
resetSteps();
|
|
document.getElementById('resultContainer').innerHTML = '';
|
|
|
|
const container = document.getElementById('workflowContainer');
|
|
container.innerHTML = '<h4>✅ Testing With Fixes...</h4>';
|
|
|
|
try {
|
|
// Create workflow with all error handling
|
|
const workflow = new EnhancedAddItemWorkflow();
|
|
|
|
// Set up all callbacks
|
|
workflow.onProgress((progress) => {
|
|
console.log('Progress:', progress);
|
|
updateStepStatus(progress.stepId, progress.status);
|
|
});
|
|
|
|
workflow.onComplete((result) => {
|
|
console.log('✅ Workflow completed:', result);
|
|
showResult('✅ Complete workflow test PASSED!', 'success');
|
|
});
|
|
|
|
workflow.onError((error) => {
|
|
console.log('❌ Workflow error:', error);
|
|
showResult(`❌ Workflow error: ${error.error}`, 'error');
|
|
});
|
|
|
|
workflow.onManualInput((result) => {
|
|
console.log('⚠️ Manual input required:', result);
|
|
showResult('⚠️ Manual input required - this is expected behavior', 'success');
|
|
});
|
|
|
|
// Test with a mock URL that will trigger the title selection step
|
|
const testUrl = 'https://www.amazon.de/dp/B08TESTITEM';
|
|
|
|
console.log('Starting workflow with comprehensive error handling...');
|
|
|
|
// This should work without throwing "Unerwarteter Fehler"
|
|
const result = await workflow.startWorkflow(testUrl, {
|
|
container: container,
|
|
allowManualFallback: true,
|
|
settings: {
|
|
mistralApiKey: null, // No API key to test fallback
|
|
timeoutSeconds: 5
|
|
}
|
|
});
|
|
|
|
console.log('Workflow result:', result);
|
|
|
|
} catch (error) {
|
|
console.error('❌ Test with fixes failed:', error);
|
|
showResult(`❌ Test failed: ${error.message}`, 'error');
|
|
}
|
|
};
|
|
|
|
window.clearTest = function() {
|
|
resetSteps();
|
|
document.getElementById('workflowContainer').innerHTML = '<h4>Workflow Execution Area</h4><p>Klicken Sie auf einen Test-Button, um zu beginnen...</p>';
|
|
document.getElementById('resultContainer').innerHTML = '';
|
|
console.clear();
|
|
};
|
|
|
|
// Initialize
|
|
loadModules().then(success => {
|
|
if (success) {
|
|
console.log('🔍 Exact Error Reproduction Test ready');
|
|
showResult('🔍 Test environment ready - modules loaded successfully', 'success');
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |