Files
geutebruck/.playwright-mcp/test_sync_error.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

178 lines
5.8 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.

import { chromium } from 'playwright';
(async () => {
console.log('=== Testing Sync Error After Edit ===\n');
const browser = await chromium.launch({ headless: false, slowMo: 500 });
const context = await browser.newContext();
const page = await context.newPage();
let syncError = null;
let apiErrors = [];
page.on('console', msg => {
const text = msg.text();
// Capture sync errors
if (text.includes('sync') || text.includes('Sync') || text.includes('SYNC')) {
console.log(`[APP] ${text}`);
if (text.includes('failed') || text.includes('Failed') || text.includes('ERROR')) {
syncError = text;
console.log(`❌ SYNC ERROR: ${text}`);
}
}
// Capture all errors
if (msg.type() === 'error' || text.includes('ERROR') || text.includes('🔴')) {
console.log(`${text}`);
apiErrors.push(text);
}
});
// Capture API responses
page.on('response', async response => {
const url = response.url();
if (url.includes('/configuration/action-mappings')) {
const status = response.status();
const method = response.request().method();
console.log(`\n📡 API: ${method} ${status} ${url}`);
if (status >= 400) {
try {
const body = await response.text();
console.log(`❌ ERROR RESPONSE: ${body}`);
apiErrors.push(`${method} ${status}: ${body}`);
} catch (e) {
console.log(`❌ ERROR (could not read body)`);
}
} else if (method === 'PUT' || method === 'POST') {
try {
const body = await response.text();
console.log(`✅ SUCCESS RESPONSE: ${body}`);
} catch (e) {
console.log(`✅ SUCCESS (could not read body)`);
}
}
}
});
// Capture request bodies
page.on('request', request => {
const url = request.url();
if (url.includes('/configuration/action-mappings') && (request.method() === 'PUT' || request.method() === 'POST')) {
console.log(`\n📤 REQUEST: ${request.method()} ${url}`);
try {
const postData = request.postData();
if (postData) {
console.log(` Body: ${postData}`);
}
} catch (e) {
console.log(` (could not read body)`);
}
}
});
try {
// Login
console.log('1⃣ Login...');
await page.goto('http://100.81.138.77:8081/', { waitUntil: 'networkidle', timeout: 60000 });
await page.waitForTimeout(3000);
await page.click('body');
await page.waitForTimeout(500);
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.type('admin', { delay: 50 });
await page.waitForTimeout(300);
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.type('admin123', { delay: 50 });
await page.waitForTimeout(300);
await page.keyboard.press('Enter');
await page.waitForTimeout(4000);
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(2000);
console.log('\n3⃣ Download existing mappings...');
for (let i = 0; i < 3; i++) {
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
}
await page.keyboard.press('Enter');
await page.waitForTimeout(5000);
await page.screenshot({ path: 'sync-test-1-downloaded.png', fullPage: true });
console.log('\n4⃣ Edit first mapping...');
// Tab to first item and press Enter
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.press('Enter');
await page.waitForTimeout(2000);
await page.screenshot({ path: 'sync-test-2-edit-form.png', fullPage: true });
console.log('\n5⃣ Modify name field...');
// Name field should be focused, add " MODIFIED" to the end
await page.keyboard.press('End');
await page.waitForTimeout(200);
await page.keyboard.type(' MODIFIED', { delay: 50 });
await page.waitForTimeout(500);
await page.screenshot({ path: 'sync-test-3-name-modified.png', fullPage: true });
console.log('\n6⃣ Save changes...');
// Tab to Save button
for (let i = 0; i < 10; i++) {
await page.keyboard.press('Tab');
await page.waitForTimeout(200);
}
await page.keyboard.press('Enter');
await page.waitForTimeout(3000);
await page.screenshot({ path: 'sync-test-4-after-save.png', fullPage: true });
console.log('\n7⃣ Trigger sync...');
// Click the sync/upload button in the toolbar
await page.keyboard.press('Escape'); // Close any dialogs
await page.waitForTimeout(500);
// The sync button should be in the toolbar - let me tab to it
for (let i = 0; i < 2; i++) {
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
}
await page.keyboard.press('Enter');
console.log(' Waiting for sync to complete...');
await page.waitForTimeout(8000);
await page.screenshot({ path: 'sync-test-5-after-sync.png', fullPage: true });
} catch (error) {
console.error('\n💥 TEST ERROR:', error.message);
await page.screenshot({ path: 'sync-test-error.png', fullPage: true });
}
console.log('\n' + '='.repeat(70));
console.log('SYNC TEST RESULTS');
console.log('='.repeat(70));
if (syncError) {
console.log(`\n❌ SYNC FAILED: ${syncError}`);
}
if (apiErrors.length > 0) {
console.log(`\n❌ API ERRORS (${apiErrors.length}):`);
apiErrors.forEach((err, i) => console.log(` ${i + 1}. ${err}`));
}
if (!syncError && apiErrors.length === 0) {
console.log('\n✅ No errors detected (sync may have succeeded)');
}
await page.waitForTimeout(3000);
await browser.close();
console.log('\n' + '='.repeat(70));
})();