Skip to content
Aryapatel-007Public

About

QA toolkit: one-line bug descriptions become full bug reports via a local LLM, and a live page is diffed against its Figma design.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BugLens

A QA engineer's toolkit: write bug reports in one line, and catch every place a website drifts from its Figma design.

Next.js React TypeScript Playwright Tailwind Ollama License


BugLens has two tools that share one export format, so everything lands in the same spreadsheet your team already triages from.

Bug Reporter Figma vs Live
Input One or two sentences: "checkout button does nothing on iOS Safari" A Figma frame link and the URL of the built page
Output A complete, structured bug report: steps, expected/actual, severity, priority… A list of every visual and content difference, each written up as a bug
Powered by A local LLM through Ollama — nothing leaves your machine The Figma REST API, headless Chromium and a deterministic diff engine

Bug Reporter

Type a short description and get a full report with 17 fields: ID, title, date, bug type, module, platform, preconditions, numbered steps to reproduce, test data, expected result, actual result, error message, reproducibility, severity, priority, affected scope and status.

  • One action per step. The prompt forces single physical actions — one click, one tap, one keystroke — starting from opening the app and ending at the failure.
  • Honest about guesses. Values the model inferred rather than read from your description are marked with *; anything unknown is written as not specified, never a fake placeholder.
  • Project context. Set project, reporter, platform, module, severity hint and an ID prefix once; every report uses them, and IDs continue from the highest existing one.
  • Spreadsheet-grade table. Inline cell editing, sort, filter by severity and type, regenerate a single row with a different interpretation, delete, undo.
  • Sessions. Every session autosaves to history with an AI-generated title; rename, reload or delete sessions from the sidebar.
  • Import & export. Import existing bugs from .xlsx/.csv; export to Excel or CSV, or share via the system share sheet.
  • Keyboard first. Ctrl+Enter submit · Ctrl+Z undo last row · Delete remove row · Ctrl+E export · Ctrl+Shift+S settings.

Figma vs Live

Paste a Figma frame link and a page URL. BugLens pulls the frame's layer tree from the Figma API, renders the page in headless Chromium at the frame's exact width, and compares the two element by element.

flowchart LR
    F[Figma frame] -->|REST API| A["Flatten layers<br/><sub>text · font · colour · role<br/>coords relative to frame</sub>"]
    L[Live URL] -->|Playwright| B["Capture leaf-text elements<br/><sub>computed styles · document coords</sub>"]
    A --> M["Match text<br/><sub>exact → fuzzy, one-to-one</sub>"]
    B --> M
    M --> O["Estimate page offset<br/><sub>median of exact matches</sub>"]
    O --> C["Checks"]
    C --> R[Bug list → XLSX / CSV]
Loading

What it checks

Check Reported when
Missing on Live A text layer in the design appears nowhere on the page
Extra on Live The page shows text no design layer contains (optional)
Text Mismatch Text matched fuzzily — e.g. a typo or changed copy
Font Family The first concrete family in the CSS stack differs from the design
Font Size Size differs by more than 1px (High at 4px+)
Font Weight Weight differs by 100 or more
Text Color Colour distance exceeds a perceptible threshold
Alignment Left / centre / right / justify differs (ignored where it can't be seen)
Position An element is out of place after aligning the page to the design
Size A text box's height differs — usually line-height or unexpected wrapping
Count Mismatch Number of buttons, inputs, images or icons differs

Why it doesn't drown you in false positives

Naive design diffs flag everything. BugLens is built to report only real differences:

  • Leaf-text extraction. Only elements that own their text are captured, so a <div> never "contains" all of its children's copy and produces bogus matches.
  • One-to-one matching. Every design layer pairs with at most one page element, highest similarity first and nearest first among repeats — five "Learn more" links pair with the right five.
  • Offset estimation. Real pages are centred, have headers above the fold, or sit inside a wider layout. The engine estimates the design→page offset from the median of exact matches before checking positions, so one shift doesn't produce a hundred position bugs.
  • Role de-duplication. A Figma "Button" containing an icon and a label counts as one button, not three elements.
  • Font-loader aware. Families renamed by next/font (__Inter_a1b2c3, Inter Fallback) still match Inter.
  • Fonts settled. Capture waits for document.fonts.ready and network idle, so metrics aren't taken from a fallback font.

The engine (src/lib/compareEngine.ts) is pure TypeScript with no browser or network dependencies, and has its own test suite.

Naming layers for count checks

Count checks infer roles from layer names. Name layers the way you would anyway and they're picked up: Button, Primary CTA, btn/submit → button · Input, Text field, Search bar → input · Icon/arrow, ic close → icon · any layer with an image fill, or Avatar, Photo → image.

Getting started

Requires Node.js 20+. For the Bug Reporter you also need Ollama.

git clone https://github.com/Aryapatel-007/BugLens.git
cd BugLens
npm install
npm run setup            # downloads headless Chromium for Playwright (once)
ollama pull llama3.2-vision
npm run dev

Open http://localhost:3000. The comparator is at Figma vs Live in the header, or http://localhost:3000/ui-compare.

Configuration

Copy .env.example to .env.local to change the model or Ollama address:

OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2-vision

Any instruction-following model works; larger models write better reproduction steps.

Comparing against a design

  1. In Figma, open Settings → Security → Personal access tokens and create a token with read access to file content.
  2. Right-click the frame you want to check → Copy link.
  3. In BugLens, paste the token and the link, click Fetch Figma Elements.
  4. Enter the page URL (localhost dev servers work), adjust the position tolerance if your layout is fluid, and click Run Comparison.
  5. Filter by severity or issue type, expand rows for details, export to XLSX or CSV.

The token is only sent to Figma's API from your own BugLens server and is never stored.

Scripts

Command What it does
npm run dev Development server
npm run build / npm start Production build / serve
npm run setup Install Playwright's Chromium
npm test Unit tests for the comparison engine
npm run lint ESLint

Project structure

src/
  app/
    page.tsx                 Bug Reporter UI
    ui-compare/page.tsx      Figma vs Live UI
    api/bug/generate         one-line description → full report
    api/bug/regenerate       rewrite one report from a different angle
    api/bug/title            short session title
    api/figma                Figma frame → flattened, frame-relative layers
    api/compare              Playwright capture → comparison engine
  lib/
    compareEngine.ts         matching, offset estimation, all checks (pure)
    ollama.ts                local LLM client
    exportUtils.ts           XLSX / CSV export and share
    normalize.ts             cleans up model output (steps, arrays)
  types/
tests/                       engine unit tests (node:test)

License

MIT © Arya Patel

About

QA toolkit: one-line bug descriptions become full bug reports via a local LLM, and a live page is diffed against its Figma design.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages