Bihar Police Notebook uses two complementary test layers: fast Vitest unit tests that validate transliteration logic in isolation, and Playwright end-to-end tests that drive a real browser against the staticDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/arverma/Bihar-Police-Notebook/llms.txt
Use this file to discover all available pages before exploring further.
editor/ folder. Because the app has no build step, Playwright simply spins up a local file server and opens the HTML directly — no bundler or compilation required before running either suite.
Prerequisites
Install the dev dependencies once after cloning:vitest@^3.2.7 and @playwright/test@^1.62.1. After that, download the Playwright browser binaries:
Running the Tests
- Unit Tests
- E2E Tests
vitest run editor/ — Vitest discovers every *.test.js file inside the editor/ directory and exits with a pass/fail code. No browser is involved.Unit Tests — Vitest
The unit suite lives ineditor/js/translit.test.js and covers the core transliteration helpers imported from translit.js.
shouldSkipTransliteration()
This function decides whether a typed token should bypass the Hindi phonetic engine entirely. The tests pin down three important rules:
Legal Acronyms
Tokens like
IPC, CrPC, and FIR — all-caps or mixed-caps legal abbreviations — must be skipped so they appear verbatim in the document.Numbers & Punctuation
Pure numeric strings (
123, 12.3) and comma-separated numbers (45,67) are skipped, preserving numerals and decimal separators as typed.Hinglish Words
Lowercase romanised Hindi words like
bihar and patna must not be skipped — they should be fed into the transliteration pipeline.End-to-End Tests — Playwright
All E2E specs live in thetests/ directory and are run against Chromium (Desktop Chrome profile). The full list of spec files:
| File | What it covers |
|---|---|
tests/app.spec.js | App load, page title, transliteration toggle |
tests/punctuation.spec.js | Punctuation panel rendering, clipboard copy, focus preservation |
tests/focus-test.spec.js | Editor focus behaviour |
tests/btn-focus-test.spec.js | Button focus interactions |
tests/label-focus-test.spec.js | Label focus state |
tests/label-restore-test.spec.js | Label state restoration |
tests/label-timeout-test.spec.js | Label timeout logic |
tests/mousedown-test.spec.js | Mousedown event handling |
tests/toggle-state.spec.js | Toggle state persistence |
Playwright Configuration
playwright.config.js defines the key settings:
Key E2E Scenarios
App loads with correct title
app.spec.js navigates to / and asserts page.title() matches /Bihar Police Notebook/. This catches broken HTML or missing <title> tags immediately.Transliteration toggle works
The
#translitToggle checkbox starts checked (phonetic mode on). Clicking .toggle-slider flips it to unchecked, confirming the toggle state machine updates correctly.Punctuation panel renders 9 tiles
punctuation.spec.js waits for .punctuation-grid to be visible, then counts .punctuation-tile elements. Exactly 9 essential punctuation buttons — including the Hindi purna viram । — must be present.Clipboard copy on tile click
Clicking the first punctuation tile reads
navigator.clipboard.readText() and asserts the clipboard text matches the tile’s visible symbol. The spec requests clipboard-read and clipboard-write permissions via test.use().