testing

Test patterns with Playwright browser automation. Navigate to deployed patterns, interact with UI elements, verify functionality. Use when testing patterns after deployment or when debugging pattern behavior in browser.

9 stars

Best use case

testing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Test patterns with Playwright browser automation. Navigate to deployed patterns, interact with UI elements, verify functionality. Use when testing patterns after deployment or when debugging pattern behavior in browser.

Teams using testing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/testing/SKILL.md --create-dirs "https://raw.githubusercontent.com/jkomoros/community-patterns/main/.claude/skills/testing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/testing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How testing Compares

Feature / AgenttestingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Test patterns with Playwright browser automation. Navigate to deployed patterns, interact with UI elements, verify functionality. Use when testing patterns after deployment or when debugging pattern behavior in browser.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Testing Patterns with Playwright

If Playwright MCP is available, use it to test patterns in a real browser.

## ⚠️ CRITICAL URL FORMAT

**When testing patterns, the URL MUST be:**

```
http://localhost:8000/SPACE-NAME/CHARM-ID
```

**⚠️ COMMON MISTAKES TO AVOID:**

- ❌ `http://localhost:5173/...` - WRONG PORT (that's the shell, not toolshed)
- ❌ `http://localhost:8000/CHARM-ID` - MISSING SPACE NAME
- ❌ `http://localhost:5173/CHARM-ID` - WRONG PORT AND MISSING SPACE

**If you use the wrong URL format, the pattern will NOT work. No exceptions.**

## Navigate to Deployed Pattern

```
Use Playwright to navigate to: http://localhost:8000/SPACE-NAME/CHARM-ID
```

**Example:**

```
http://localhost:8000/claude-counter-1130-1/baedreicqpqie6td...
```

## Test Pattern Functionality

Once the page loads:

1. **Wait briefly before first snapshot** - Sometimes the initial load shows a
   login/registration screen for a moment. Wait 1-2 seconds before taking your
   first snapshot to ensure the pattern has fully rendered.
2. Take a snapshot to see the UI: `browser_snapshot`
3. Interact with elements: click buttons, fill inputs, check boxes
4. Verify behavior: check that counters increment, items are added, etc.
5. Report any issues found

## Registering (First Time Only)

If you see a login/registration page:

1. Click "Register" or "Generate Passphrase"
2. Follow the registration flow
3. Then navigate back to the pattern URL

## Space Naming Convention

Use descriptive space names with the `claude-` prefix:

**Format:** `claude-<pattern-name>-<MMDD>-<counter>`

**Examples:**

- `claude-counter-1130-1`
- `claude-shopping-list-1201-2`
- `claude-prompt-injection-tracker-1130-1`

## Testing Workflow

**After deploying a new pattern:**

```
1. Deploy with: deno task cf piece new --api-url http://localhost:8000 --identity ../labs/claude.key --space claude-my-pattern-1130-1 pattern.tsx
2. Note the piece ID from output
3. Use Playwright to navigate to: http://localhost:8000/claude-my-pattern-1130-1/CHARM-ID
   ⚠️ MUST be port 8000, MUST include space name
4. Verify all functionality works
5. Report to user if tests pass or if issues found
```

**After updating a pattern:**

```
1. Deploy NEW instance with `piece new` (see warning below)
2. Note the NEW piece ID
3. Use Playwright to test at http://localhost:8000/SPACE-NAME/NEW-CHARM-ID
4. Test that changes work as expected
```

**🚨 NEVER use `piece setsrc` to update patterns!**

`piece setsrc` corrupts piece state and causes pieces to render blank on direct
navigation. ALWAYS use `piece new` to deploy a fresh instance instead. Getting a
new piece ID each time is expected and correct.

**When Playwright unavailable:**

- Suggest user test manually in browser
- Provide the URL to test
- Ask them to report any issues

## Playwright Troubleshooting

**If screenshot shows login/registration screen instead of pattern:**

The page may not have fully loaded. Wait 1-2 seconds before taking the first
snapshot:

```
Use browser_wait_for with time: 2 before taking the snapshot
```

This is common when navigating to a pattern URL—the authentication check may
briefly show the login screen before the pattern renders.

**If Playwright starts opening many tabs:**

This can happen after user suspends/resumes their computer. The Chrome
connection gets confused.

**Solution:** Ask user to:

1. Quit the Chrome instance that Playwright opened (the one with "Chrome is
   being controlled by automated test software" banner)
2. Next Playwright command will open a fresh browser and work normally

**Tell user:**

```
Playwright's browser connection got confused after your computer woke up.
Please quit the Chrome window with the yellow "automated test software" banner,
then I'll try again with a fresh browser.
```

Related Skills

Superstition Verification Skill

9
from jkomoros/community-patterns

Use this skill to systematically verify superstitions in

strategic-investigation

9
from jkomoros/community-patterns

Proactive recovery using plan mode and subagents. After 1-2 failed attempts, STOP trying variations. Enter plan mode and launch parallel Explore/Plan agents to find idiomatic solutions instead of spinning wheels.

session-startup

9
from jkomoros/community-patterns

Session initialization sequence for community-patterns development. Use at the start of every Claude Code session. Checks for upstream updates, loads workspace configuration, and ensures dev servers are running.

recovery-strategies

9
from jkomoros/community-patterns

Escalation path when stuck on pattern development. Use when encountering TypeScript errors, framework confusion, unexpected behavior, or blocked progress. Five-step recovery: check docs, study examples, strategic investigation (plan mode + subagents), reset and retry, ask user.

pattern-dev

9
from jkomoros/community-patterns

Day-to-day pattern development best practices. Use when actively developing patterns. Covers incremental development, commits, communication guidelines, and general development workflow.

land-branch

9
from jkomoros/community-patterns

Land a feature branch: pull from main, rebase the branch, create a PR, and merge it via rebase with automatic branch deletion. Use when ready to land a completed feature branch.

issue-filing

9
from jkomoros/community-patterns

File framework issues after exhausting other approaches. Document complex problems with multiple failed attempts for framework authors. REQUIRES user permission. Use only after checking docs, community-docs, and trying multiple approaches.

git-workflow

9
from jkomoros/community-patterns

Git operations and pull request workflows. Create PRs, rebase branches, resolve conflicts, merge to upstream. Use when ready to create PR or when working with git branches and upstream.

deployment

9
from jkomoros/community-patterns

Deploy and update patterns. Use when deploying new patterns, updating existing deployments, or testing syntax. Includes deployment commands and the first custom pattern celebration.

community-docs

9
from jkomoros/community-patterns

Community superstitions - unverified observations from pattern development. Use when encountering undocumented edge cases or framework quirks not in official docs. Verified knowledge should be upstreamed to labs docs.

claude-permissions-update

9
from jkomoros/community-patterns

Sync auto-approved permissions from all community-patterns directories (including community-patterns-2, -3, etc.) to the shared project settings. Shows new permissions for review before adding.

cw-testing

9
from sighup/claude-workflow

E2E testing with auto-fix. Generates tests from specs, executes in isolated sub-agents, and auto-fixes application bugs. This skill should be used after implementation to verify end-to-end behavior.