component-testing-patterns
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.
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.tsfiles,flushSync(),untrack() - Files:
*.svelte.test.ts(browser),*.ssr.test.ts(SSR),*.test.ts(server)
References
- setup-configuration.md - Complete Vitest browser setup
- testing-patterns.md - Comprehensive testing patterns
- locator-strategies.md - Semantic locator guide
- troubleshooting.md - Common issues and fixes
Quick Install
/plugin add https://github.com/spences10/devhub-crm/tree/main/component-testing-patternsCopy and paste this command in Claude Code to install this skill
GitHub 仓库
Related Skills
evaluating-llms-harness
TestingThis 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.
langchain
MetaLangChain 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.
webapp-testing
TestingThis 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.
go-test
MetaThe go-test skill provides expertise in Go's standard testing package and best practices. It helps developers implement table-driven tests, subtests, benchmarks, and coverage strategies while following Go conventions. Use it when writing test files, creating mocks, detecting race conditions, or organizing integration tests in Go projects.
