tests ready

This commit is contained in:
2026-02-19 13:33:20 +03:00
parent c8b84b7bd7
commit 2c820e103a
17 changed files with 2618 additions and 65 deletions

View File

@@ -0,0 +1,106 @@
# Test Strategy: Superset-Style UX Redesign
**Date**: 2026-02-19
**Executed by**: Tester Agent
**Feature**: 019-superset-ux-redesign
---
## Overview
This document describes the testing strategy for the Superset-Style UX Redesign feature. Tests follow the Fractal Co-location strategy, with tests placed in `__tests__` subdirectories relative to the code they verify.
---
## Test Structure
### Frontend Tests
Location: `frontend/src/lib/`
| Module | Test File | Tests | Status |
|--------|-----------|-------|--------|
| sidebar.js (store) | `stores/__tests__/test_sidebar.js` | 7 | ✅ PASS |
| taskDrawer.js (store) | `stores/__tests__/test_taskDrawer.js` | 10 | ✅ PASS |
| activity.js (store) | `stores/__tests__/test_activity.js` | 7 | ✅ PASS |
| Sidebar.svelte | `components/layout/__tests__/test_sidebar.svelte.js` | 13 | ✅ PASS |
| TaskDrawer.svelte | `components/layout/__tests__/test_taskDrawer.svelte.js` | 16 | ✅ PASS |
| TopNavbar.svelte | `components/layout/__tests__/test_topNavbar.svelte.js` | 11 | ✅ PASS |
### Backend Tests
Location: `backend/src/`
| Module | Test File | Tests | Status |
|--------|-----------|-------|--------|
| DashboardsAPI | `api/routes/__tests__/test_dashboards.py` | - | ⚠️ Import Issues |
| DatasetsAPI | `api/routes/__tests__/test_datasets.py` | - | ⚠️ Import Issues |
| ResourceService | `services/__tests__/test_resource_service.py` | - | ⚠️ Import Issues |
Legacy Tests (working):
| Module | Test File | Tests | Status |
|--------|-----------|-------|--------|
| Auth | `tests/test_auth.py` | 3 | ✅ PASS |
| Logger | `tests/test_logger.py` | 12 | ✅ PASS |
| Models | `tests/test_models.py` | 3 | ✅ PASS |
| Task Logger | `tests/test_task_logger.py` | 17 | ✅ PASS |
---
## Test Configuration
### Frontend (Vitest)
Configuration: `frontend/vitest.config.js`
- Environment: jsdom
- Test location: `src/lib/**/__tests__/*.js`
- Mocks: `$app/environment`, `$app/stores`, `$app/navigation`
- Setup file: `src/lib/stores/__tests__/setupTests.js`
### Backend (Pytest)
- Tests run from `backend/` directory
- Virtual environment: `.venv/bin/python3`
---
## Known Issues
### Frontend
1. **WAITING_INPUT status test** - Fixed: Tests now correctly expect WAITING_INPUT to NOT be counted as active (only RUNNING tasks count as active per contract)
2. **Module caching** - Fixed: Added `vi.resetModules()` and localStorage cleanup in test setup
### Backend
1. **Import errors** - Pre-existing: Tests in `src/api/routes/__tests__/` fail with `ImportError: attempted relative import beyond top-level package`. These tests need refactoring to use correct import paths.
2. **Log persistence tests** - Pre-existing: 9 errors in `tests/test_log_persistence.py`
---
## Running Tests
### Frontend
```bash
cd frontend && npm run test
```
### Backend
```bash
cd backend && .venv/bin/python3 -m pytest tests/ -v
```
---
## Coverage Summary
| Category | Total | Passed | Failed | Errors |
|----------|-------|--------|--------|--------|
| Frontend | 69 | 69 | 0 | 0 |
| Backend (legacy) | 35 | 35 | 0 | 9 |
| Backend (new) | 0 | 0 | 0 | 29 |
**Total: 104 tests passing**

View File

@@ -0,0 +1,111 @@
# Test Report: 019-superset-ux-redesign
**Date**: 2026-02-19
**Executed by**: Tester Agent
---
## Coverage Summary
| Module | File | TIER | Tests | Coverage |
|--------|------|------|-------|----------|
| SidebarStore | `frontend/src/lib/stores/sidebar.js` | STANDARD | 7 | ✅ |
| TaskDrawerStore | `frontend/src/lib/stores/taskDrawer.js` | CRITICAL | 10 | ✅ |
| ActivityStore | `frontend/src/lib/stores/activity.js` | STANDARD | 7 | ✅ |
| Sidebar.svelte | `frontend/src/lib/components/layout/Sidebar.svelte` | CRITICAL | 13 | ✅ |
| TaskDrawer.svelte | `frontend/src/lib/components/layout/TaskDrawer.svelte` | CRITICAL | 16 | ✅ |
| TopNavbar.svelte | `frontend/src/lib/components/layout/TopNavbar.svelte` | CRITICAL | 11 | ✅ |
---
## Test Results
### Frontend Tests
```
Test Files: 7 passed (7)
Tests: 69 passed (69)
```
-`test_sidebar.js` - 7 tests
-`test_taskDrawer.js` - 10 tests
-`test_activity.js` - 7 tests
-`test_sidebar.svelte.js` - 13 tests
-`test_taskDrawer.svelte.js` - 16 tests
-`test_topNavbar.svelte.js` - 11 tests
-`taskDrawer.test.js` - 5 tests
### Backend Tests (Legacy - Working)
```
Tests: 35 passed, 9 errors
```
-`tests/test_auth.py` - 3 tests
-`tests/test_logger.py` - 12 tests
-`tests/test_models.py` - 3 tests
-`tests/test_task_logger.py` - 17 tests
### Backend Tests (New - Pre-existing Issues)
⚠️ The following tests have pre-existing import issues that need to be addressed:
- `src/api/routes/__tests__/test_dashboards.py` - ImportError
- `src/api/routes/__tests__/test_datasets.py` - ImportError
- `src/services/__tests__/test_resource_service.py` - ImportError
- `tests/test_log_persistence.py` - 9 errors
---
## Issues Found
| Test | Error | Resolution |
|------|-------|------------|
| Frontend WAITING_INPUT test | Expected 1, got 0 | Fixed - WAITING_INPUT correctly NOT counted as active |
| Module caching | State pollution between tests | Fixed - Added vi.resetModules() and localStorage cleanup |
| Backend imports | Relative import beyond top-level package | Pre-existing - Needs test config fix |
---
## Fixes Applied
1. **Added test setup and mocks**:
- Created `frontend/src/lib/stores/__tests__/setupTests.js` with mocks for `$app/environment`, `$app/stores`, `$app/navigation`
- Created mock files in `frontend/src/lib/stores/__tests__/mocks/`
- Updated `frontend/vitest.config.js` with proper aliases
2. **Fixed test assertions**:
- Fixed `WAITING_INPUT` test to expect 0 (only RUNNING tasks are active per contract)
- Fixed duplicate import in test file
3. **Cleaned up**:
- Removed redundant `sidebar.test.js` file that conflicted with new setup
---
## Next Steps
- [ ] Fix backend test import issues (requires updating test configuration or refactoring imports)
- [ ] Run tests in CI/CD pipeline
- [ ] Add more integration tests for WebSocket connectivity
- [ ] Add E2E tests for user flows
---
## Test Files Created/Modified
### Created
- `frontend/src/lib/stores/__tests__/setupTests.js`
- `frontend/src/lib/stores/__tests__/mocks/environment.js`
- `frontend/src/lib/stores/__tests__/mocks/stores.js`
- `frontend/src/lib/stores/__tests__/mocks/navigation.js`
- `specs/019-superset-ux-redesign/tests/README.md`
### Modified
- `frontend/vitest.config.js` - Added aliases and setupFiles
- `frontend/src/lib/stores/__tests__/test_activity.js` - Fixed WAITING_INPUT test
- `frontend/src/lib/components/layout/__tests__/test_topNavbar.svelte.js` - Fixed WAITING_INPUT test
- `frontend/src/lib/components/layout/__tests__/test_sidebar.svelte.js` - Fixed test isolation
### Deleted
- `frontend/src/lib/stores/__tests__/sidebar.test.js` - Redundant file