Skip to content
Back to skills

Playwright Testing

ASecurity

Write reliable, fast Playwright tests: user-facing locators, web-first assertions, auth storageState and tracing

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
developmenttestingdebugginggitapibackend

Works with

  • api

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill playwright-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Playwright Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Playwright Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-playwright-testing-anvil/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-playwright-testing-anvil)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: playwright-testing
description: "Write reliable, fast Playwright tests: user-facing locators, web-first assertions, auth storageState and tracing"
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# Playwright testing

Use when writing or debugging Playwright specs, page fixtures, or browser CI pipelines.

## Locators and auto-waiting
- Pick resilient user-facing locators in order: `getByRole`, `getByLabel`, `getByPlaceholder`, `getByText`, and explicit `getByTestId` last. Never anchor selectors on generated CSS classes or brittle DOM hierarchy (`div > div:nth-child(3)`).
- Always use async web-first assertions (`await expect(locator).toBeVisible()`, `toHaveText(...)`, `toHaveURL(...)`) which retry automatically until timeout. Never read synchronous `.isVisible()` or `.textContent()` before settling, and never add `page.waitForTimeout(...)`.

## Isolation and authentication
- Keep every test self-contained with isolated test accounts/records and zero cross-test ordering assumptions.
- Authenticate once in a setup project (`storageState: ".auth/user.json"`, gitignored) instead of signing in through the UI before every single spec; use separate storage states for role/admin comparisons.
- Use `page.route(...)` selectively for deterministic third-party API stubs, never to mock away your own failing backend without contract coverage.

## CI diagnostics
Configure `trace: "on-first-retry"`, `screenshot: "only-on-failure"`, `retries: process.env.CI ? 2 : 0`, and shard suites across workers (`--shard=1/4`) in CI.

## Verify
Run changed specs with `--repeat-each=5` locally to catch flakiness before merging, and inspect trace zips (`playwright show-trace`) on any CI failure.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.