diff --git a/README.md b/README.md index f6948ad..5a83916 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ This project is a full-stack web application featuring: - 🛠️ **Admin Panel** - Manage tables, columns, and data through a beautiful UI - 📊 **Table Manager** - Create and drop tables with visual column definition - 🔧 **Column Manager** - Add, modify, and drop columns from existing tables -- 🔒 **Constraint Manager** - Add and manage UNIQUE and CHECK constraints (API ready, UI in progress) +- 🔒 **Constraint Manager** - Add and manage UNIQUE and CHECK constraints (fully implemented) - 📊 **SQL Query Interface** - Execute custom queries with safety validation - 🔒 **JWT Authentication** with secure session management - 📦 **DrizzleORM** - Support for PostgreSQL, MySQL, and SQLite @@ -767,10 +767,9 @@ See [ROADMAP.md](ROADMAP.md) for planned features and improvements. - ✅ Table Manager - Create and drop tables with visual column builder - ✅ Column Manager - Add, modify, and drop columns from existing tables - ✅ Schema management interface for table and column operations -- 🔄 Constraint Manager - Add and manage UNIQUE and CHECK constraints (API complete, UI in progress) +- ✅ Constraint Manager - Add and manage UNIQUE and CHECK constraints (fully implemented) **Upcoming features:** -- Complete constraint management UI - Visual database designer - Multi-database server connections - Advanced query builder diff --git a/ROADMAP.md b/ROADMAP.md index 0446461..860fa63 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -60,11 +60,11 @@ See `src/config/features.json` for the complete feature configuration. - [x] ✅ Create schema management interface - [x] ✅ Implement table creation/editing UI (API ready, UI implemented) - [x] ✅ Add column type management UI (API ready, UI implemented) - - [ ] Add data validation and constraints management 🏗️ **IN PROGRESS** + - [x] Add data validation and constraints management ✅ **COMPLETED** - [x] ✅ Implement constraints API (UNIQUE, CHECK constraints) - [x] ✅ Add constraint listing endpoint - [x] ✅ Add constraint creation/deletion endpoints - - [ ] Build constraints management UI + - [x] ✅ Build constraints management UI - [ ] Add PRIMARY KEY constraint support - [ ] Add DEFAULT value management - [ ] Add NOT NULL constraint management diff --git a/TESTING.md b/TESTING.md index 33b873f..03b4537 100644 --- a/TESTING.md +++ b/TESTING.md @@ -149,9 +149,9 @@ All tests verify that: | Feature Config | - | - | - | 40 | 40 | | Table Manager | 7 | 2 (2 skipped) | 3 | - | 12 | | Column Manager | 9 | 2 (2 skipped) | 3 | - | 14 | -| Constraint Manager | 14 | 0 (UI pending) | 3 | 4 | 21 | +| Constraint Manager | 14 | 3 (3 skipped) | 4 | 4 | 25 | | Admin Dashboard | - | 3 | 3 | - | 6 | -| **Total** | **30** | **7** | **12** | **44** | **93** | +| **Total** | **30** | **10** | **16** | **44** | **100** | ## Feature: Constraint Management Tests @@ -186,6 +186,25 @@ Tests for the Constraint Management API endpoints (`/api/admin/constraints`): - Error handling for all CRUD operations - Support for UNIQUE and CHECK constraints +### End-to-End Tests (Playwright UI Tests) + +#### 2. `tests/e2e/AdminDashboard.e2e.ts` - Constraints Manager UI + +**UI Tests:** +- 🔄 Display Constraints tab (requires auth - skipped) +- 🔄 Show table selector in Constraints Manager (requires auth - skipped) +- 🔄 Open add constraint dialog (requires auth - skipped) + +**Security Tests:** +- ✅ Blocks constraint API access without authentication + +**Note:** UI tests are skipped because they require an authenticated session. These can be enabled when a test authentication mechanism is implemented. + +**Components Implemented:** +- ✅ `ConstraintManagerTab.tsx` - Main UI component for managing constraints +- ✅ `ConstraintDialog.tsx` - Reusable dialog for add/delete constraint operations +- ✅ Integration with admin dashboard navigation and handlers + ### Unit Tests #### 2. `src/utils/featureConfig.test.ts` @@ -269,4 +288,4 @@ When adding new features: **Last Updated:** January 2026 **Test Framework:** Playwright + Vitest -**Coverage Status:** ✅ API Validation | 🔄 UI Tests (partial - needs auth) +**Coverage Status:** ✅ API Validation | 🔄 UI Tests (partial - needs auth) | ✅ Constraint Manager UI Complete diff --git a/tests/e2e/AdminDashboard.e2e.ts b/tests/e2e/AdminDashboard.e2e.ts index 0be4570..65a1b33 100644 --- a/tests/e2e/AdminDashboard.e2e.ts +++ b/tests/e2e/AdminDashboard.e2e.ts @@ -95,5 +95,44 @@ test.describe('Admin Dashboard', () => { expect(response.status()).toBe(401); }); + + test('should not allow constraint management without auth', async ({ page }) => { + const response = await page.request.get('/api/admin/constraints?tableName=test'); + + expect(response.status()).toBe(401); + }); + }); + + test.describe('Constraints Manager UI', () => { + test.skip('should display Constraints tab after login', async ({ page }) => { + // This test would require actual authentication + // Skipping for now as it needs a real admin user + + // await page.goto('/admin/dashboard'); + // await expect(page.getByText('Constraints')).toBeVisible(); + }); + + test.skip('should show table selector in Constraints Manager', async ({ page }) => { + // This test would require authentication + // Skipping for now + + // await page.goto('/admin/dashboard'); + // await page.getByText('Constraints').click(); + + // await expect(page.getByText(/select a table/i)).toBeVisible(); + }); + + test.skip('should open add constraint dialog', async ({ page }) => { + // This test would require authentication + // Skipping for now + + // await page.goto('/admin/dashboard'); + // await page.getByText('Constraints').click(); + // Select a table first + // await page.getByRole('button', { name: /add constraint/i }).click(); + + // await expect(page.getByText('Add Constraint')).toBeVisible(); + // await expect(page.getByLabel(/constraint name/i)).toBeVisible(); + }); }); });