/v1tamins:v1-e2e-testingfrom v1tamins
Implements and debugs browser end-to-end tests with Playwright. Covers critical user journeys, flaky test resolution, and server orchestration.
Ships in v1tamins. 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.
Build reliable, fast E2E test suites that catch regressions and enable confident deployments.
The server helper requires POSIX process groups (macOS/Linux). Run the shell blocks with Bash; if your tool defaults to zsh or another shell, select Bash before executing them. Cache glob handling depends on that shell.
Test a local web application:
# If server not running, resolve the bundled helper first
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
RESOLVER=""
for candidate in \
"$REPO_ROOT/plugins/v1tamins/scripts/resolve-skill-root.sh" \
"${CLAUDE_PLUGIN_ROOT:-}/scripts/resolve-skill-root.sh" \
"$HOME/.claude/skills/v1-e2e-testing/../../scripts/resolve-skill-root.sh" \
"$HOME/.codex/skills/v1-e2e-testing/../../scripts/resolve-skill-root.sh" \
"$HOME/.claude/plugins/cache"/*/v1tamins/*/scripts/resolve-skill-root.sh \
"$HOME/.codex/plugins/cache/v1tamins/v1tamins"/*/scripts/resolve-skill-root.sh; do
[ -x "$candidate" ] && RESOLVER="$candidate" && break
done
if [ -z "${RESOLVER:-}" ]; then
echo "ERROR: Could not find resolve-skill-root.sh" >&2
exit 1
fi
SKILL_ROOT="$("$RESOLVER" v1-e2e-testing scripts/with_server.py)"
python3 "$SKILL_ROOT/scripts/with_server.py" --server "npm run dev" --port 3000 -- python your_test.py
# If server already running, write Playwright directly
Basic Playwright test:
from playwright.sync_api import expect, sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
page.goto('http://localhost:3000')
expect(page.get_by_role('button', name='Login')).to_be_visible() # Wait for the app to render
# Reconnaissance first
page.screenshot(path='/tmp/inspect.png', full_page=True)
# Then actions
page.get_by_role('button', name='Login').click()
browser.close()
Good for:
Not for:
User task → Is it static HTML?
├─ Yes → Read HTML file directly for selectors
│ └─ Write Playwright script using selectors
│
└─ No (dynamic webapp) → Is the server already running?
├─ No → Use scripts/with_server.py
│
└─ Yes → Reconnaissance-then-action:
1. Navigate and assert a key element is visible
2. Take screenshot or inspect DOM
3. Identify selectors from rendered state
4. Execute actions with discovered selectors
When using Playwright as a debug loop, make the script prove the specific symptom the user reported:
// playwright.config.ts
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./e2e",
timeout: 30000,
expect: { timeout: 5000 },
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [["html"], ["github"]],
use: {
baseURL: "http://localhost:3000",
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "retain-on-failure",
},
projects: [
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
{ name: "firefox", use: { ...devices["Desktop Firefox"] } },
{ name: "webkit", use: { ...devices["Desktop Safari"] } },
{ name: "mobile", use: { ...devices["iPhone 13"] } },
],
});
Encapsulate page logic in classes:
// pages/LoginPage.ts
import { Page, Locator } from "@playwright/test";
export class LoginPage {
readonly page: Page;
readonly emailInput: Locator;
readonly passwordInput: Locator;
readonly loginButton: Locator;
constructor(page: Page) {
this.page = page;
this.emailInput = page.getByLabel("Email");
this.passwordInput = page.getByLabel("Password");
this.loginButton = page.getByRole("button", { name: "Login" });
}
async goto() {
await this.page.goto("/login");
}
async login(email: string, password: string) {
await this.emailInput.fill(email);
await this.passwordInput.fill(password);
await this.loginButton.click();
}
}
// Usage in tests
test("successful login", async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.goto();
await loginPage.login("[email protected]", "password123");
await expect(page).toHaveURL("/dashboard");
});
page.getByRole('button', { name: 'Submit' })page.getByLabel('Email')page.getByPlaceholder('Search...')page.getByTestId('submit-button')page.getByText('Welcome')page.locator('.btn-primary') - brittle!Multi-candidate strategy for Auth0/iframes:
// Frame-aware selectors
const frame = page.frameLocator('[data-testid="auth0-frame"]');
await frame.getByRole('textbox', { name: 'Email' }).fill(email);
// BAD: Fixed timeouts
await page.waitForTimeout(3000); // Flaky!
// GOOD: Wait for specific conditions
await page.waitForURL("/dashboard");
// BETTER: Auto-waiting with assertions
await expect(page.getByText("Welcome")).toBeVisible();
await expect(page.getByRole("button")).toBeEnabled();
// Wait for API response
const responsePromise = page.waitForResponse(
(res) => res.url().includes("/api/users") && res.status() === 200
);
await page.getByRole("button", { name: "Load" }).click();
await responsePromise;
Storage state for pre-auth (recommended):
// global-setup.ts
async function globalSetup() {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto("/login");
await page.getByLabel("Email").fill(process.env.TEST_USER!);
await page.getByLabel("Password").fill(process.env.TEST_PASSWORD!);
await page.getByRole("button", { name: "Login" }).click();
await page.waitForURL("/dashboard");
await page.context().storageState({ path: "auth.json" });
await browser.close();
}
// playwright.config.ts
use: {
storageState: "auth.json",
}
# Headed mode
npx playwright test --headed
# Debug mode (step through)
npx playwright test --debug
# Pause in test
await page.pause(); # Opens inspector
# Trace viewer
npx playwright show-trace trace.zip
Add test steps for reporting:
test('checkout flow', async ({ page }) => {
await test.step('Add item to cart', async () => {
await page.goto('/products');
await page.getByRole('button', { name: 'Add to Cart' }).click();
});
await test.step('Proceed to checkout', async () => {
await page.goto('/cart');
await page.getByRole('button', { name: 'Checkout' }).click();
});
});
| Cause | Fix |
|---|---|
| Fixed timeouts | Use web-first assertions (expect(locator).toBeVisible()) |
| Race conditions | Wait for specific state before acting |
| Test interdependence | Make tests independent, clean up data |
| Stale selectors | Use role-based selectors, avoid CSS classes |
| Animation interference | Wait for animations, disable in test mode |
Root cause checklist:
waitForTimeout() anywhere? Replace with proper waitsscripts/with_server.py - Server lifecycle management
Requires Python 3 and POSIX process groups (macOS/Linux). Server commands must
stay in the foreground. The helper rejects a port that already has a listener,
fails when a server command exits before readiness, and stops each launched
process group, including shell-wrapper descendants, on completion or startup
failure. SIGINT, SIGTERM, and SIGHUP also stop the owned server and test command
groups, with exit status 128 + signal number. SIGKILL cannot trigger cleanup.
It returns the test command's exit status normally; setup errors return nonzero.
TCP readiness only means the port accepts connections. Keep the application
assertions in the test; an open port does not prove that the intended page or
API is healthy. Use an already-running server directly when that is intended.
# Single server (resolve SKILL_ROOT as shown in Quick Start)
python3 "$SKILL_ROOT/scripts/with_server.py" --server "npm run dev" --port 3000 -- python test.py
# Multiple servers (backend + frontend)
python3 "$SKILL_ROOT/scripts/with_server.py" \
--server "cd backend && python server.py" --port 3000 \
--server "cd frontend && npm run dev" --port 5173 \
-- python test.py
Run python3 "$SKILL_ROOT/scripts/with_server.py" --help first.
.btn.btn-primary, use rolesFor advanced Playwright patterns, see:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub v1-io/v1tamins --plugin v1tamins42 skills in this plugin
/v1-address-reviewUse when resolving existing PR review comments or threads. Triggers on "address review feedback", "fix review comments", or "resolve review threads"./v1-autoresearch-skillUse when explicitly running a measured optimization loop against a target. Triggers on "run autoresearch" or "keep only measured improvements"./v1-bare-bonesUse when reducing a plan, PRD, or proposal to the smallest useful scope. Triggers on "strip this plan", "MVP only", or "remove scope"./v1-bigxtha-pluginUse when designing or reviewing a skill plugin's architecture, shared resources, skill handoffs, or cross-skill change impact./v1-canon2skillUse when extracting reusable Agent Skill ideas from books, PDFs, articles, courses, or notes. Triggers on "extract skills from this" or "what skills could come from this?"./v1-changelogUse when writing release notes from merged PRs. Triggers on "write changelog", "release notes", or "what shipped".