testing
БесплатноБез исполняемых скриптовНе проверенDraftForge test infrastructure for writing backend unit tests, Playwright E2E tests, and managing test data population. This skill should be used when writing…
от kettleofketchup★ 16 звёзд на GitHubОб этом скилле
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
- Always use
data-testidselectors in Playwright tests and demos. Never usegetByLabel,getByText, orgetByRole('combobox')for element interaction. See playwright-fixtures.md for the full policy and exceptions. - Use
postWithCsrf/patchWithCsrffor all POST/PATCH calls to DRF ViewSet endpoints (not test endpoints). See playwright-fixtures.md for CSRF handling. - Every e2e test is either in CI or excluded with a reason. CI runs Playwright with
--grep @cicd(just test::pw::cicd-*). Tag a test@cicd(in its title or itsdescribetitle, e.g.test.describe('League tabs (@cicd)', ...)) when it covers a feature no other CI-run spec, Vitest or backend test covers. Otherwise (slow and largely redundant, visual-only, manual) add it tofrontend/tests/playwright/cicd-exclusions.jsonwith areasonnaming what covers it instead; an entry withtitles("Describe › test") excludes only those tests.just test::pw::cicd-coverage(Unit tests CI job) fails on any e2e test that is in neither; statically skipped tests (test.skip,describe.skip) are ignored.
Architecture Overview
Two-layer test data system:
- Data definitions (
backend/tests/data/) - Pydantic models (TestUser, TestOrganization, TestLeague, TestTeam, TestTournament) - 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 for the full pattern.
Running Tests
# Backend (Docker; test::run passes --entrypoint "" to bypass daphne)
just test::run 'python manage.py test tournament.tests.test_csv_import -v 2'
# Same thing through the slot-aware compose wrapper (never raw docker compose)
just test::compose run --rm --entrypoint "" backend python manage.py test tournament.tests.test_csv_import -v 2
# Only what this branch's changes reach (backend import graph + whole apps Django
# loads by name, `vitest related`); --plan prints the selection and why. Use it
# while iterating; the full suites below are the gate.
just test::affected
just test::affected --plan
# Whole backend suite, exactly what CI runs (no labels = discover all of backend/)
just test::run 'python manage.py test -v 2'
# CI discovers new modules automatically; write TestCase/SimpleTestCase classes,
# not bare pytest functions (the Django runner skips those).
# Playwright
just test::pw::headless # All tests
just test::pw::spec csv-import # Specific suite
just test::pw::ui # Interactive UI mode
just test::pw::report # Newest run's HTML report
# Each local run writes to its own frontend/test-results/runs/<id>/
# (artifacts/, report/, run-logs/); frontend/test-results/latest is the newest.
# CI keeps the flat frontend/test-results/.
# Full setup (down, update, build, populate, up)
just test::setup
# test::up/upd pull + extract the cached test DB first if backend/test.db.sqlite3 is missing or empty,
# and grant the container user write access to it under rootless podman
# Repopulate test data only
just db::populate::all
Test Stack Slots (which port, two worktrees)
Every worktree runs its own test stack in a slot: slot 0 is project df on
https://localhost, slot N ≥ 1 is df-sN on https://localhost:1N443.
- Run
just test::slots(read-only) orjust test::slotto find the URL. Never hardcodehttps://localhostin tests, fixtures or commands; Playwright importsBASE_URL/API_URLfromfixtures/base-url.ts. - Use
just test::compose <args>for any compose command, never rawdocker composeordocker exec <name>. - Slots N ≥ 1 run without the Discord bot, celery beat and real Discord/Steam tokens unless
just test::background on. just test::slot-reap,just test::slot-claimandjust test::slot-release --slot Nneed no user approval. Before using one on another worktree's slot, verify no agent is working in or testing against it (owner worktree activity, the project's containers and logs, test processes with that cwd, peer Claude sessions). If in doubt, don't touch it.- Slots idle more than 4h (1h when the owner's PR is merged/closed or its worktree is gone) are reaped automatically on the next allocation;
just test::slot-reap --staledoes it now, and the opt-injust test::reaper installtimer does it every 30 min. - The dota-lobby specs dri
Установить testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл testing?
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, feature-isolated test data patterns, and per-worktree test stack slots (which port, two worktrees, test stack slot, which URL, slot-reap).
Как установить скилл testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic