stablyai/agent-skills/playwright-test-data-isolation
Claude Code and agent skill by stablyai/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Playwright-first strategy for shared DB + shared test accounts. Use when E2E tests collide in QA/staging, need safe parallelism, or require deterministic cleanup without touching baseline data. Covers per-test ownership, namespacing, ID-based teardown, serial shared-state suites, and optional stale-data janitor jobs.
Install
npx vskill@latest install stablyai/agent-skills/playwright-test-data-isolationSKILL.md
The same SKILL.md was published earlier as stablyai/agent-skills/playwright-test-data-isolation.
Playwright Test Data Isolation
Use this skill when teams run Playwright tests in a shared QA/staging environment with:
- A shared database (often production-connected)
- Shared test user accounts
- Parallel CI and local test runs
- Flaky tests caused by data collisions, cross-test interference, or unsafe cleanup
Goal: make tests parallel-safe and operationally safe while staying standard Playwright.
When To Use This Skill
Use this skill for tasks like:
- "Our Playwright tests share a database and keep colliding"
- "How do we run E2E safely with shared accounts?"
- "How should we isolate test data in CI?"
- "How do we clean up test data without deleting real data?"
- "How do we keep parallel Playwright runs stable?"
- "How do we design fixtures for safe create-and-cleanup?"
Core Contract (Non-Negotiable)
Every test must follow this contract:
- Create the entities it needs (test-owned data).
- Mutate only entities it created.
- Treat shared baselines (accounts, workspaces, org settings) as read-only.
- Clean up by exact IDs captured during the test (never broad filters).
If a test cannot follow this contract, move it to a serial suite.
Non-Negotiable Guardrails
- Treat shared users and shared workspaces as read-only containers.
- Never update shared workspace settings, membership, billing, or global toggles in parallel suites.
- Prefix test-created records with a unique namespace (
e2e-<run>-<worker>-<uuid>). - Delete by exact IDs; never run broad delete filters in test teardown.
- Keep a scheduled stale-data janitor as backup, not as the primary cleanup mechanism.
Recommended Architecture
Use shared accounts for authentication only, then isolate all mutable data by namespace.
- Shared accounts: identity only
- Test data: fully owned by one test via namespace
- Cleanup: deterministic, ID-based, reverse order
- Shared-state mutation suites: serialized
- Scheduled cleanup: removes stale
e2e-*artifacts older than a threshold
Account Strategy
Pick the highest isolation level your environment can support:
- Best: one account per worker (pool accounts and map by
workerIndex). - Acceptable: shared account for sign-in only, test-owned child data for all writes.
- Avoid: many tests mutating top-level account/workspace settings in parallel.
Implementation Pattern (Playwright-Native)
1) Reuse auth state for shared accounts (setup project)
Wire this into a setup project dependency in playwright.config.ts so parallel projects reuse a stable signed-in state.
2) Add namespace + cleanup tracker fixtures
Notes:
runId + project + worker + uuidkeeps names unique across CI, shards, and local runs.- Reverse-order cleanup (LIFO) avoids dependency-order teardown bugs.
3) Create child resources in shared containers only
4) Isolate true shared-state tests in serial suites
Only use this for tests that must mutate global/shared settings. Keep most tests fully parallel by using test-owned child resources.
5) Add a stale-data janitor project (backup safety net)
Run janitor on a schedule (nightly or multiple times/day), but keep per-test cleanup as the primary defense.
Collision Debugging Checklist
When a test collides, collect these first:
- Namespace used by each failing test
- Worker index and project name
- IDs created by each test before cleanup
- Which shared entity was mutated (if any)
If retries make failures disappear, treat that as a signal of shared-state coupling, not success.
Optional: If Team Uses Stably
Stably can help with orchestration and operations, but this strategy does not depend on it.
- Use
npx stably testas a Playwright-compatible runner wrapper when you want hosted reporting/ops. - Use Stably environments to inject shared account credentials by environment.
- Use Stably schedules/cloud workers for janitor jobs and large parallel runs.
- Keep the same isolation contract regardless of runner.
Anti-Patterns To Block
- Parallel tests writing to the same shared entity
- Shared mutable fixtures reused across files
- Cleanup using broad filters like "delete all e2e rows"
- Relying on execution order
- Using retries to mask shared-data collisions
- Treating nightly cleanup as the only cleanup
Agent Output Requirements
When this skill is activated, the agent should:
- Confirm environment constraints (shared DB, shared accounts, parallelism level).
- Produce or update a namespace fixture and deterministic cleanup tracker.
- Classify tests into parallel-safe vs shared-state-mutation suites.
- Refactor at least one target test to create-and-own data.
- Add or propose a stale-data cleanup project and schedule.
- Return a short risk report listing remaining unsafe tests.
Rollout Plan
- Add namespace + cleanup fixtures.
- Migrate flaky mutable tests to create-and-own data.
- Add cleanup project and schedule.
- Move shared-state mutation tests to serial mode.
- Increase workers only after collision-free runs.
Success Criteria
- Parallel runs no longer collide on shared data.
- Teardown never touches non-test data.
- Flake rate drops for data-dependent tests.
- Shared environment remains stable for manual QA and CI.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/playwright-test-data-isolation/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/stablyai/agent-skills/playwright-test-data-isolation)