Back to Skills

component-testing-patterns

spences10
Updated 2 days ago
181 views
5
5
View on GitHub
Testingreacttesting

About

This Claude Skill provides component testing for Svelte 5 using Vitest browser mode and real Playwright browsers. It enables testing with semantic locators, accessibility patterns, and reactive state interactions. Use it when you need reliable browser-based component tests with auto-retrying queries and real user interactions.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/spences10/devhub-crm
Git CloneAlternative
git clone https://github.com/spences10/devhub-crm.git ~/.claude/skills/component-testing-patterns

Copy and paste this command in Claude Code to install this skill

Documentation

Component Testing Patterns

Quick Start

import { page } from 'vitest/browser';
import { render } from 'vitest-browser-svelte';

render(Button, { label: 'Click' });
await page.getByRole('button', { name: 'Click' }).click();
await expect.element(page.getByRole('button')).toBeInTheDocument();

Core Principles

  • Locators, never containers: page.getByRole() auto-retries
  • Semantic queries: getByRole(), getByLabelText() for accessibility
  • Await assertions: await expect.element(el).toBeInTheDocument()
  • Real browsers: Tests run in Playwright, not jsdom

Common Patterns

  • Locators: page.getByRole('button'), .first(), .nth(0), .last()
  • Interactions: await input.fill('text'), await button.click()
  • Runes: Use .test.svelte.ts files, flushSync(), untrack()
  • Files: *.svelte.test.ts (browser), *.ssr.test.ts (SSR), *.test.ts (server)

References

<!-- PROGRESSIVE DISCLOSURE GUIDELINES: - Keep this file ~50 lines total (max ~150 lines) - Use 1-2 code blocks only (recommend 1) - Keep description <200 chars for Level 1 efficiency - Move detailed docs to references/ for Level 3 loading - This is Level 2 - quick reference ONLY, not a manual -->

GitHub Repository

spences10/devhub-crm
Path: .claude/skills/component-testing-patterns

Related Skills

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

langchain

Meta

LangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.

View skill

webapp-testing

Testing

This Claude Skill provides a Playwright-based toolkit for testing local web applications through Python scripts. It enables frontend verification, UI debugging, screenshot capture, and log viewing while managing server lifecycles. Use it for browser automation tasks but run scripts directly rather than reading their source code to avoid context pollution.

View skill