From 837b1f93f4353b3a5ad2aec5ff8cd857bd07bf09 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Fri, 12 Dec 2025 23:56:24 +0100 Subject: [PATCH] docs: update testing guide and sidebar documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Testing Hub (Admin Dashboard) section to testing guide - Document features: collection, running tests, statistics - Document API endpoints and background execution - Update sidebar documentation for new structure: - Add Product Catalog section - Add Platform Health section (Testing Hub, Code Quality, Background Tasks) - Update Settings to collapsible section - Update page-to-section mappings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- docs/frontend/shared/sidebar.md | 48 +++++++++++++++++------ docs/testing/testing-guide.md | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 12 deletions(-) diff --git a/docs/frontend/shared/sidebar.md b/docs/frontend/shared/sidebar.md index c9b10c45..9308e46d 100644 --- a/docs/frontend/shared/sidebar.md +++ b/docs/frontend/shared/sidebar.md @@ -15,11 +15,13 @@ The sidebar is organized into the following sections: | Section | Collapsible | Pages | |---------|-------------|-------| | Dashboard | No | Dashboard | -| Platform Administration | Yes | Companies, Vendors, Users, Customers, Marketplace | +| Platform Administration | Yes | Companies, Vendors, Users, Customers | +| Product Catalog | Yes | Marketplace Products, Vendor Products, Import | | Content Management | Yes | Platform Homepage, Content Pages, Vendor Themes | -| Developer Tools | Yes | Components, Icons, Testing Hub, Code Quality | +| Developer Tools | Yes | Components, Icons | +| Platform Health | Yes | Testing Hub, Code Quality, Background Tasks | | Platform Monitoring | Yes | Import Jobs, Application Logs | -| Settings | No | Settings | +| Settings | Yes | General, Profile, API Keys, Notifications | --- @@ -37,9 +39,12 @@ Sections can be expanded/collapsed by clicking the section header. The state is // Default state: Platform Administration open, others closed const defaultSections = { platformAdmin: true, + productCatalog: false, contentMgmt: false, devTools: false, - monitoring: false + platformHealth: false, + monitoring: false, + settingsSection: false }; // State stored in localStorage under this key @@ -53,9 +58,12 @@ const SIDEBAR_STORAGE_KEY = 'admin_sidebar_sections'; | `toggleSection(section)` | Toggle a section open/closed | | `expandSectionForCurrentPage()` | Auto-expand section containing current page | | `openSections.platformAdmin` | Check if Platform Administration is open | +| `openSections.productCatalog` | Check if Product Catalog is open | | `openSections.contentMgmt` | Check if Content Management is open | | `openSections.devTools` | Check if Developer Tools is open | +| `openSections.platformHealth` | Check if Platform Health is open | | `openSections.monitoring` | Check if Platform Monitoring is open | +| `openSections.settingsSection` | Check if Settings is open | ### CSS Transitions @@ -98,7 +106,10 @@ const pageSectionMap = { vendors: 'platformAdmin', users: 'platformAdmin', customers: 'platformAdmin', - marketplace: 'platformAdmin', + // Product Catalog + 'marketplace-products': 'productCatalog', + 'vendor-products': 'productCatalog', + marketplace: 'productCatalog', // Content Management 'platform-homepage': 'contentMgmt', 'content-pages': 'contentMgmt', @@ -106,11 +117,18 @@ const pageSectionMap = { // Developer Tools components: 'devTools', icons: 'devTools', - testing: 'devTools', - 'code-quality': 'devTools', + // Platform Health + testing: 'platformHealth', + 'code-quality': 'platformHealth', + 'background-tasks': 'platformHealth', // Platform Monitoring imports: 'monitoring', - logs: 'monitoring' + logs: 'monitoring', + // Settings + settings: 'settingsSection', + profile: 'settingsSection', + 'api-keys': 'settingsSection', + 'notifications-settings': 'settingsSection' }; ``` @@ -125,17 +143,23 @@ const pageSectionMap = { | Vendors | `'vendors'` | Platform Administration | `/admin/vendors` | | Users | `'users'` | Platform Administration | `/admin/users` | | Customers | `'customers'` | Platform Administration | `/admin/customers` | -| Marketplace | `'marketplace'` | Platform Administration | `/admin/marketplace` | +| Marketplace Products | `'marketplace-products'` | Product Catalog | `/admin/marketplace-products` | +| Vendor Products | `'vendor-products'` | Product Catalog | `/admin/vendor-products` | +| Import | `'marketplace'` | Product Catalog | `/admin/marketplace` | | Platform Homepage | `'platform-homepage'` | Content Management | `/admin/platform-homepage` | | Content Pages | `'content-pages'` | Content Management | `/admin/content-pages` | | Vendor Themes | `'vendor-theme'` | Content Management | `/admin/vendor-themes` | | Components | `'components'` | Developer Tools | `/admin/components` | | Icons | `'icons'` | Developer Tools | `/admin/icons` | -| Testing Hub | `'testing'` | Developer Tools | `/admin/testing` | -| Code Quality | `'code-quality'` | Developer Tools | `/admin/code-quality` | +| Testing Hub | `'testing'` | Platform Health | `/admin/testing` | +| Code Quality | `'code-quality'` | Platform Health | `/admin/code-quality` | +| Background Tasks | `'background-tasks'` | Platform Health | `/admin/background-tasks` | | Import Jobs | `'imports'` | Platform Monitoring | `/admin/imports` | | Application Logs | `'logs'` | Platform Monitoring | `/admin/logs` | -| Settings | `'settings'` | (always visible) | `/admin/settings` | +| General Settings | `'settings'` | Settings | `/admin/settings` | +| Profile | `'profile'` | Settings | `/admin/profile` | +| API Keys | `'api-keys'` | Settings | `/admin/api-keys` | +| Notifications | `'notifications-settings'` | Settings | `/admin/notifications-settings` | --- diff --git a/docs/testing/testing-guide.md b/docs/testing/testing-guide.md index bcc125f1..ea72d30e 100644 --- a/docs/testing/testing-guide.md +++ b/docs/testing/testing-guide.md @@ -14,6 +14,7 @@ The Wizamart platform employs a comprehensive testing strategy with four distinc - [Mocking](#mocking) - [Best Practices](#best-practices) - [Troubleshooting](#troubleshooting) +- [Testing Hub (Admin Dashboard)](#testing-hub-admin-dashboard) --- @@ -1266,6 +1267,71 @@ If you encounter issues: --- +## Testing Hub (Admin Dashboard) + +The platform includes a web-based Testing Hub accessible at `/admin/testing` that provides a visual interface for running tests and monitoring test health. + +### Accessing the Testing Hub + +Navigate to **Platform Health → Testing Hub** in the admin sidebar, or go directly to `/admin/testing`. + +### Features + +#### 1. Test Collection +Click **Collect Tests** to discover all available tests in the codebase without running them. This displays: + +- **Total Tests**: Number of test functions discovered +- **Unit Tests**: Tests in `tests/unit/` +- **Integration Tests**: Tests in `tests/integration/` +- **Performance Tests**: Tests in `tests/performance/` +- **Test Files**: Number of test files + +#### 2. Running Tests +Click **Run Tests** to execute the test suite. Tests run in the background, so you can: +- Leave the page and return later +- Monitor elapsed time in real-time +- See results when tests complete + +#### 3. Dashboard Statistics +The dashboard shows results from the last test run: + +- **Pass Rate**: Percentage of tests passing +- **Passed/Failed/Errors**: Test outcome counts +- **Duration**: How long the test run took +- **Skipped**: Tests marked to skip + +#### 4. Trend Analysis +View pass rate trends across the last 10 test runs to identify regressions. + +#### 5. Tests by Category +See breakdown of passed/failed tests by category (Unit, Integration, etc.). + +#### 6. Top Failing Tests +Quickly identify tests that fail most frequently across runs. + +### API Endpoints + +The Testing Hub uses these API endpoints: + +| Endpoint | Method | Description | +|----------|--------|-------------| +| `/api/v1/admin/tests/stats` | GET | Dashboard statistics | +| `/api/v1/admin/tests/run` | POST | Start a test run | +| `/api/v1/admin/tests/runs` | GET | List recent test runs | +| `/api/v1/admin/tests/runs/{id}` | GET | Get specific run details | +| `/api/v1/admin/tests/collect` | POST | Collect test information | + +### Background Execution + +Test runs execute as background tasks, allowing: +- Non-blocking UI during long test runs +- Ability to navigate away and return +- Automatic status polling every 2 seconds + +View all background tasks including test runs at **Platform Health → Background Tasks**. + +--- + ## Summary This testing guide covers: @@ -1277,5 +1343,6 @@ This testing guide covers: - ✅ Mocking patterns and best practices - ✅ Best practices for maintainable tests - ✅ Troubleshooting common issues +- ✅ Testing Hub admin dashboard For information about maintaining and extending the test suite, see [Test Maintenance Guide](test-maintenance.md).