AC-ADMIN-CAT-003: Create New Category
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 1.2k
- Avg merge
- 3d 55m
- Merged PRs (30d)
- 436
Description
### AC-ADMIN-CAT-003: Create New Category
**Priority**: P0 (Critical - must pass)
**Type**: Acceptance Test
**Estimated Time**: 25 min
**Automated Test**: Medium candidate
#### Description
Admin can create a new document category with name, description, organization unit, and settings.
#### Acceptance Criteria
- [ ] "Create Category" or "New Category" button visible in listing
- [ ] Click opens form/modal with fields:
- [ ] Category Name (required, text input, max 100 chars)
- [ ] Description (optional, textarea)
- [ ] Related To (dropdown: Order, Quote, None)
- [ ] Organization Unit (dropdown: Global, Acme Corp, TechFlow GmbH, etc.)
- [ ] Enable by Default (toggle switch)
- [ ] Validation: Category name cannot be empty
- [ ] Validation: Category name must be unique (no duplicates)
- [ ] Validation: Name max 100 characters enforced
- [ ] Save/Create button submits form
- [ ] On success:
- [ ] Modal closes
- [ ] New category appears in listing with file count = 0
- [ ] Success notification displays: "Category '[Name]' created successfully"
- [ ] On validation error:
- [ ] Error message displays below field
- [ ] Form remains open
#### Test Steps
1. In category listing, click "Create Category" button
2. Form opens with empty fields
3. Enter category name: "Test_Category_001"
4. Enter description: "Test category for Q3 documents"
5. Select Related To: "Order"
6. Select Organization Unit: "Global"
7. Toggle "Enable by Default": ON
8. Click "Create"
9. Verify success notification
10. Verify new category appears in listing with 0 files
11. Test duplicate: Try creating another category with same name
12. Verify validation error: "Category name already exists"
#### Test Data Required
- No pre-existing data needed
#### Sample Automated Test
```javascript
// Playwright example
test('Create new category', async ({ page }) => {
await page.click('button:has-text("Create Category")');
await page.fill('input[name="category_name"]', 'Test_Category_001');
await page.fill('textarea[name="description"]', 'Test category');
await page.selectOption('select[name="related_to"]', 'Order');
await page.click('button[type="submit"]');
await expect(page.locator('text=Category created successfully')).toBeVisible();
await expect(page.locator('text=Test_Category_001')).toBeVisible();
});
```
Contributor guide
Assessment
This issue has not been assessed yet.