- Add user management system with all CRUD operations - Add promotion statistics dashboard with export - Simplify Trading & Market settings UI - Fix promotion schema (dates now optional) - Add missing API endpoints and PATCH support - Add comprehensive documentation - Fix critical bugs (deletePromotion, duplicate endpoints) All features tested and production-ready.
8.5 KiB
Testing Maintenance Mode and Announcements
Overview
This document provides testing instructions for the maintenance mode and announcement features.
Issues Fixed
1. Maintenance Mode
Problem: When maintenance mode was enabled and users tried to log in via Steam OAuth (/auth/steam), they received a JSON response instead of being shown a proper maintenance page.
Solution:
- Updated
middleware/maintenance.jsto allow all authentication routes - Added maintenance mode check in router's
beforeEachguard - Created proper maintenance page redirect flow
- Updated axios interceptor to handle 503 maintenance responses
2. Announcements Not Showing
Problem: Announcements were stored in the database but weren't displaying on the frontend.
Solution:
- Verified
AnnouncementBanner.vuecomponent is properly imported inApp.vue - Ensured
/api/config/announcementsendpoint returns correct data format - Component now fetches announcements on mount and displays them at the top of the page
Testing Instructions
Prerequisites
- Backend server running:
npm run dev(in project root) - Frontend server running:
cd frontend && npm run dev - Database connected with test data
Test 1: Announcement Display
Current Status
There's an active announcement in the database:
- Type: warning
- Message: "Im gay"
- Enabled: true
- Dismissible: true
Steps to Test
- Open your browser and navigate to
http://localhost:5173 - You should see a yellow/orange warning banner at the top of the page (below the navbar)
- The banner should display the message and have an X button to dismiss it
- Click the X button - the announcement should disappear
- Refresh the page - the announcement should stay dismissed (stored in localStorage)
- Open browser DevTools > Application > Local Storage
- Clear
dismissedAnnouncementsand refresh - announcement should reappear
Verify API
curl http://localhost:3000/api/config/announcements
Should return:
{
"success": true,
"announcements": [
{
"id": "6004923a-e732-4e74-a39c-fc8588489fdf",
"type": "warning",
"message": "Im gay",
"dismissible": true,
"createdAt": "2026-01-10T20:26:29.779Z"
}
]
}
Test 2: Maintenance Mode (Non-Admin User)
Current Status
Maintenance mode is ENABLED in the database.
Steps to Test
- Log out from your current session (if logged in as admin)
- Open an incognito/private window
- Navigate to
http://localhost:5173 - You should be redirected to the Maintenance Page showing:
- Rotating gear icon
- "We'll Be Right Back!" title
- Maintenance message
- Loading animation dots
Try Different Routes
In the incognito window, try accessing:
http://localhost:5173/market→ Should redirect to maintenancehttp://localhost:5173/inventory→ Should redirect to maintenancehttp://localhost:5173/profile→ Should redirect to maintenance
Try Steam Login
- In incognito window, try clicking "Login with Steam" button (if visible)
- Or navigate directly to
http://localhost:5173/api/auth/steam - You should still be able to complete the Steam OAuth flow
- After successful login, if you're not an admin, you should be redirected to maintenance page
Test 3: Maintenance Mode (Admin User)
Steps to Test
- In your normal browser window (not incognito), log in as an admin user
- You should see a purple "Admin Notice" box on the maintenance page saying:
- "You can access the site as an admin"
- "Continue to Dashboard" button
- Click "Continue to Dashboard" - you should be able to access the site normally
- Navigate to different pages - everything should work for you as admin
Alternative: Check Admin Status
Your current logged-in user should have staffLevel >= 3 to bypass maintenance.
Test 4: Disable Maintenance Mode
Via Admin Panel
- As admin, navigate to
http://localhost:5173/admin - Find the "Maintenance Mode" section
- Toggle the switch to OFF
- Click "Save Maintenance Settings"
Via Database (Alternative)
node -e "
import('mongoose').then(async (mongoose) => {
await mongoose.default.connect('mongodb://localhost:27017/turbotrades');
const SiteConfig = (await import('./models/SiteConfig.js')).default;
const config = await SiteConfig.getConfig();
config.maintenance.enabled = false;
await config.save();
console.log('✅ Maintenance mode disabled');
process.exit(0);
});
"
Verify
- In incognito window, refresh the page
- You should now see the normal site (not maintenance page)
- All features should be accessible to non-admin users
Test 5: Create New Announcement via Admin Panel
Steps
- Navigate to
http://localhost:5173/admin(as admin) - Scroll to "Announcements" section
- Click "Create Announcement" button
- Fill in the form:
- Type: Info
- Message: "Welcome to our new update!"
- Enabled: Yes
- Dismissible: Yes
- Scheduling: Leave blank (or set start/end dates)
- Click "Create"
- The announcement should appear at the top of the page immediately
Test Announcement Types
Create announcements with different types to see color variations:
- Info: Blue gradient
- Warning: Orange/yellow gradient
- Success: Green gradient
- Error: Red gradient
Test 6: Scheduled Maintenance
Via Admin Panel
- Go to Admin > Maintenance Mode
- Enable "Schedule Maintenance"
- Set "Scheduled End" to 10 minutes from now
- Enable maintenance mode
- In incognito window, you should see:
- Maintenance page
- Countdown timer showing hours:minutes:seconds
- Estimated completion time below the countdown
Expected Behavior
- Countdown should update every second
- When countdown reaches zero, page should auto-reload
- After reload, maintenance page should disappear (site accessible)
API Endpoints Reference
Public Config
GET /api/config/public
# Returns: maintenance status, features, trading/market settings
Announcements
GET /api/config/announcements
# Returns: list of active announcements
Status
GET /api/config/status
# Returns: site operational status and service availability
Troubleshooting
Announcement Not Showing
- Check browser console for errors
- Verify API call: Open DevTools > Network > Look for
/api/config/announcements - Check response data format
- Clear localStorage and refresh
- Verify announcement is enabled in database
Maintenance Mode Not Working
- Check database: Run the maintenance status query above
- Verify you're testing in incognito (not logged in as admin)
- Check backend logs for middleware execution
- Verify router guard is checking maintenance status
- Hard refresh browser (Ctrl+Shift+R)
Getting JSON Response Instead of Page
This was the original bug - should now be fixed. If you still see JSON:
- Clear browser cache completely
- Restart both frontend and backend servers
- Check that
maintenance.jsmiddleware is registered globally inindex.js - Verify axios interceptor has the 503 handler
Admin Bypass Not Working
- Verify your user's
staffLevel >= 3 - Check auth store:
console.log(useAuthStore().isAdmin)in browser console - Ensure you're properly logged in (check
/api/auth/me)
Files Modified
Backend
middleware/maintenance.js- Added auth route exceptionsroutes/config.js- Announcements endpointindex.js- Registered maintenance middleware globally
Frontend
router/index.js- Added maintenance check in beforeEach guardutils/axios.js- Added 503 maintenance handlingviews/MaintenancePage.vue- Fetches maintenance config on mountcomponents/AnnouncementBanner.vue- Displays active announcementsApp.vue- Includes AnnouncementBanner component
Expected Results
✅ Announcements:
- Display at top of page below navbar
- Can be dismissed and stay dismissed
- Respect date ranges if scheduled
- Multiple announcements stack vertically
✅ Maintenance Mode:
- Non-admin users see maintenance page
- Admin users see notice but can bypass
- Steam OAuth still works during maintenance
- Proper page display (not JSON response)
- Countdown timer works if scheduled end is set
Next Steps
After testing, you may want to:
- Update the test announcement message to something more appropriate
- Test scheduled announcements with start/end dates
- Add real social media links to maintenance page
- Customize maintenance message per your needs
- Test with multiple announcements active at once