- 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
377 lines
15 KiB
HTML
377 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>AppWrite Authentication & Migration Checkpoint Test</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
.test-section {
|
|
background: white;
|
|
padding: 20px;
|
|
margin: 20px 0;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
.status {
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
border-radius: 4px;
|
|
}
|
|
.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
|
|
.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
|
|
.info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
|
|
button {
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
margin: 5px;
|
|
}
|
|
button:hover { background-color: #0056b3; }
|
|
button:disabled { background-color: #6c757d; cursor: not-allowed; }
|
|
.log {
|
|
background-color: #f8f9fa;
|
|
border: 1px solid #dee2e6;
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
border-radius: 4px;
|
|
font-family: monospace;
|
|
font-size: 12px;
|
|
max-height: 200px;
|
|
overflow-y: auto;
|
|
}
|
|
input {
|
|
width: 100%;
|
|
padding: 8px;
|
|
margin: 5px 0;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🔍 AppWrite Authentication & Migration Checkpoint</h1>
|
|
<p>Dieses Tool testet die Authentifizierung und Migration Foundation für die AppWrite Integration.</p>
|
|
|
|
<!-- Authentication Test Section -->
|
|
<div class="test-section">
|
|
<h2>🔐 Authentication Test</h2>
|
|
<div id="auth-status" class="status info">
|
|
Status: Nicht getestet
|
|
</div>
|
|
|
|
<div>
|
|
<input type="email" id="email" placeholder="E-Mail Adresse" value="test@example.com">
|
|
<input type="password" id="password" placeholder="Passwort" value="testpassword123">
|
|
<button onclick="testLogin()">Login testen</button>
|
|
<button onclick="testLogout()" id="logout-btn" disabled>Logout testen</button>
|
|
</div>
|
|
|
|
<div id="auth-log" class="log"></div>
|
|
</div>
|
|
|
|
<!-- Migration Test Section -->
|
|
<div class="test-section">
|
|
<h2>📦 Migration Test</h2>
|
|
<div id="migration-status" class="status info">
|
|
Status: Nicht getestet
|
|
</div>
|
|
|
|
<div>
|
|
<button onclick="setupTestData()">Test-Daten erstellen</button>
|
|
<button onclick="testMigration()" id="migrate-btn" disabled>Migration testen</button>
|
|
<button onclick="clearTestData()">Test-Daten löschen</button>
|
|
</div>
|
|
|
|
<div id="migration-log" class="log"></div>
|
|
</div>
|
|
|
|
<!-- Overall Status -->
|
|
<div class="test-section">
|
|
<h2>📊 Gesamtstatus</h2>
|
|
<div id="overall-status" class="status info">
|
|
Bereit für Tests
|
|
</div>
|
|
<div id="test-results"></div>
|
|
</div>
|
|
|
|
<script type="module">
|
|
// Import the modules we need to test
|
|
import { AuthService } from './src/AuthService.js';
|
|
import { MigrationService } from './src/MigrationService.js';
|
|
import { AppWriteManager } from './src/AppWriteManager.js';
|
|
import { APPWRITE_CONFIG } from './src/AppWriteConfig.js';
|
|
|
|
// Global variables for testing
|
|
let authService;
|
|
let migrationService;
|
|
let appWriteManager;
|
|
let testResults = {
|
|
authentication: false,
|
|
migration: false
|
|
};
|
|
|
|
// Initialize services
|
|
function initializeServices() {
|
|
try {
|
|
appWriteManager = new AppWriteManager(APPWRITE_CONFIG);
|
|
authService = new AuthService();
|
|
migrationService = new MigrationService(appWriteManager);
|
|
|
|
log('auth', '✅ Services initialized successfully');
|
|
return true;
|
|
} catch (error) {
|
|
log('auth', `❌ Failed to initialize services: ${error.message}`);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Logging helper
|
|
function log(section, message) {
|
|
const logElement = document.getElementById(`${section}-log`);
|
|
const timestamp = new Date().toLocaleTimeString();
|
|
logElement.innerHTML += `[${timestamp}] ${message}\n`;
|
|
logElement.scrollTop = logElement.scrollHeight;
|
|
}
|
|
|
|
function updateStatus(section, message, type = 'info') {
|
|
const statusElement = document.getElementById(`${section}-status`);
|
|
statusElement.className = `status ${type}`;
|
|
statusElement.textContent = message;
|
|
}
|
|
|
|
// Test Authentication
|
|
window.testLogin = async function() {
|
|
const email = document.getElementById('email').value;
|
|
const password = document.getElementById('password').value;
|
|
|
|
if (!email || !password) {
|
|
updateStatus('auth', 'Bitte E-Mail und Passwort eingeben', 'error');
|
|
return;
|
|
}
|
|
|
|
try {
|
|
updateStatus('auth', 'Login wird getestet...', 'info');
|
|
log('auth', `🔄 Attempting login for: ${email}`);
|
|
|
|
// Initialize services if not done
|
|
if (!authService && !initializeServices()) {
|
|
return;
|
|
}
|
|
|
|
const result = await authService.login(email, password);
|
|
|
|
if (result.success) {
|
|
updateStatus('auth', '✅ Login erfolgreich!', 'success');
|
|
log('auth', `✅ Login successful for user: ${result.user?.email || email}`);
|
|
log('auth', `📋 User ID: ${result.user?.$id || 'N/A'}`);
|
|
|
|
document.getElementById('logout-btn').disabled = false;
|
|
document.getElementById('migrate-btn').disabled = false;
|
|
testResults.authentication = true;
|
|
updateOverallStatus();
|
|
} else {
|
|
updateStatus('auth', `❌ Login fehlgeschlagen: ${result.error?.germanMessage || result.error?.message}`, 'error');
|
|
log('auth', `❌ Login failed: ${result.error?.message}`);
|
|
testResults.authentication = false;
|
|
}
|
|
} catch (error) {
|
|
updateStatus('auth', `❌ Login Fehler: ${error.message}`, 'error');
|
|
log('auth', `❌ Login error: ${error.message}`);
|
|
testResults.authentication = false;
|
|
}
|
|
};
|
|
|
|
// Test Logout
|
|
window.testLogout = async function() {
|
|
try {
|
|
updateStatus('auth', 'Logout wird getestet...', 'info');
|
|
log('auth', '🔄 Attempting logout...');
|
|
|
|
const result = await authService.logout();
|
|
|
|
if (result.success) {
|
|
updateStatus('auth', '✅ Logout erfolgreich!', 'success');
|
|
log('auth', '✅ Logout successful');
|
|
|
|
document.getElementById('logout-btn').disabled = true;
|
|
document.getElementById('migrate-btn').disabled = true;
|
|
} else {
|
|
updateStatus('auth', `❌ Logout fehlgeschlagen: ${result.error?.message}`, 'error');
|
|
log('auth', `❌ Logout failed: ${result.error?.message}`);
|
|
}
|
|
} catch (error) {
|
|
updateStatus('auth', `❌ Logout Fehler: ${error.message}`, 'error');
|
|
log('auth', `❌ Logout error: ${error.message}`);
|
|
}
|
|
};
|
|
|
|
// Setup test data in localStorage
|
|
window.setupTestData = function() {
|
|
try {
|
|
// Create sample enhanced items
|
|
const enhancedItems = [
|
|
{
|
|
id: 'test-item-1',
|
|
amazonUrl: 'https://amazon.de/dp/test-item-1',
|
|
originalTitle: 'Test Product 1',
|
|
customTitle: 'Enhanced Test Product 1',
|
|
price: '29.99',
|
|
currency: 'EUR',
|
|
createdAt: new Date().toISOString()
|
|
},
|
|
{
|
|
id: 'test-item-2',
|
|
amazonUrl: 'https://amazon.de/dp/test-item-2',
|
|
originalTitle: 'Test Product 2',
|
|
customTitle: 'Enhanced Test Product 2',
|
|
price: '49.99',
|
|
currency: 'EUR',
|
|
createdAt: new Date().toISOString()
|
|
}
|
|
];
|
|
|
|
// Create sample blacklisted brands
|
|
const blacklistedBrands = [
|
|
{
|
|
id: 'test-brand-1',
|
|
name: 'Test Brand 1',
|
|
addedAt: new Date().toISOString()
|
|
},
|
|
{
|
|
id: 'test-brand-2',
|
|
name: 'Test Brand 2',
|
|
addedAt: new Date().toISOString()
|
|
}
|
|
];
|
|
|
|
// Create sample settings
|
|
const settings = {
|
|
mistralApiKey: 'test-api-key-12345',
|
|
autoExtractEnabled: false,
|
|
defaultTitleSelection: 'original',
|
|
maxRetries: 5,
|
|
timeoutSeconds: 15,
|
|
updatedAt: new Date().toISOString()
|
|
};
|
|
|
|
// Store in localStorage
|
|
localStorage.setItem('amazon-ext-enhanced-items', JSON.stringify(enhancedItems));
|
|
localStorage.setItem('amazon_ext_blacklist', JSON.stringify(blacklistedBrands));
|
|
localStorage.setItem('amazon-ext-enhanced-settings', JSON.stringify(settings));
|
|
|
|
updateStatus('migration', '✅ Test-Daten erstellt', 'success');
|
|
log('migration', '✅ Test data created in localStorage');
|
|
log('migration', `📦 Enhanced Items: ${enhancedItems.length}`);
|
|
log('migration', `🚫 Blacklisted Brands: ${blacklistedBrands.length}`);
|
|
log('migration', '⚙️ Settings: Custom configuration');
|
|
|
|
} catch (error) {
|
|
updateStatus('migration', `❌ Fehler beim Erstellen der Test-Daten: ${error.message}`, 'error');
|
|
log('migration', `❌ Error creating test data: ${error.message}`);
|
|
}
|
|
};
|
|
|
|
// Test Migration
|
|
window.testMigration = async function() {
|
|
try {
|
|
updateStatus('migration', 'Migration wird getestet...', 'info');
|
|
log('migration', '🔄 Starting migration test...');
|
|
|
|
// First detect existing data
|
|
const detection = await migrationService.detectExistingData();
|
|
log('migration', `📊 Data detection: ${detection.hasData ? 'Data found' : 'No data found'}`);
|
|
log('migration', `📈 Total items: ${detection.totalItems}`);
|
|
|
|
if (!detection.hasData) {
|
|
updateStatus('migration', '⚠️ Keine Daten zum Migrieren gefunden', 'error');
|
|
log('migration', '⚠️ No data to migrate. Please create test data first.');
|
|
return;
|
|
}
|
|
|
|
// Run migration
|
|
const result = await migrationService.migrateAllData();
|
|
|
|
if (result.success) {
|
|
updateStatus('migration', '✅ Migration erfolgreich!', 'success');
|
|
log('migration', '✅ Migration completed successfully');
|
|
log('migration', `📊 Results: ${JSON.stringify(result.results, null, 2)}`);
|
|
|
|
testResults.migration = true;
|
|
updateOverallStatus();
|
|
} else {
|
|
updateStatus('migration', `❌ Migration fehlgeschlagen: ${result.error}`, 'error');
|
|
log('migration', `❌ Migration failed: ${result.error}`);
|
|
testResults.migration = false;
|
|
}
|
|
|
|
} catch (error) {
|
|
updateStatus('migration', `❌ Migration Fehler: ${error.message}`, 'error');
|
|
log('migration', `❌ Migration error: ${error.message}`);
|
|
testResults.migration = false;
|
|
}
|
|
};
|
|
|
|
// Clear test data
|
|
window.clearTestData = function() {
|
|
try {
|
|
localStorage.removeItem('amazon-ext-enhanced-items');
|
|
localStorage.removeItem('amazon_ext_blacklist');
|
|
localStorage.removeItem('amazon-ext-enhanced-settings');
|
|
localStorage.removeItem('amazon-ext-migration-status');
|
|
|
|
updateStatus('migration', '✅ Test-Daten gelöscht', 'success');
|
|
log('migration', '✅ Test data cleared from localStorage');
|
|
|
|
} catch (error) {
|
|
updateStatus('migration', `❌ Fehler beim Löschen: ${error.message}`, 'error');
|
|
log('migration', `❌ Error clearing test data: ${error.message}`);
|
|
}
|
|
};
|
|
|
|
// Update overall status
|
|
function updateOverallStatus() {
|
|
const overallElement = document.getElementById('overall-status');
|
|
const resultsElement = document.getElementById('test-results');
|
|
|
|
const authStatus = testResults.authentication ? '✅' : '❌';
|
|
const migrationStatus = testResults.migration ? '✅' : '❌';
|
|
|
|
const allPassed = testResults.authentication && testResults.migration;
|
|
|
|
if (allPassed) {
|
|
overallElement.className = 'status success';
|
|
overallElement.textContent = '🎉 Alle Tests bestanden! Authentication & Migration Foundation ist bereit.';
|
|
} else {
|
|
overallElement.className = 'status error';
|
|
overallElement.textContent = '⚠️ Einige Tests sind fehlgeschlagen. Bitte überprüfen Sie die Logs.';
|
|
}
|
|
|
|
resultsElement.innerHTML = `
|
|
<h3>Test Ergebnisse:</h3>
|
|
<p>${authStatus} Authentication Test</p>
|
|
<p>${migrationStatus} Migration Test</p>
|
|
`;
|
|
}
|
|
|
|
// Initialize on page load
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
log('auth', '🚀 Checkpoint verification tool loaded');
|
|
log('migration', '🚀 Ready for migration testing');
|
|
|
|
// Try to initialize services
|
|
initializeServices();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
</html> |