E2E OCR Rules
SkillDocs & knowledgeE2E OCR assertions with Tesseract.js for canvas-only UI such as PDF pages in Cypress page objects. Use when asserting canvas-only E2E text with OCR.
Use E2E OCR Rules in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add E2E OCR Rules and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the E2E OCR Rules skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by nerds-odd-e/doughnut in .agents/skills/e2e-ocr/SKILL.md and read by Ahel’s review.
Use this skill when asserting text that is not in the DOM, such as PDF content drawn only to <canvas>. Keep OCR in test infrastructure, not product code.
Tesseract Setup
- Use
tesseract.js, a root devDependency, for canvas-only assertions viacy.task. - Register a Node task in
e2e_test/config/common.ts. - The task should call
tesseract.jscreateWorkerandrecognizeon image bytes, such as base64 PNG without thedata:image/png;base64,prefix. - Example task name:
ocrCanvasImage.
Language Data
- Commit
e2e_test/tesseract/eng.traineddatauncompressed. - Pass
langPathandcachePathto that directory when creating the worker. - This prevents Tesseract from writing
eng.traineddatato the repo root. Root-level traineddata files are gitignored as a fallback.
Page Object Pattern
- Wait until the canvas has real ink before OCR. Sampling
getImageDatafor dark pixels is better than checking only non-zero alpha, because an empty white fill can still have alpha. - Export with
toDataURL("image/png"). - Strip the data URL prefix.
- Use
cy.task(..., { timeout: ... })for slow OCR. - Assert the returned string contains the expected substring with a clear message.
- Reference:
e2e_test/start/pageObjects/bookReadingPage.ts, fromexpectPdfBeginningVisiblethroughexpectCurrentPage(1).expectVisibleOCRContains.
Signals
- GitHub stars
- 49
- Forks
- 72
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
e2e-ocr- Source
- github.com/nerds-odd-e/doughnut
github.com/nerds-odd-e/doughnut
Related picks
Skill · mattpocock
The pick for TypeScripttypescript-pro
Skill · jeffallan
The pick for TypeScripthandoff
Skill · mattpocock
More in Docs & knowledgecanvas-design
Skill · anthropics
More in Docs & knowledgedoc-coauthoring
Skill · anthropics
More in Docs & knowledgepopups
Skill · coreyhaines31
More in Docs & knowledge