playwright

A set of instructions for writing Playwright end-to-end tests, which check a complete user flow in a real application. It follows the project's shared element selectors and conventions.

In plain words
What is it for?
Writing or updating Playwright tests for the Nimbalyst editor, including checking tabs and file-specific editors.
Why use it?
It helps tests keep working when the application has several tabs, windows, or editor areas. It avoids vague element matches and selectors copied directly from page markup.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/nimbalyst/nimbalyst/playwright
Clone the repo
git clone --depth 1 https://github.com/nimbalyst/nimbalyst

Made for: Claude Code.

Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,550 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00015 $0.02550
Opus 5 $0.00008 $0.01275
Sonnet 5 $0.00003 $0.00510
Haiku 4.5 $0.00002 $0.00255

Measured yesterday against content hash 4396eed0d272, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

playwright scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/playwright.md · 286 lines

How it starts

The opening of the file, as written. The whole thing — 286 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Playwright E2E Test Instructions

You are writing Playwright E2E tests for the Nimbalyst editor. Follow these rules STRICTLY.

Critical Rules

1. NEVER Hardcode Selectors

Import and use selectors from PLAYWRIGHT_TEST_SELECTORS in e2e/utils/testHelpers.ts.

// BAD - NEVER DO THIS
await page.locator('.tab-dirty-indicator').toBeVisible();
await page.locator('[contenteditable="true"]').click();

// GOOD - Use shared selectors AND target by document path
import { PLAYWRIGHT_TEST_SELECTORS, getTabByFileName } from '../utils/testHelpers';

const tab = getTabByFileName(page, 'test.md');
await expect(tab.locator(PLAYWRIGHT_TEST_SELECTORS.tabDirtyIndicator)).toBeVisible();

// For editors, scope to the specific file's editor
const editor = page.locator(`[data-filepath="${filePath}"]`);
await editor.locator(PLAYWRIGHT_TEST_SELECTORS.contentEditable).click();

If a selector doesn't exist in PLAYWRIGHT_TEST_SELECTORS, ADD IT THERE first.

2. NEVER Use .first() as a Lazy Escape Hatch

Nimbalyst is a complex app with multiple windows, multiple editor tabs, multiple AI sessions, etc. You MUST target elements precisely.

// BAD - Lazy, will break with multiple tabs/editors
await page.locator('.tab').first().click();
await page.locator('.monaco-editor').first().type('hello');
await page.locator('[contenteditable="true"]').first().click();

// GOOD - Target precisely using data attributes
await page.locator('[data-testid="tab"][data-filepath="/path/to/file.md"]').click();
await page.locator('[data-testid="monaco-editor"][data-filepath="/path/to/file.ts"]').type('hello');

If you can't target an element precisely:

  1. ADD a data-testid attribute to the component
  2. ADD a data-filepath, data-session-id, or other identifying data attribute
  3. Update PLAYWRIGHT_TEST_SELECTORS with the new selector
  4. THEN write the test

Common data attributes we use:

  • data-testid - Unique identifier for test targeting
  • data-filepath - Full path to file for editors/tabs
  • data-filename - Filename for simpler cases
  • data-session-id - AI session identifier
  • data-tab-type - "document" or "session"
  • data-active - "true"/"false" for active state

Read the full file on GitHub · 286 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 286 lines · 15 tokens per session scan A 4396eed0d272

Subscribe to this mod's changes

playwright is a command published in the GitHub repository nimbalyst/nimbalyst (1,609 stars, last pushed 3d ago), licensed MIT. It adds 15 tokens to every session and 2,550 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.