fix: browser testing issues and missing UI tools

- Fix WebSocket URL to use ws:// for http development environments
- Make createLayer idempotent to prevent race-condition 500 under React StrictMode
- Add URL-based routing for /register so register page actually shows register form
- Add missing tool buttons to LeftSidebar: polygon, chair, extend, fillet
- Add Playwright browser test suite for exhaustive UI testing
- Update .gitignore for Playwright artifacts

Unit tests: backend 254/254, frontend 380/380
This commit is contained in:
2026-07-27 01:17:18 +02:00
parent 8f4ca1581c
commit c86b5e7031
10 changed files with 551 additions and 2 deletions
+4
View File
@@ -207,6 +207,10 @@ export class SqliteAdapter implements DatabaseInterface {
createLayer(data: Partial<DBLayer>): DBLayer {
const id = data.id ?? `layer-${Date.now()}`;
// Idempotent: if a layer with the same id already exists, return it.
// This prevents race conditions under React StrictMode double-render.
const existing = this.db.prepare('SELECT * FROM layers WHERE id = ?').get(id) as DBLayer | undefined;
if (existing) return existing;
this.db.prepare(
'INSERT INTO layers (id, drawing_id, name, visible, locked, color, line_type, transparency, sort_order, parent_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
).run(id, data.drawing_id!, data.name ?? 'Layer', data.visible !== undefined ? (data.visible ? 1 : 0) : 1, data.locked !== undefined ? (data.locked ? 1 : 0) : 0,