Files
rpa_vision_v3/test_palette_cross_machine_navigateur.html
Dom a27b74cf22 v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40)
- Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard)
- Ollama GPU fonctionnel
- Self-healing interactif
- Dashboard confiance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:23:51 +01:00

190 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Palette Cross-Machine VWB</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background: #0f172a;
color: #e2e8f0;
}
.test-container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background: #1e293b;
border-radius: 12px;
border: 1px solid #334155;
}
.status {
padding: 10px;
margin: 10px 0;
border-radius: 8px;
font-weight: bold;
}
.success { background: #22c55e; color: white; }
.error { background: #ef4444; color: white; }
.warning { background: #f59e0b; color: white; }
.info { background: #3b82f6; color: white; }
button {
background: #1976d2;
color: white;
border: none;
padding: 10px 20px;
border-radius: 8px;
cursor: pointer;
margin: 5px;
}
button:hover {
background: #1565c0;
}
#results {
margin-top: 20px;
padding: 15px;
background: #334155;
border-radius: 8px;
}
</style>
</head>
<body>
<div class="test-container">
<h1>🧪 Test Palette Cross-Machine VWB</h1>
<p>Cette page teste la détection automatique d'URL et le fallback statique de la palette d'outils.</p>
<div class="status info">
📍 URL actuelle: <span id="currentUrl"></span>
</div>
<div>
<button onclick="testCatalogService()">🔍 Tester Service Catalogue</button>
<button onclick="testStaticFallback()">📦 Tester Fallback Statique</button>
<button onclick="testUrlDetection()">🌐 Tester Détection URL</button>
<button onclick="clearResults()">🧹 Effacer Résultats</button>
</div>
<div id="results"></div>
</div>
<script>
// Afficher l'URL actuelle
document.getElementById('currentUrl').textContent = window.location.href;
// Simuler le service catalogue (version simplifiée)
class TestCatalogService {
constructor() {
this.urls = [
window.location.origin,
'http://localhost:5004',
'http://127.0.0.1:5004'
];
this.staticActions = [
{ id: 'click_anchor', name: 'Cliquer sur Ancre', category: 'vision_ui' },
{ id: 'type_text', name: 'Saisir Texte', category: 'vision_ui' },
{ id: 'wait_for_anchor', name: 'Attendre Ancre', category: 'control' },
{ id: 'extract_text', name: 'Extraire Texte', category: 'data' },
{ id: 'hotkey', name: 'Raccourci Clavier', category: 'control' }
];
}
async testUrl(url) {
try {
const response = await fetch(`${url}/health`, {
method: 'GET',
timeout: 2000
});
return response.ok;
} catch (error) {
return false;
}
}
async detectWorkingUrl() {
for (const url of this.urls) {
if (await this.testUrl(url)) {
return url;
}
}
return null;
}
getStaticActions() {
return this.staticActions;
}
}
const catalogService = new TestCatalogService();
function addResult(message, type = 'info') {
const results = document.getElementById('results');
const div = document.createElement('div');
div.className = `status ${type}`;
div.innerHTML = message;
results.appendChild(div);
}
async function testCatalogService() {
addResult('🔍 Test du service catalogue en cours...', 'info');
const workingUrl = await catalogService.detectWorkingUrl();
if (workingUrl) {
addResult(`✅ Service catalogue détecté sur: ${workingUrl}`, 'success');
// Tester l'API catalogue
try {
const response = await fetch(`${workingUrl}/api/vwb/catalog/actions`);
if (response.ok) {
const data = await response.json();
addResult(`✅ API catalogue fonctionnelle: ${data.actions?.length || 0} actions`, 'success');
} else {
addResult(`❌ API catalogue non accessible (${response.status})`, 'error');
}
} catch (error) {
addResult(`❌ Erreur API catalogue: ${error.message}`, 'error');
}
} else {
addResult('❌ Aucun service catalogue détecté', 'error');
}
}
function testStaticFallback() {
addResult('📦 Test du fallback statique...', 'info');
const staticActions = catalogService.getStaticActions();
if (staticActions.length > 0) {
addResult(`✅ Catalogue statique disponible: ${staticActions.length} actions`, 'success');
staticActions.forEach(action => {
addResult(` - ${action.name} (${action.id})`, 'info');
});
} else {
addResult('❌ Catalogue statique vide', 'error');
}
}
async function testUrlDetection() {
addResult('🌐 Test de détection automatique d'URL...', 'info');
for (const url of catalogService.urls) {
addResult(`⏳ Test de ${url}...`, 'info');
const isWorking = await catalogService.testUrl(url);
if (isWorking) {
addResult(`✅ ${url} accessible`, 'success');
} else {
addResult(`❌ ${url} non accessible`, 'error');
}
}
}
function clearResults() {
document.getElementById('results').innerHTML = '';
}
// Test automatique au chargement
window.addEventListener('load', () => {
addResult('🚀 Page de test chargée - Prêt pour les tests', 'success');
});
</script>
</body>
</html>