Sangeetha-Grantha

Metadata Value
Status Folded into TRACK-113
Version 1.2.0
Last Updated 2026-07-09
Author Antigravity

TRACK-035: Frontend E2E Testing with Playwright

1. Goal

Implement comprehensive end-to-end tests for the Admin Dashboard using Playwright. Focus on the Bulk Import workflow as the primary test scenario, including authentication, batch creation, review workflow, and database verification.

2. Requirements

3. Implementation Plan

3.1 Infrastructure (Completed)

3.2 Page Objects (Completed)

3.3 Utilities (Completed)

3.4 Test Fixtures (Completed)

3.5 Test Specs (Completed)

4. Test Results

Latest Run (2026-02-03)

| Status | Count | |——–|——-| | Passed | 22 | | Skipped | 18 | | Failed | 0 | | Total | 40 |

Test Breakdown by Category

Category Passed Skipped Notes
Database State Verification 7 7 Skipped tests require entity resolution completion
Error Cases 7 0 All error handling tests pass
Happy Path 7 4 Skipped tests require pending imports
Review Workflow 3 7 Skipped tests require pending imports

Why Tests Skip (Expected Behavior)

The skipped tests are not failures - they gracefully handle async batch processing:

5. Architecture

e2e/
├── fixtures/
│   ├── auth.setup.ts       # Login and save auth state
│   ├── db-helpers.ts       # Direct PostgreSQL queries
│   ├── shared-batch.ts     # Shared batch fixture for all tests
│   └── test-data.ts        # Test constants and config
├── pages/
│   ├── base.page.ts        # Common page methods
│   ├── bulk-import.page.ts # Bulk import page interactions
│   ├── import-review.page.ts
│   ├── krithi-list.page.ts
│   └── login.page.ts
├── tests/
│   ├── bulk-import-database.spec.ts  # DB state verification
│   ├── bulk-import-error-cases.spec.ts
│   ├── bulk-import-happy-path.spec.ts
│   └── bulk-import-review.spec.ts
├── utils/
│   ├── api-client.ts       # HTTP client for API calls
│   ├── log-verifier.ts     # Log file inspection
│   └── polling.ts          # Async polling utilities
├── global-setup.ts         # Pre-test setup (health check, batch creation)
└── playwright.config.ts    # Playwright configuration

6. Running Tests

# From modules/frontend/sangita-admin-web
bun run test:e2e           # Run all E2E tests
bun run test:e2e:ui        # Run with Playwright UI
bun run test:e2e:debug     # Debug mode

Prerequisites

  1. Backend running: mise exec -- cargo run --manifest-path tools/sangita-cli/Cargo.toml -- dev --start-db
  2. Frontend running: bun run dev

Clean Run

To start fresh (removes cached batch state):

rm -f e2e/.batch-state.json
bun run test:e2e

7. Issues Fixed

Issue Fix
Batch created per test instead of once Moved batch creation to global-setup.ts with state file
DB enum case mismatch (PENDING vs pending) Updated db-helpers.ts to use lowercase enum values
Audit log column names wrong Fixed created_atchanged_at, user_idactor_user_id
Flaky batch visibility test Added refresh before waiting for batch in list

8. Future Improvements

9. Files Changed