agentleFS
LucfaceLucface/claude-skills/skills/webapp-testing/SKILL.md

webapp-testing

Skill1 starsChanged 5 months agoMITView on GitHub

Provides Playwright patterns and best practices for web application testing. Covers DOM inspection, screenshot capture, form interaction, and API mocking. Works with the Playwright plugin for browser automation.

187 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use skill-share, raffle-winner-picker and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ArogyaReddySkill

    skill-share

    A skill that creates new Claude skills and automatically shares them on Slack using Rube for seamless team collaboration and skill discovery.

    Also in 20 projects that use this

  • ArogyaReddySkill

    raffle-winner-picker

    Picks random winners from lists, spreadsheets, or Google Sheets for giveaways, raffles, and contests. Ensures fair, unbiased selection with transparency.

    Also in 20 projects that use this

  • trendinuxSkill

    twitter-algorithm-optimizer

    Analyze and optimize tweets for maximum reach using Twitter's open-source algorithm insights. Rewrite and edit user tweets to improve engagement and visibility based on how the recommendation system ranks content.

    Also in 12 projects that use this

  • bkootazSkill

    artifacts-builder

    Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

    Also in 34 projects that use this

  • guaderramaSkill

    lead-research-assistant

    Identifies and qualifies potential leads by analyzing products/services, understanding ideal customer profiles, conducting intelligent web research using Bright Data MCP tools, and providing actionable outreach strategies. Use when researching leads, prospecting, qualifying contacts, analyzing companies, enriching lead data, or creating outreach campaigns.

    Also in 26 projects that use this

  • mm-mazharSkill

    cache-components

    Expert guidance for Next.js Cache Components and Partial Prerendering (PPR).

    Also in 5 projects that use this

  • +5 more from ArogyaReddy

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 182 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test local web applications using browser automation.

    line 7
  2. Very specific:

    After snapshot, each element gets a unique ref (@e1, @e2):

    line 55
  3. Distinctive:

    Deterministic: No CSS selector guessing

    line 56
  4. Distinctive:

    Fast: No DOM re-querying

    line 57

“Common” is measured: kept by at least 6 in 10 of the 182 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Web Application Testing

Test local web applications using browser automation.

Tool Selection

Use CaseToolWhy
AI agent browser interactionagent-browserAI-optimized refs, low token cost
Automated test suites (CI/CD)PlaywrightRich assertions, parallelization
PDF generation from HTMLPuppeteerSpecialized PDF APIs
Visual regression testingPlaywrightScreenshot comparison

Default: Use agent-browser for interactive testing, Playwright for test suites.

Decision Tree

  1. Is this AI-driven exploration or automated test suite?
    • AI exploration: Use agent-browser (refs system, AI-optimized)
    • Automated tests: Use Playwright (assertions, CI/CD)
  2. Is target static HTML or dynamic webapp?
    • Static: Direct page load and inspect
    • Dynamic: Use with_server.py helper for server lifecycle
  3. Do you need visual or programmatic testing?
    • Visual: Screenshots and visual comparison
    • Programmatic: DOM queries and assertions

Agent-Browser (AI Agent Testing)

Install globally: bun add -g agent-browser

Quick Start

# Navigate and get AI-optimized snapshot
agent-browser navigate "http://localhost:3000"
agent-browser snapshot

# Interact using refs from snapshot
agent-browser click @e3
agent-browser fill @e5 "test@example.com"
agent-browser snapshot  # Verify changes

The Refs Advantage

After snapshot, each element gets a unique ref (@e1, @e2):

  • Deterministic: No CSS selector guessing
  • Fast: No DOM re-querying
  • AI-friendly: LLMs parse refs reliably

Common Patterns

# Login flow
agent-browser navigate "http://localhost:3000/login"
agent-browser snapshot
agent-browser fill @e2 "user@example.com"
agent-browser fill @e3 "password123"
agent-browser click @e4
agent-browser wait-for "Dashboard"
agent-browser snapshot

# Form submission
agent-browser navigate "http://localhost:3000/contact"
agent-browser snapshot
agent-browser fill @e1 "John Doe"
agent-browser fill @e2 "john@example.com"
agent-browser type @e3 "Hello, this is my message"
agent-browser click @e4  # Submit button
agent-browser wait-for "Thank you"

See ~/.claude/context/agent-browser.md for full command reference.


Playwright (Automated Test Suites)

Setup

bun add -D playwright @playwright/test
bunx playwright install

Basic Test Structure

import { test, expect } from '@playwright/test';

test('homepage loads correctly', async ({ page }) => {
  await page.goto('http://localhost:3000');

  // Wait for dynamic content
  await page.waitForLoadState('networkidle');

  // Check title
  await expect(page).toHaveTitle(/My App/);

  // Check element exists
  await expect(page.locator('h1')).toContainText('Welcome');
});

Critical Practice

Always wait for network idle on dynamic apps:

await page.waitForLoadState('networkidle');

This prevents testing incomplete page states caused by ongoing JavaScript execution.

Element Selection

// By text
await page.getByText('Submit').click();

// By role
await page.getByRole('button', { name: 'Submit' }).click();

// By test ID (recommended)
await page.getByTestId('submit-button').click();

// By CSS selector
await page.locator('.submit-btn').click();

// By placeholder
await page.getByPlaceholder('Enter email').fill('test@example.com');

Screenshots

// Full page
await page.screenshot({ path: 'screenshot.png', fullPage: true });

// Specific element
await page.locator('.header').screenshot({ path: 'header.png' });

// Hide elements
await page.screenshot({
  path: 'clean.png',
  mask: [page.locator('.ads')]
});

Form Interaction

// Fill form
await page.getByLabel('Email').fill('user@example.com');
await page.getByLabel('Password').fill('secret123');

// Select dropdown
await page.getByLabel('Country').selectOption('US');

// Checkbox
await page.getByLabel('Remember me').check();

// Submit
await page.getByRole('button', { name: 'Sign In' }).click();

API Mocking

await page.route('**/api/users', async (route) => {
  await route.fulfill({
    status: 200,
    contentType: 'application/json',
    body: JSON.stringify([{ id: 1, name: 'Test User' }])
  });
});

Console Logging

page.on('console', msg => {
  console.log(`Browser console [${msg.type()}]: ${msg.text()}`);
});

page.on('pageerror', err => {
  console.error('Page error:', err.message);
});

Testing Dynamic Content

// Wait for element to appear
await page.waitForSelector('.loading', { state: 'hidden' });
await page.waitForSelector('.content', { state: 'visible' });

// Wait for specific text
await page.waitForFunction(() =>
  document.body.innerText.includes('Data loaded')
);

// Wait for network request
const responsePromise = page.waitForResponse('**/api/data');
await page.click('#load-button');
const response = await responsePromise;

Workflow Pattern

  1. Reconnaissance: Capture screenshots, inspect DOM
  2. Identify: Find selectors from rendered state
  3. Execute: Automate using discovered selectors
  4. Verify: Assert expected outcomes
// Reconnaissance
await page.screenshot({ path: 'before.png' });
console.log(await page.content());

// Find and interact
const buttons = await page.locator('button').all();
for (const btn of buttons) {
  console.log(await btn.textContent());
}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.