Files
geutebruck/.playwright-mcp/comprehensive_debug_loop.mjs
Administrator 14893e62a5 feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
This MVP release provides a complete full-stack solution for managing action mappings
in Geutebruck's GeViScope and GeViSoft video surveillance systems.

## Features

### Flutter Web Application (Port 8081)
- Modern, responsive UI for managing action mappings
- Action picker dialog with full parameter configuration
- Support for both GSC (GeViScope) and G-Core server actions
- Consistent UI for input and output actions with edit/delete capabilities
- Real-time action mapping creation, editing, and deletion
- Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers)

### FastAPI REST Backend (Port 8000)
- RESTful API for action mapping CRUD operations
- Action template service with comprehensive action catalog (247 actions)
- Server management (G-Core and GeViScope servers)
- Configuration tree reading and writing
- JWT authentication with role-based access control
- PostgreSQL database integration

### C# SDK Bridge (gRPC, Port 50051)
- Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll)
- Action mapping creation with correct binary format
- Support for GSC and G-Core action types
- Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug)
- Action ID lookup table with server-specific action IDs
- Configuration reading/writing via SetupClient

## Bug Fixes
- **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet
- Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)`
- Proper filter flags and VideoInput=0 for action mappings
- Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft)

## Technical Stack
- **Frontend**: Flutter Web, Dart, Dio HTTP client
- **Backend**: Python FastAPI, PostgreSQL, Redis
- **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK
- **Authentication**: JWT tokens
- **Configuration**: GeViSoft .set files (binary format)

## Credentials
- GeViSoft/GeViScope: username=sysadmin, password=masterkey
- Default admin: username=admin, password=admin123

## Deployment
All services run on localhost:
- Flutter Web: http://localhost:8081
- FastAPI: http://localhost:8000
- SDK Bridge gRPC: localhost:50051
- GeViServer: localhost (default port)

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 18:10:54 +01:00

192 lines
6.2 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { chromium } from 'playwright';
import fs from 'fs';
(async () => {
console.log('=== COMPREHENSIVE DEBUG LOOP - Action Mappings ===\n');
const browser = await chromium.launch({
headless: false,
slowMo: 200
});
const context = await browser.newContext();
const page = await context.newPage();
const allErrors = [];
const typeErrors = [];
const apiCalls = [];
// Capture EVERYTHING
page.on('console', msg => {
const text = msg.text();
const type = msg.type();
// Log all console messages
if (type === 'error' || text.includes('ERROR') || text.includes('🔴')) {
console.log(`❌ [${type}] ${text}`);
allErrors.push({ type: 'console', level: type, text });
// Check for type errors
if (text.includes('type') && (text.includes('String') || text.includes('int') || text.includes('List') || text.includes('Map'))) {
typeErrors.push(text);
console.log(`🚨 TYPE ERROR DETECTED: ${text}`);
}
} else if (text.includes('🔵') || text.includes('🟢') || text.includes('REQUEST') || text.includes('RESPONSE')) {
console.log(`📡 ${text}`);
}
});
// Capture page errors
page.on('pageerror', error => {
console.log(`💥 PAGE ERROR: ${error.message}`);
allErrors.push({ type: 'page', error: error.message });
});
// Capture network
page.on('response', async response => {
if (response.url().includes('api/v1/configuration/action-mappings')) {
const status = response.status();
let body = null;
try {
body = await response.text();
const parsed = JSON.parse(body);
apiCalls.push({
url: response.url(),
status: status,
data: parsed
});
console.log(`\n📥 API RESPONSE: ${status} ${response.url()}`);
console.log(` Total mappings: ${parsed.total_mappings || parsed.length || 'unknown'}`);
// Analyze first mapping for type issues
if (parsed.mappings && parsed.mappings[0]) {
const firstMapping = parsed.mappings[0];
console.log('\n🔍 FIRST MAPPING ANALYSIS:');
console.log(` id type: ${typeof firstMapping.id} (value: ${firstMapping.id})`);
console.log(` name type: ${typeof firstMapping.name}`);
console.log(` offset type: ${typeof firstMapping.offset}`);
// Check for type mismatches
if (typeof firstMapping.id === 'number') {
console.log(` ⚠️ WARNING: id is number, might expect string!`);
}
if (typeof firstMapping.offset === 'number') {
console.log(` offset is number`);
}
}
} catch (e) {
body = '[Could not parse]';
}
}
});
try {
console.log('1⃣ Login...');
await page.goto('http://100.81.138.77:8081/', { waitUntil: 'networkidle', timeout: 60000 });
await page.waitForTimeout(3000);
// Click on page to ensure focus, then use keyboard navigation for Flutter web
await page.click('body');
await page.waitForTimeout(500);
// Tab to username field and enter credentials
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.type('admin', { delay: 50 });
await page.waitForTimeout(300);
// Tab to password field
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.type('admin123', { delay: 50 });
await page.waitForTimeout(300);
// Press Enter to submit
await page.keyboard.press('Enter');
await page.waitForTimeout(5000);
console.log('\n2⃣ Navigate to Action Mappings...');
await page.goto('http://100.81.138.77:8081/#/action-mappings', { waitUntil: 'networkidle', timeout: 60000 });
await page.waitForTimeout(3000);
console.log('\n3⃣ Click download (using Tab navigation)...');
// More reliable: press Tab multiple times to reach download button
for (let i = 0; i < 5; i++) {
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
}
await page.keyboard.press('Enter');
console.log(' Waiting for response and processing...');
await page.waitForTimeout(10000); // Wait longer for any errors to appear
console.log('\n4⃣ Take screenshot of final state...');
await page.screenshot({ path: 'action-mappings-debug.png', fullPage: true });
} catch (error) {
console.error(`\n💥 TEST ERROR: ${error.message}`);
allErrors.push({ type: 'test', error: error.message });
await page.screenshot({ path: 'action-mappings-error.png', fullPage: true });
}
// COMPREHENSIVE SUMMARY
console.log('\n' + '='.repeat(70));
console.log('COMPREHENSIVE DIAGNOSTIC SUMMARY');
console.log('='.repeat(70));
console.log(`\n📊 Statistics:`);
console.log(` Total errors: ${allErrors.length}`);
console.log(` Type errors: ${typeErrors.length}`);
console.log(` API calls: ${apiCalls.length}`);
if (typeErrors.length > 0) {
console.log(`\n🚨 TYPE ERRORS FOUND (${typeErrors.length}):`);
typeErrors.forEach((err, i) => {
console.log(`\n ${i + 1}. ${err}`);
});
}
if (allErrors.length > 0) {
console.log(`\n❌ ALL ERRORS (${allErrors.length}):`);
allErrors.forEach((err, i) => {
console.log(`\n ${i + 1}. [${err.type}] ${err.text || err.error}`);
});
}
if (apiCalls.length > 0) {
console.log(`\n📡 API DATA SAMPLE:`);
const call = apiCalls[0];
if (call.data.mappings && call.data.mappings[0]) {
console.log(JSON.stringify(call.data.mappings[0], null, 2));
}
}
// Save detailed report
const report = {
timestamp: new Date().toISOString(),
summary: {
totalErrors: allErrors.length,
typeErrors: typeErrors.length,
apiCalls: apiCalls.length
},
errors: allErrors,
typeErrors: typeErrors,
apiCalls: apiCalls
};
fs.writeFileSync('debug-report.json', JSON.stringify(report, null, 2));
console.log('\n📄 Full report saved to: debug-report.json');
await page.waitForTimeout(2000);
await browser.close();
const exitCode = typeErrors.length > 0 || allErrors.length > 0 ? 1 : 0;
console.log(`\n${exitCode === 0 ? '✅ PASS' : '❌ FAIL'}: Exit code ${exitCode}`);
console.log('='.repeat(70));
process.exit(exitCode);
})();