🎉 Improved form testing infrastructure with new files: 'simple_form_tester.py', 'ui_components.html' templates, and updated test suite in 'form_test_automator.py'. 📚

This commit is contained in:
2025-06-18 08:49:23 +02:00
parent 9a03e52209
commit f1e3a2cfea
5 changed files with 919 additions and 490 deletions

View File

@ -336,11 +336,13 @@
System-Info
</a>
<div class="border-t border-white/10 my-2"></div>
<button onclick="handleLogout()"
class="w-full flex items-center px-3 py-2 rounded-lg hover:bg-red-500/20 text-red-600 dark:text-red-400">
<i class="fas fa-sign-out-alt w-4 mr-3"></i>
Abmelden
</button>
<form method="POST" action="{{ url_for('auth.logout') }}" class="w-full">
{{ csrf_token() }}
<button type="submit" class="w-full flex items-center px-3 py-2 rounded-lg hover:bg-red-500/20 text-red-600 dark:text-red-400">
<i class="fas fa-sign-out-alt w-4 mr-3"></i>
Abmelden
</button>
</form>
</div>
</div>
</div>
@ -438,16 +440,11 @@
<div class="flex-1">
<p class="text-sm font-medium">{{ message }}</p>
</div>
<button onclick="this.parentElement.parentElement.remove()" class="ml-3 hover:opacity-70">
<button type="button" class="ml-3 hover:opacity-70 close-flash-btn">
<i class="fas fa-times text-sm"></i>
</button>
</div>
</div>
<script>
setTimeout(() => {
document.getElementById('flash-{{ loop.index }}')?.remove();
}, 5000);
</script>
{% endfor %}
</div>
{% endif %}
@ -727,12 +724,11 @@
const payload = JSON.parse(notification.payload || '{}');
return `
<div class="mt-3 flex space-x-2">
<button onclick="window.notificationManager.viewGuestRequest(${payload.request_id})"
class="px-3 py-1 bg-blue-500 text-white text-xs rounded hover:bg-blue-600">
<a href="/admin/guest-requests?highlight=${payload.request_id}"
class="inline-block px-3 py-1 bg-blue-500 text-white text-xs rounded hover:bg-blue-600">
Anzeigen
</button>
<button onclick="window.notificationManager.markAsRead(${notification.id})"
class="px-3 py-1 bg-gray-500 text-white text-xs rounded hover:bg-gray-600">
</a>
<button data-notification-id="${notification.id}" class="mark-read-btn px-3 py-1 bg-gray-500 text-white text-xs rounded hover:bg-gray-600">
Als gelesen markieren
</button>
</div>
@ -748,10 +744,7 @@
// Event Listeners werden über onclick direkt gesetzt
}
async viewGuestRequest(requestId) {
// Weiterleitung zur Admin-Gastanfragen-Seite
window.location.href = `/admin/guest-requests?highlight=${requestId}`;
}
// Replaced by direct links in templates
async markAsRead(notificationId) {
try {
@ -862,26 +855,19 @@
e.stopPropagation();
});
// Logout Handler
function handleLogout() {
if (confirm('Möchten Sie sich wirklich abmelden?')) {
const form = document.createElement('form');
form.method = 'POST';
form.action = '{{ url_for("auth.logout") }}';
const csrfToken = document.querySelector('meta[name="csrf-token"]');
if (csrfToken) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'csrf_token';
input.value = csrfToken.getAttribute('content');
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
}
}
// Flash-Message close buttons
document.querySelectorAll('.close-flash-btn').forEach(btn => {
btn.addEventListener('click', function() {
this.parentElement.parentElement.remove();
});
});
// Auto-hide flash messages after 5 seconds
document.querySelectorAll('[id^="flash-"]').forEach((flash, index) => {
setTimeout(() => {
flash?.remove();
}, 5000 + (index * 500)); // Staggered removal
});
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {