Sangeetha-Grantha

Metadata Value
Status Active
Version 1.1.0
Last Updated 2026-09-10
Author Sangeetha Grantha Team
Document Type Evidence record

Implementation Summary: Frontend E2E Testing with Playwright


[!NOTE] Historical evidence: results, counts, commands, and observations below belong to the original work described here. The editorial update date is not a new test or corpus verification. For present behavior, use current quality checks.

1. Executive Summary

Implemented comprehensive End-to-End (E2E) testing for the sangita-admin-web frontend module using Playwright. The test suite covers the Bulk Import workflow including authentication, batch processing, database verification, error handling, and review workflows.

2. Test Results

Latest Run (2026-02-03)

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

Skipped tests are expected - they gracefully handle cases where async batch processing hasn’t completed (no imported_krithis records yet).

3. Key Components

A. Test Infrastructure

| Component | File | Purpose | |———–|——|———| | Playwright Config | e2e/playwright.config.ts | Browser settings, timeouts, reporters | | Global Setup | e2e/global-setup.ts | Backend health check, batch creation | | Auth Setup | e2e/fixtures/auth.setup.ts | Login and persist auth state | | Test Data | e2e/fixtures/test-data.ts | Constants, credentials, paths |

B. Page Objects

| Page | File | Key Methods | |——|——|————-| | Base | e2e/pages/base.page.ts | Navigation, dialog handling | | Login | e2e/pages/login.page.ts | login(), credential input | | Bulk Import | e2e/pages/bulk-import.page.ts | uploadCSV(), selectBatch(), getBatchStatus() | | Import Review | e2e/pages/import-review.page.ts | getPendingCount(), approveImport() | | Krithi List | e2e/pages/krithi-list.page.ts | searchKrithi(), getKrithiDetails() |

C. Utilities

| Utility | File | Purpose | |———|——|———| | API Client | e2e/utils/api-client.ts | Direct HTTP calls to backend | | DB Helpers | e2e/fixtures/db-helpers.ts | PostgreSQL queries for verification | | Polling | e2e/utils/polling.ts | Async wait utilities | | Log Verifier | e2e/utils/log-verifier.ts | Log file inspection |

D. Test Specs

| Spec | Tests | Coverage | |——|——-|———-| | bulk-import-happy-path.spec.ts | 11 | Upload, view batch, approve imports | | bulk-import-database.spec.ts | 14 | Direct DB state verification | | bulk-import-error-cases.spec.ts | 7 | Invalid CSVs, error handling | | bulk-import-review.spec.ts | 10 | Review workflow, approval/rejection |

4. Architecture

e2e/
├── fixtures/
│   ├── auth.setup.ts       # Login and save auth state
│   ├── db-helpers.ts       # Direct PostgreSQL queries
│   ├── shared-batch.ts     # Shared batch fixture
│   └── test-data.ts        # Test constants
├── pages/
│   ├── base.page.ts        # Common page methods
│   ├── bulk-import.page.ts
│   ├── import-review.page.ts
│   ├── krithi-list.page.ts
│   └── login.page.ts
├── tests/
│   ├── bulk-import-database.spec.ts
│   ├── bulk-import-error-cases.spec.ts
│   ├── bulk-import-happy-path.spec.ts
│   └── bulk-import-review.spec.ts
├── utils/
│   ├── api-client.ts
│   ├── log-verifier.ts
│   └── polling.ts
├── global-setup.ts
└── playwright.config.ts

5. 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
bun run test:e2e:report    # View HTML report

Prerequisites

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

6. Issues Fixed During Implementation

Issue Solution
Batch created per test Moved to global-setup.ts with state file persistence
DB enum case mismatch Updated to lowercase (pending, approved)
Audit log column names Fixed created_atchanged_at, user_idactor_user_id
Flaky batch visibility Added refresh before waiting for batch in list

7. Files Modified/Created

New Files

Modified Files

9. Future Improvements


Section index · Documentation home · Feature status