AGENT SKILL

browser-javascript-tdd

Test-drive browser JavaScript behavior with DOM fixtures, test runners, smoke tests, onload timing, selector refactors, and integration tradeoffs with Selenium or end-to-end tests. Use when adding client-side behavior, debugging DOM tests, choosing between JS unit tests and browser functional tests, or making JavaScript testable without overusing Selenium.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 1.6k
Forks
491

01 前言 Front Matter

name
browser-javascript-tdd
license
MIT
metadata
{ "tags": "javascript,tdd,testing,browser,frontend", "version": "0.1.0", "category": "Testing", "displayName": "Browser JavaScript TDD" }
description
Test-drive browser JavaScript behavior with DOM fixtures, test runners, smoke tests, onload timing, selector refactors, and integration tradeoffs with Selenium or end-to-end tests. Use when adding client-side behavior, debugging DOM tests, choosing between JS unit tests and browser functional tests, or making JavaScript testable without overusing Selenium.
compatibility
Codex, Claude Code, and other Agent Skills-compatible clients.

02 资源文件 3

03 SKILL.md 正文

Browser JavaScript TDD

Use this skill when browser-side behavior needs fast feedback before or alongside end-to-end tests. Keep JavaScript unit tests focused on DOM behavior and use broader browser tests only for integration confidence.

Source Traceability

Primary source: Harry Percival, Test-Driven Development with Python, 3rd ed. Guidance is transformed and paraphrased from chapters 17, 25, and Appendix B, especially browser-based Jasmine tests, DOM fixtures, onload timing, selector refactoring, and JavaScript CI integration.

Workflow

  1. Start with the user-visible browser behavior.

    • Decide what the JavaScript owns: DOM update, class toggle, client-side validation, enhancement, or integration hook.
    • Keep server-owned state out of client unit tests.
  2. Choose the test boundary.

    • Use JavaScript unit tests for pure functions and DOM manipulation.
    • Use one end-to-end test when Django/server, CSS, and browser wiring must be proven together.
    • Do not use Selenium to exhaustively test JavaScript branches.
  3. Build a stable DOM fixture.

    • Include only the markup required by the behavior.
    • Reset global state between tests.
    • Make initialization explicit instead of relying on incidental page load order.
  4. Red/green/refactor the JavaScript.

    • First smoke-test the runner.
    • Add a failing DOM behavior test.
    • Implement minimal code.
    • Refactor selectors and initialization while tests are green.

Read browser-js-patterns.md for DOM fixtures, initialization, and CI patterns.

Decision Rules

  • If the behavior is DOM-local, prefer JavaScript tests.
  • If the risk is server-client integration, keep a small browser functional test.
  • If the code depends on page load timing, expose an initialization function and test it directly.
  • If selectors are duplicated across tests and code, introduce named selectors or data attributes deliberately.
  • If the test needs CSS behavior, decide whether style is truly the contract or only incidental.

Guardrails

  • Do not let global DOM or event listeners leak between tests.
  • Do not test third-party framework behavior.
  • Do not hide asynchronous timing with sleeps.
  • Do not make JS unit tests pass while the real page never calls the code.

Verification

Before finishing, record:

  • Test runner command and result.
  • DOM fixture or setup reset strategy.
  • Integration check when the real page wiring changed.
  • CI step or artifact change when browser JS tests were added to the pipeline.

04 同仓库更多 Skills

hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-review-with-annotations

Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-find-and-synthesize-context

Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-update-docs

Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-manage-records

Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-manage-interactive-html

Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-collaborate-threads

Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.

★ 1.6k