twd-test-writer

Write TWD in-browser tests for SPAs using Testing Library and Mock Service Worker.

58|4|Updated Sep 4, 2025
One-click install
npx skills add https://github.com/BRIKEV/twd --skill twd-test-writer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: twd-test-writer
Source: https://github.com/BRIKEV/twd/tree/main/skills/twd-test-writer
Command: npx skills add https://github.com/BRIKEV/twd --skill twd-test-writer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps AI agents write correct TWD (Test While Developing) in-browser tests, ensuring robust and maintainable test suites for web applications.

Core Features & Use Cases

  • TWD Test Syntax: Guides AI on the specific syntax and structure for TWD tests.
  • Flow-Based Testing Philosophy: Emphasizes writing tests that reflect user flows rather than granular unit tests.
  • API Mocking: Details how to effectively mock API requests using Mock Service Worker.
  • User Interactions: Explains how to simulate user actions like typing, clicking, and selecting.
  • Assertions: Covers various assertion methods for verifying UI states and data.
  • Use Case: An AI agent can use this Skill to generate a new TWD test file for a login page, including mocking API calls for authentication and asserting successful login.

Quick Start

Use the twd-test-writer skill to generate a TWD test file for the user registration page.

Frequently Asked Questions about twd-test-writer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write in-browser tests that reflect user flows in SPAs?

In-browser tests for SPAs should follow a flow-based testing philosophy, simulating realistic user interactions like typing and clicking rather than testing granular units. This approach ensures robust and maintainable test suites for web applications.

What is the best way to mock API requests when testing web applications?

The best way to mock API requests in web application tests is using Mock Service Worker (MSW). MSW allows you to intercept and mock API requests at the network level, facilitating accurate flow-based testing without hitting real endpoints.

How do I simulate user interactions and verify UI states using Testing Library?

Using Testing Library, you simulate user interactions by selecting elements and performing actions like typing, clicking, and selecting. You then verify UI states and data through various built-in assertion methods to confirm expected behavior.

Can I use Testing Library and Mock Service Worker together for component mocking?

Yes, Testing Library and Mock Service Worker (MSW) work together effectively for component mocking and API mocking. This combination allows you to stub modules and mock network requests to isolate and test specific user flows in SPAs.

What are common mistakes when writing async operations in TWD tests?

Common mistakes when writing async operations in TWD tests often involve improper element selection, incorrect user interaction simulations, and failing to correctly await API mocking or navigation events, leading to flaky test behavior.