Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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

  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 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 for CSRF handling.
  3. 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 its describe title, 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 to frontend/tests/playwright/cicd-exclusions.json with a reason naming what covers it instead; an entry with titles ("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:

  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 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) or just test::slot to find the URL. Never hardcode https://localhost in tests, fixtures or commands; Playwright imports BASE_URL / API_URL from fixtures/base-url.ts.
  • Use just test::compose <args> for any compose command, never raw docker compose or docker 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-claim and just test::slot-release --slot N need 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 --stale does it now, and the opt-in just test::reaper install timer does it every 30 min.
  • The dota-lobby specs dri
Полный SKILL.md на GitHub

Установить testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/backend-test-endpoints.mdreferences/feature-isolation.mdreferences/layout-overlap.mdreferences/mobile-iteration-workflow.mdreferences/playwright-config.mdreferences/playwright-fixtures.mdreferences/populate-system.mdreferences/test-stack-slots.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить testing с