I've created a comprehensive Playwright test suite for the LOG page at:
playwright-tests/log-page.spec.ts
The test suite covers:
- ✅ All log entries display (keywords, blog, analytics, blog_batch)
- ✅ Keywords log metadata (count, language, country, time)
- ✅ Blog log metadata (keyword, word count, AEO score, time)
- ✅ Analytics log metadata (health score, mentions count, time)
- ✅ Blog batch log metadata (total, successful, failed, time)
- ✅ Keywords CSV export (downloads file, verifies content)
- ✅ Blog Markdown export (downloads file, verifies content)
- ✅ Analytics JSON export (downloads file, verifies JSON structure)
- ✅ Blog batch CSV export (downloads file, verifies content)
- ✅ Delete single log entry
- ✅ Clear all logs
- ✅ Empty state display
- ✅ Empty state when no logs exist
- ✅ Execution count in header
-
Start the test server:
npm run test:setup # OR npm run test:server -
Ensure authentication is set up:
- The test uses the
chromiumproject which requires auth - Auth session is created by
auth.setup.tsautomatically
- The test uses the
# Run all LOG page tests
npx playwright test log-page.spec.ts
# Run with UI (headed mode)
npx playwright test log-page.spec.ts --headed
# Run specific test
npx playwright test log-page.spec.ts -g "should export keywords"The test automatically sets up localStorage with 4 test log entries:
- Keywords log - 2 keywords with metadata
- Blog log - Single blog with AEO score
- Analytics log - Health check + mentions results
- Blog batch log - 3 results (2 success, 1 failed)
The test verifies:
- ✅ Files download with correct names
- ✅ CSV files contain expected headers and data
- ✅ Markdown files contain title and content
- ✅ JSON files contain valid structure with all fields
- ✅ File content matches expected values
- Keywords CSV: Verifies headers, keyword data, AEO types
- Blog MD: Verifies title, content structure
- Analytics JSON: Verifies company, health score, mentions count
- Blog Batch CSV: Verifies all results, success/failed status
- All log types render correctly
- Metadata displays for each type
- Icons and badges show properly
- Empty state works
- Delete button removes entries
- Clear all removes all entries
- Export buttons trigger downloads
- Tests use
beforeEachto set up localStorage data - Tests verify actual file downloads and content
- All tests use authenticated session (chromium project)
- Tests handle file system operations safely
If you want to manually verify:
- Start dev server:
npm run dev - Navigate to
/log - Generate some keywords/blogs/analytics (they auto-save)
- Check LOG page shows them
- Click export buttons - files should download
- Verify file contents match expectations
Status: ✅ Test suite created and ready to run Requires: Test server on port 3334 + authenticated session