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

179 lines
5.7 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('=== Verifying Sync Fix ===\n');
const browser = await chromium.launch({ headless: false, slowMo: 500 });
const context = await browser.newContext();
const page = await context.newPage();
let syncSuccess = false;
let syncError = null;
let apiCalls = [];
page.on('console', msg => {
const text = msg.text();
// Capture sync-related messages
if (text.toLowerCase().includes('sync')) {
console.log(`[APP] ${text}`);
if (text.toLowerCase().includes('success')) {
syncSuccess = true;
} else if (text.toLowerCase().includes('fail') || text.toLowerCase().includes('error')) {
syncError = text;
}
}
});
// Capture API calls
page.on('request', request => {
const url = request.url();
if (url.includes('/configuration/action-mappings') && request.method() !== 'GET') {
const method = request.method();
const postData = request.postData();
apiCalls.push({ method, url, body: postData });
console.log(`\n📤 ${method} ${url}`);
if (postData) {
try {
const json = JSON.parse(postData);
console.log(` Request body:`);
console.log(` - name: ${json.name}`);
console.log(` - input_actions: ${JSON.stringify(json.input_actions)}`);
console.log(` - output_actions: ${JSON.stringify(json.output_actions)}`);
} catch (e) {
console.log(` Body: ${postData.substring(0, 200)}...`);
}
}
}
});
page.on('response', async response => {
const url = response.url();
if (url.includes('/configuration/action-mappings') && response.request().method() !== 'GET') {
const status = response.status();
const method = response.request().method();
console.log(`📥 ${method} Response: ${status}`);
if (status >= 200 && status < 300) {
console.log(`${method} succeeded`);
if (method === 'PUT') {
syncSuccess = true;
}
} else {
try {
const body = await response.text();
console.log(`${method} failed: ${body}`);
syncError = `${method} ${status}: ${body}`;
} catch (e) {
syncError = `${method} ${status}`;
}
}
}
});
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);
console.log('\n4⃣ Edit first mapping...');
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.press('Enter');
await page.waitForTimeout(2000);
console.log('\n5⃣ Modify name (add SYNC_TEST suffix)...');
await page.keyboard.press('End');
await page.waitForTimeout(200);
await page.keyboard.type(' SYNC_TEST', { delay: 50 });
await page.waitForTimeout(500);
await page.screenshot({ path: 'sync-verify-1-name-modified.png', fullPage: true });
console.log('\n6⃣ Save changes (mark as dirty)...');
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);
console.log('\n7⃣ Trigger sync to server...');
await page.keyboard.press('Escape');
await page.waitForTimeout(500);
// Click sync button in toolbar
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.press('Tab');
await page.waitForTimeout(300);
await page.keyboard.press('Enter');
console.log(' Waiting for sync operation...');
await page.waitForTimeout(8000);
await page.screenshot({ path: 'sync-verify-2-after-sync.png', fullPage: true });
} catch (error) {
console.error('\n💥 TEST ERROR:', error.message);
await page.screenshot({ path: 'sync-verify-error.png', fullPage: true });
}
console.log('\n' + '='.repeat(70));
console.log('SYNC VERIFICATION RESULTS');
console.log('='.repeat(70));
if (syncError) {
console.log(`\n❌ SYNC FAILED`);
console.log(` Error: ${syncError}`);
} else if (syncSuccess) {
console.log(`\n✅ SYNC SUCCESSFUL`);
console.log(` PUT request completed successfully`);
console.log(` Action mapping updated on server`);
} else {
console.log(`\n⚠️ SYNC STATUS UNCLEAR`);
console.log(` Check screenshots for details`);
}
if (apiCalls.length > 0) {
console.log(`\n📊 API Calls Made: ${apiCalls.length}`);
apiCalls.forEach((call, i) => {
console.log(` ${i + 1}. ${call.method} ${call.url}`);
});
}
await page.waitForTimeout(3000);
await browser.close();
const exitCode = syncError ? 1 : 0;
console.log(`\nExit code: ${exitCode}`);
console.log('='.repeat(70));
process.exit(exitCode);
})();