77a4bfd499
## Features Implemented ### 1. Event Rename Functionality - Add EventRenameDialog component with live slug preview - Create eventRenameService for safe event renaming - Add slug_redirects table for old URL redirects - Support optional email notification on rename - Fix date formatting in slug (YYYY-MM-DD format) ### 2. Optional Event Contact Fields - Add settings to make customer name/email/admin email optional - Create migration for field requirement settings - Update CreateEventPage forms to show "(optional)" labels - Fix boolean parsing in publicSettings.js ### 3. Photo Filtering & Export - Add PhotoFilterPanel with rating/likes/favorites/comments filters - Create PhotoExportMenu with ZIP/metadata/XMP export options - Add photoExportService with Lightroom XMP sidecar generation - Create photoFilterBuilder utility for query construction - Wire up photo selection to export button via onSelectionChange ### 4. Custom CSS Gallery Templates - Add CssTemplateEditor component with 3 template slots - Create cssSanitizer utility blocking XSS vectors - Add gallery CSS endpoint for template delivery - Integrate Custom CSS tab into Settings page - Include default "Elegant Dark" template ## Bug Fixes - Fix event rename date formatting (was showing full Date string) - Fix common.optional translation key missing in locales - Fix photo export button staying disabled when photos selected - Fix authService import missing in SettingsPage ## Documentation - Add comprehensive REFACTORING_PLAN.md for codebase improvement - Add test specification documents for all features - Add feature documentation for CSS templates ## Database Migrations - 049_add_slug_redirects.js - 050_add_optional_event_fields_settings.js - 051_add_photo_filter_indexes.js - 052_add_css_templates.js
6.9 KiB
6.9 KiB
Test Specification: Optional Event Fields
This document specifies the test cases for the Optional Event Fields feature, which allows administrators to configure whether customer name, customer email, and admin email are required when creating events.
Prerequisites
- Local Docker environment running (
docker-compose up) - Access to admin dashboard
- Backend migrations applied
Test Cases
1. Settings Page - Event Creation Tab
TC-OEF-001: Event Creation Tab Visibility
Steps:
- Navigate to Settings page (
/admin/settings) - Verify "Event Creation" tab is visible
Expected Result:
- Tab labeled "Event Creation" or similar should be present in the settings navigation
TC-OEF-002: Default Field Requirements
Steps:
- Navigate to Settings > Event Creation tab
- Check initial state of all three toggles
Expected Result:
- "Require Customer Name" toggle is ON (enabled)
- "Require Customer Email" toggle is ON (enabled)
- "Require Admin Email" toggle is ON (enabled)
TC-OEF-003: Toggle Customer Name Requirement
Steps:
- Navigate to Settings > Event Creation
- Toggle OFF "Require Customer Name"
- Click Save
Expected Result:
- Setting saves successfully
- Toast notification confirms save
- Toggle remains OFF after page refresh
TC-OEF-004: Toggle Customer Email Requirement
Steps:
- Navigate to Settings > Event Creation
- Toggle OFF "Require Customer Email"
- Click Save
Expected Result:
- Setting saves successfully
- Warning message about email functionality is shown
- Toggle remains OFF after page refresh
TC-OEF-005: Toggle Admin Email Requirement
Steps:
- Navigate to Settings > Event Creation
- Toggle OFF "Require Admin Email"
- Click Save
Expected Result:
- Setting saves successfully
- Warning message about notifications is shown
- Toggle remains OFF after page refresh
2. Create Event Form - Conditional Validation
TC-OEF-006: All Fields Required (Default)
Steps:
- Ensure all three settings are ON in Settings > Event Creation
- Navigate to Create Event page
- Try to submit form without filling customer name, customer email, or admin email
Expected Result:
- Validation errors shown for all three empty fields
- Form does not submit
TC-OEF-007: Customer Name Optional
Steps:
- Set "Require Customer Name" to OFF in Settings
- Navigate to Create Event page
- Verify Host Name field label shows "(optional)"
- Submit form without customer name (but with required fields filled)
Expected Result:
- Host Name label shows "(optional)" suffix
- Form submits successfully without customer name
- Event is created
TC-OEF-008: Customer Email Optional
Steps:
- Set "Require Customer Email" to OFF in Settings
- Navigate to Create Event page
- Verify Host Email field label shows "(optional)"
- Submit form without customer email (but with required fields filled)
Expected Result:
- Host Email label shows "(optional)" suffix
- Form submits successfully without customer email
- Event is created
TC-OEF-009: Admin Email Optional
Steps:
- Set "Require Admin Email" to OFF in Settings
- Navigate to Create Event page
- Verify Admin Email field label shows "(optional)"
- Submit form without admin email (but with required fields filled)
Expected Result:
- Admin Email label shows "(optional)" suffix
- Form submits successfully without admin email
- Event is created
TC-OEF-010: All Fields Optional
Steps:
- Set all three settings to OFF in Settings
- Navigate to Create Event page
- Submit form with only event name, date, and password
Expected Result:
- All three optional fields show "(optional)" suffix
- Form submits successfully
- Event is created with null/empty contact fields
3. Backend Validation
TC-OEF-011: Backend Respects Settings
Steps:
- Set "Require Customer Email" to OFF
- Make direct API call to create event without customer_email:
POST /api/admin/events { event_name: "Test", event_date: "2025-01-15", ... }
Expected Result:
- API accepts the request
- Returns 201 Created
- Event is created without customer_email
TC-OEF-012: Backend Rejects When Required
Steps:
- Set "Require Customer Email" to ON
- Make direct API call to create event without customer_email
Expected Result:
- API rejects the request
- Returns 400 Bad Request with validation error
- Error message indicates customer_email is required
4. Format Validation for Optional Fields
TC-OEF-013: Invalid Email Format Still Rejected
Steps:
- Set "Require Customer Email" to OFF
- Navigate to Create Event page
- Enter invalid email format (e.g., "notanemail")
- Submit form
Expected Result:
- Validation error for invalid email format
- Form does not submit
- Error message: "Invalid email format"
5. Create Event Enhanced Page
TC-OEF-014: Enhanced Page Respects Settings
Steps:
- Set all three settings to OFF
- Navigate to enhanced Create Event page (
/admin/events/create) - Verify all three fields show "(optional)"
- Submit form without contact fields
Expected Result:
- All optional labels visible
- Form submits successfully
- Event is created
6. Settings Persistence
TC-OEF-015: Settings Persist Across Sessions
Steps:
- Set specific combination (e.g., customer name OFF, emails ON)
- Log out
- Log back in
- Navigate to Settings > Event Creation
Expected Result:
- Settings remain as configured
- Toggle states match what was saved
TC-OEF-016: Settings Persist Across Backend Restart
Steps:
- Set specific combination of settings
- Restart backend container
- Create new event
Expected Result:
- Validation behavior matches saved settings
- Database persisted settings correctly
Edge Cases
TC-OEF-017: Empty String vs Null
Steps:
- Set field to optional
- Create event with empty string for that field
- View event details
Expected Result:
- Field stores empty value appropriately
- No errors in display
TC-OEF-018: Rapid Toggle Changes
Steps:
- Quickly toggle settings on/off multiple times
- Save after each change
Expected Result:
- Each save completes without error
- Final state matches last save action
Automated Testing Notes
For Playwright tests:
- Login to admin dashboard
- Navigate to Settings
- Click Event Creation tab
- Manipulate toggles using checkbox selectors
- Navigate to Create Event
- Verify label text contains or doesn't contain "(optional)"
- Attempt form submission with various field combinations
- Assert on validation messages and success/failure states
Files Modified
Backend
/backend/migrations/core/050_add_optional_event_fields_settings.js/backend/src/routes/adminEvents.js/backend/src/routes/publicSettings.js
Frontend
/frontend/src/pages/admin/SettingsPage.tsx/frontend/src/pages/admin/CreateEventPage.tsx/frontend/src/pages/admin/CreateEventPageEnhanced.tsx