Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Testing

ASecurity

DraftForge test infrastructure for writing backend unit tests, Playwright E2E tests, and managing test data population. This skill should be used when writing new tests, adding test fixtures, creating populate functions for new features, adding Playwright E2E specs, using login/auth fixtures, creating test users/orgs/leagues/tournaments, or understanding the test data architecture. Covers backend Django tests via Docker, Playwright config (projects, workers, sharding), test auth endpoints tha...

15 stars
0 votes
0 copies
0 views
Added 10/4/2026
testingpythongobashreactdjangodockertestingapifrontendbackend

Works with

api

Security Analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned 10/4/2026

$npx -y skills add kettleofketchup/DraftForge --skill testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Testing?

Add the live security badge to your README — it updates automatically with every re-scan.

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

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

Download with Pro
Files
SKILL.md
---
name: testing
description: DraftForge test infrastructure for writing backend unit tests, Playwright E2E tests, and managing test data population. This skill should be used when writing new tests, adding test fixtures, creating populate functions for new features, adding Playwright E2E specs, using login/auth fixtures, creating test users/orgs/leagues/tournaments, or understanding the test data architecture. Covers backend Django tests via Docker, Playwright config (projects, workers, sharding), test auth endpoints that expose backend login to frontend, and feature-isolated test data patterns.
---

# DraftForge Testing Infrastructure

## Self-Updating

This skill documents live code. When modifying test infrastructure, update the relevant reference file.
To verify current state, read the source files referenced in each section.

## Critical Rules

1. **Always use `data-testid` selectors** in Playwright tests and demos. Never use `getByLabel`, `getByText`, or `getByRole('combobox')` for element interaction. See [playwright-fixtures.md](references/playwright-fixtures.md) for the full policy and exceptions.
2. **Use `postWithCsrf`/`patchWithCsrf`** for all POST/PATCH calls to DRF ViewSet endpoints (not test endpoints). See [playwright-fixtures.md](references/playwright-fixtures.md) for CSRF handling.

## Architecture Overview

Two-layer test data system:
1. **Data definitions** (`backend/tests/data/`) - Pydantic models (TestUser, TestOrganization, TestLeague, TestTeam, TestTournament)
2. **Populate functions** (`backend/tests/populate/`) - Create DB records from data definitions

Backend exposes `/api/tests/*` endpoints (TEST=true only) so Playwright can login, reset state, and create test-specific data.

## Key Principle: Feature-Isolated Test Data

Each feature's E2E tests MUST use dedicated test data. Never reuse another feature's org/league/tournament.

See [references/feature-isolation.md](references/feature-isolation.md) for the full pattern.

## Running Tests

```bash
# Backend (Docker - use --entrypoint "" to bypass daphne)
docker compose -f docker/docker-compose.test.yaml run --rm --entrypoint "" backend \
  python manage.py test app.tests.test_csv_import -v 2

# Playwright
just test::pw::headless              # All tests
just test::pw::spec csv-import       # Specific suite
just test::pw::ui                    # Interactive UI mode

# Full setup (down, update, build, populate, up)
just test::setup

# Repopulate test data only
just db::populate::all
```

## Cacheops and Test State Resets

Django cacheops is active in the test environment (1-hour TTL for Organization, League, etc.). **M2M changes (`.add()`, `.remove()`, `.clear()`) do NOT auto-invalidate cacheops cache.**

When writing test reset endpoints or backend views that modify M2M fields:

```python
from cacheops import invalidate_obj

org.admins.clear()
org.admins.add(admin_user)
invalidate_obj(org)  # REQUIRED after M2M changes
```

Without `invalidate_obj()`, subsequent GET requests return stale cached data — a common cause of flaky E2E tests where state resets appear to not take effect.

See [references/backend-test-endpoints.md](references/backend-test-endpoints.md) for the full pattern.

## Reference Files

| Reference | When to read |
|-----------|-------------|
| [populate-system.md](references/populate-system.md) | Adding test data, new populate functions, understanding data models |
| [playwright-fixtures.md](references/playwright-fixtures.md) | Writing E2E tests, using login fixtures, auth patterns |
| [backend-test-endpoints.md](references/backend-test-endpoints.md) | Adding new test API endpoints, understanding backend-frontend test bridge |
| [feature-isolation.md](references/feature-isolation.md) | Creating dedicated test data for a new feature's E2E tests |
| [playwright-config.md](references/playwright-config.md) | Test runner config, projects, workers, sharding, timeouts |
| [mobile-iteration-workflow.md](references/mobile-iteration-workflow.md) | Iterating on mobile overflow / hydration regressions across the `brand`, `ui-styling`, `i18n-react`, `playwright` skills |

## Quick Reference: Current Test Data

| Entity | Name | PK | steam_league_id |
|--------|------|----|-----------------|
| Org | DTX | 1 | - |
| Org | Test Organization | 2 | - |
| Org | CSV Import Org | 3 | - |
| Org | Events Test Org | 7 | - |
| League | DTX League | 1 | 17929 |
| League | Test League | 2 | 17930 |
| League | CSV Import League | 3 | 17931 |
| League | Events Test League | 7 | 17935 |

| User | PK | Role | Login fixture |
|------|----|------|--------------|
| kettleofketchup | 1001 | superuser | `loginAdmin()` |
| hurk_ | 1002 | staff | `loginStaff()` |
| bucketoffish55 | 1003 | regular | `loginUser()` |
| org_admin_tester | 1020 | org admin (org 1) | `loginOrgAdmin()` |
| org_staff_tester | 1021 | org staff (org 1) | `loginOrgStaff()` |
| league_admin_tester | 1030 | league admin | `loginLeagueAdmin()` |
| league_staff_tester | 1031 | league staff | `loginLeagueStaff()` |
| event_org_admin | 1080 | org admin (org 7) | `loginEventAdmin()` |
| event_player_1 | 1081 | regular | `loginEventPlayer()` |

> **NOTE**: When this table drifts from source, read `backend/tests/data/users.py` and `backend/tests/data/organizations.py` for truth.

Attribution

kettleofketchupkettleofketchup
View sourceSee grades on GitHubMore from kettleofketchup →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Screen Reader Testing

Practical guide to testing web applications with screen readers for comprehensive accessibility validation.

401991 votes

Tdd Workflow

在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,包含单元测试、集成测试和端到端测试,覆盖率超过80%。

2456590 votes

Eval Harness

克劳德代码会话的正式评估框架,实施评估驱动开发(EDD)原则

2456590 votes

Python Testing

使用pytest、TDD方法、夹具、模拟、参数化和覆盖率要求的Python测试策略。

2456590 votes

Django Tdd

Django测试策略,包括pytest-django、TDD方法论、factory_boy、模拟、覆盖率以及测试Django REST Framework API。

2456590 votes
View all in testing →