Skip to content

Latest commit

 

History

History
120 lines (88 loc) · 3.28 KB

File metadata and controls

120 lines (88 loc) · 3.28 KB

LOG Page - Playwright E2E Test

✅ Test Created

I've created a comprehensive Playwright test suite for the LOG page at: playwright-tests/log-page.spec.ts

🧪 Test Coverage

The test suite covers:

1. Display Tests

  • ✅ 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)

2. Export Tests

  • ✅ 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)

3. Interaction Tests

  • ✅ Delete single log entry
  • ✅ Clear all logs
  • ✅ Empty state display

4. Edge Cases

  • ✅ Empty state when no logs exist
  • ✅ Execution count in header

🚀 Running the Tests

Prerequisites

  1. Start the test server:

    npm run test:setup
    # OR
    npm run test:server
  2. Ensure authentication is set up:

    • The test uses the chromium project which requires auth
    • Auth session is created by auth.setup.ts automatically

Run Tests

# 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"

📋 Test Data

The test automatically sets up localStorage with 4 test log entries:

  1. Keywords log - 2 keywords with metadata
  2. Blog log - Single blog with AEO score
  3. Analytics log - Health check + mentions results
  4. Blog batch log - 3 results (2 success, 1 failed)

✅ Verification

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

🎯 What Gets Tested

Export Functionality

  • 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

UI Display

  • All log types render correctly
  • Metadata displays for each type
  • Icons and badges show properly
  • Empty state works

User Actions

  • Delete button removes entries
  • Clear all removes all entries
  • Export buttons trigger downloads

📝 Notes

  • Tests use beforeEach to set up localStorage data
  • Tests verify actual file downloads and content
  • All tests use authenticated session (chromium project)
  • Tests handle file system operations safely

🔍 Manual Testing

If you want to manually verify:

  1. Start dev server: npm run dev
  2. Navigate to /log
  3. Generate some keywords/blogs/analytics (they auto-save)
  4. Check LOG page shows them
  5. Click export buttons - files should download
  6. Verify file contents match expectations

Status: ✅ Test suite created and ready to run Requires: Test server on port 3334 + authenticated session