/ogxo-debug:browser-testingfrom ogxo-debug
Writes and runs Playwright E2E, accessibility, responsive-layout, form/login, and link-check scripts for web apps. Auto-detects dev servers and handles setup automatically.
Ships in ogxo-debug. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
In Claude Code, ${CLAUDE_PLUGIN_ROOT} and ${CLAUDE_PLUGIN_DATA} in the commands below are already absolute paths, so they run as written. Elsewhere (Codex) they are not filled in: replace ${CLAUDE_PLUGIN_ROOT} with the plugin root (two directories above this SKILL.md, the directory that contains skills/browser-testing/scripts/run-playwright.js), and omit BROWSER_TESTING_HOME=... so the runner uses its default data directory (in the manual install snippet, set BT to that default directory instead of ${CLAUDE_PLUGIN_DATA}/browser-testing). Check a replaced root with test -f "<plugin-root>/skills/browser-testing/scripts/run-playwright.js" || echo "wrong plugin root" >&2. In references/*.md, <plugin-root> means the same root.
Data directory: the runner uses BROWSER_TESTING_HOME when set, else PLUGIN_DATA/browser-testing when PLUGIN_DATA is set, else ${XDG_CACHE_HOME:-~/.cache}/ogxo-debug/browser-testing. Host permissions govern package and browser downloads.
Before starting browser testing:
/tmp/playwright-test-<task>.js, /tmp/playwright-<task>-home.png), so browser runs in parallel sessions don't overwrite each other's filesgoto, wait for the element/state you need (await expect(locator).toBeVisible()) before inspecting or asserting -- never rely on networkidle in tests (Playwright marks it DISCOURAGED)Comprehensive browser testing using Playwright. Auto-detects running dev servers, writes clean test scripts to /tmp, performs E2E tests, accessibility checks, responsive design validation, and more.
None needed. Run the runner from the project's directory; it takes Playwright from, in order:
${CLAUDE_PLUGIN_DATA}/browser-testing in Claude Code, the default above elsewhere), once installed there;playwright or @playwright/test package, when that version's Chromium is already downloaded (it prints "Using the project's Playwright");npm ci of the pinned package files, then npx playwright install chromium. This downloads packages and a browser build; the runner says so on stderr. Parallel runs wait for one install instead of repeating it.Set BROWSER_TESTING_NO_INSTALL=1 to have the runner report instead of installing. To install ahead of time by hand:
BT="${CLAUDE_PLUGIN_DATA}/browser-testing"
mkdir -p "$BT" && cp "${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/package.json" "${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/package-lock.json" "$BT/" \
&& (cd "$BT" && npm ci && npx playwright install chromium)
With the project's Playwright, only what that project installed is available: @axe-core/playwright (the accessibility template) needs the data-directory install.
User task → Is it static HTML file?
├─ Yes → Use file:// URL directly (file:///path/to/file.html)
│ ├─ Read HTML to identify selectors first
│ └─ Write Playwright script
│
└─ No (dynamic web app) → Is the server running?
├─ No → Detect common dev commands in package.json
│ Ask user to start server or offer to start it
│
└─ Yes → Use Reconnaissance-Then-Action Pattern:
1. Navigate with goto(url)
2. WAIT for a key element (expect(locator).toBeVisible())
3. Take screenshot or inspect DOM
4. Identify selectors from rendered state
5. Execute actions with discovered selectors
Follow these steps in order:
For localhost targets where the user hasn't given a URL, run server detection first, because the user may not know which port their server is on or may have several running. Use a URL the user provides directly.
NODE_PATH="${CLAUDE_PLUGIN_DATA}/browser-testing/node_modules" node -e "require('${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/lib/helpers').detectDevServers().then(s => console.log(JSON.stringify(s)))"
Decision logic:
file:/// URL directly, no server neededRules:
/tmp/playwright-test-*.js (not the skill directory)TARGET_URL constant at topheadless: false by default (visible browser for debugging)headless: true for CI/production or when user requests it⚠️ COMMON PITFALL:
goto, or gate tests on waitUntil: 'networkidle' (flaky: analytics, polling, and websockets keep the network busy)await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible()Template structure:
// /tmp/playwright-test-example.js
const { chromium } = require('playwright');
const { expect } = require('playwright/test'); // web-first assertions (auto-retry)
const TARGET_URL = 'http://localhost:3000'; // From Step 1
(async () => {
const browser = await chromium.launch({ headless: false, slowMo: 100 });
const page = await browser.newPage();
try {
console.log('🧪 Starting test...');
await page.goto(TARGET_URL);
// Wait for the element the test depends on, not for the network to go idle
await expect(page.getByRole('main')).toBeVisible({ timeout: 10000 });
console.log('✅ Page loaded:', await page.title());
// Test logic here
await page.screenshot({ path: '/tmp/playwright-<task>-page.png', fullPage: true });
console.log('📸 Screenshot saved');
console.log('✅ Test completed');
} catch (error) {
console.error('❌ Test failed:', error.message);
await page.screenshot({ path: '/tmp/playwright-<task>-error.png' });
throw error;
} finally {
await browser.close();
}
})();
BROWSER_TESTING_HOME="${CLAUDE_PLUGIN_DATA}/browser-testing" node "${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/scripts/run-playwright.js" /tmp/playwright-test-<name>.js
The runner executes one script per call; run each test file separately.
For dynamic web apps, follow this pattern:
await page.goto(TARGET_URL);
// Wait for a landmark you know will render (heading, main, a specific test id)
await expect(page.getByRole('main')).toBeVisible();
// One-off reconnaissance screenshot of an unknown page only (never in a test):
// await page.waitForLoadState('networkidle');
// Take screenshot for visual reference
await page.screenshot({ path: '/tmp/playwright-<task>-inspection.png', fullPage: true });
// Get all buttons
const buttons = await page.$$eval('button', btns =>
btns.map(b => ({ text: b.textContent.trim(), visible: b.offsetParent !== null }))
);
console.log('Found buttons:', buttons);
// Get all links
const links = await page.$$eval('a[href]', anchors =>
anchors.map(a => ({ text: a.textContent.trim(), href: a.href }))
);
// Get all inputs
const inputs = await page.$$eval('input, textarea, select', elements =>
elements.map(el => ({
name: el.name || el.id || 'unnamed',
type: el.type || 'text'
}))
);
// Use discovered selectors
await page.click('button:has-text("Submit")');
await page.fill('input[name="email"]', '[email protected]');
For detailed test pattern examples (element discovery, static HTML, console capture, E2E navigation, forms, responsive design, accessibility, login flows, link checking), see:
Use lib/helpers.js for common operations:
const helpers = require('${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/lib/helpers');
// Detect dev servers (use first!)
const servers = await helpers.detectDevServers();
// Safe click with retry
await helpers.safeClick(page, 'button.submit', { retries: 3 });
// Safe type with clear
await helpers.safeType(page, '#username', 'testuser');
// Take timestamped screenshot
await helpers.takeScreenshot(page, 'test-result');
// Handle cookie banners
await helpers.handleCookieBanner(page);
// Extract table data
const data = await helpers.extractTableData(page, 'table.results');
// Authenticate
await helpers.authenticate(page, {
username: '[email protected]',
password: 'password'
});
For simple one-off tasks:
BROWSER_TESTING_HOME="${CLAUDE_PLUGIN_DATA}/browser-testing" node "${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/scripts/run-playwright.js" "
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto('http://localhost:3000');
await page.screenshot({ path: '/tmp/playwright-<task>-quick.png', fullPage: true });
console.log('Screenshot saved');
await browser.close();
"
When to use:
await expect(locator).toBeVisible() (auto-retries); networkidle is DISCOURAGED by Playwright and acceptable only for one-off reconnaissance screenshotsdetectDevServers() for localhost testing/tmp/playwright-test-*.js for all tests (not the skill directory)TARGET_URL constant at topheadless: false by default, headless: true for CIslowMo: 100 when headless: falsewaitForSelector, waitForURL over fixed timeoutsfile:/// URLs for local HTML filespage.on('console') for debugging JS issuesPlaywright not available:
The runner prints why: BROWSER_TESTING_NO_INSTALL=1 is set, or the one-time install failed (the npm or playwright output is above the message; often no network). Report that output instead of working around it with hand-written scripts.
Module not found:
Run scripts through run-playwright.js with BROWSER_TESTING_HOME set as in the commands above (Claude Code), from the project's directory
Browser doesn't open:
Check headless: false and display available
Element not found:
Add wait: await page.waitForSelector('.element', { timeout: 10000 })
User: "Test if the marketing page looks good"
Process:
1. Run detectDevServers() → Found http://localhost:3001
2. Write responsive test to /tmp/playwright-test-marketing.js
3. Test desktop, tablet, mobile viewports
4. Execute: BROWSER_TESTING_HOME="${CLAUDE_PLUGIN_DATA}/browser-testing" node "${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/scripts/run-playwright.js" /tmp/playwright-test-marketing.js
5. Report: "✅ Tested across 3 viewports. Screenshots in /tmp/playwright-marketing-*.png"
User: "Check if my site is accessible"
Process:
1. Run detectDevServers() → Found http://localhost:3000
2. Write accessibility test to /tmp/playwright-test-a11y.js
3. Inject axe-core, run checks
4. Execute test
5. Report violations: "Found 3 issues: missing alt text, low contrast, missing ARIA labels"
lib/helpers.jsassets/test-templates/ — e2e/accessibility/performance scaffolds to copy as starting points instead of writing specs from scratchscripts/run-playwright.jsWhen a user wants to test a web page, complete these steps IN ORDER:
detectDevServers() for localhost targets without a user-provided URL/tmp/playwright-test-*.jsgoto, wait for the needed element with await expect(locator).toBeVisible() (no networkidle in tests)BROWSER_TESTING_HOME="${CLAUDE_PLUGIN_DATA}/browser-testing" node "${CLAUDE_PLUGIN_ROOT}/skills/browser-testing/scripts/run-playwright.js" /tmp/file.jsassets/test-templates/accessibility-template.js (opens in a new tab)assets/test-templates/e2e-template.js (opens in a new tab)assets/test-templates/performance-template.js (opens in a new tab)lib/helpers.js (opens in a new tab)package-lock.json (opens in a new tab)package.json (opens in a new tab)references/test-patterns.md (opens in a new tab)scripts/run-playwright.js (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ogxo-io/plugins --plugin ogxo-debug3 skills in this plugin
/css-alignment-debugUse when a CSS/HTML visual bug won't resolve from reading source — icon and text not lined up, element the wrong size, padding/margin off, sidebar overlapping main content, sticky/fixed element misplaced, a Vue/React/Svelte scoped style silently not applying, "my CSS edit isn't taking effect," or unsure an element is rendered where you think. Best after one round of reading the CSS hasn't revealed the cause./live-debugDebug running web apps by driving browser, reading console and network errors, iteratively fixing code. Use when the user reports a runtime symptom in a web app (broken layout, clicks that do nothing, JS or hydration errors, failing API calls) or wants to confirm a fix in the browser. For writing E2E test suites use ogxo-debug:browser-testing.