本文へ移動
cccskills
無料GitHub で公開

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, and feature-isolated test data patterns.

インストール方法を見る

含まれるファイル(7)

  • SKILL.md5.2 KB
  • references/backend-test-endpoints.md7.1 KB
  • references/feature-isolation.md4.1 KB
  • references/mobile-iteration-workflow.md5.2 KB
  • references/playwright-config.md2.6 KB
  • references/playwright-fixtures.md10.8 KB
  • references/populate-system.md5.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.

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 - 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:

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 for the full pattern.

Reference Files

ReferenceWhen to read
populate-system.mdAdding test data, new populate functions, understanding data models
playwright-fixtures.mdWriting E2E tests, using login fixtures, auth patterns
backend-test-endpoints.mdAdding new test API endpoints, understanding backend-frontend test bridge
feature-isolation.mdCreating dedicated test data for a new feature's E2E tests
playwright-config.mdTest runner config, projects, workers, sharding, timeouts
mobile-iteration-workflow.mdIterating on mobile overflow / hydration regressions across the brand, ui-styling, i18n-react, playwright skills

Quick Reference: Current Test Data

EntityNamePKsteam_league_id
OrgDTX1-
OrgTest Organization2-
OrgCSV Import Org3-
OrgEvents Test Org7-
LeagueDTX League117929
LeagueTest League217930
LeagueCSV Import League317931
LeagueEvents Test League717935
UserPKRoleLogin fixture
kettleofketchup1001superuserloginAdmin()
hurk_1002staffloginStaff()
bucketoffish551003regularloginUser()
org_admin_tester1020org admin (org 1)loginOrgAdmin()
org_staff_tester1021org staff (org 1)loginOrgStaff()
league_admin_tester1030league adminloginLeagueAdmin()
league_staff_tester1031league staffloginLeagueStaff()
event_org_admin1080org admin (org 7)loginEventAdmin()
event_player_11081regularloginEventPlayer()

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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

aesthetic

無料

Create aesthetically beautiful interfaces following proven design principles. Use when building UI/UX, analyzing designs from inspiration sites, generating design images with ai-multimodal, implementing visual hierarchy and color theory, adding micro-interactions, or creating design documentation. Includes workflows for capturing and analyzing inspiration screenshots with chrome-devtools and ai-multimodal, iterative design image generation until aesthetic standards are met, and comprehensive design system guidance covering BEAUTIFUL (aesthetic principles), RIGHT (functionality/accessibility), SATISFYING (micro-interactions), and PEAK (storytelling) stages. Integrates with chrome-devtools, ai-multimodal, media-processing, ui-styling, and web-frameworks skills.

日本語の概要は準備中です。原文の説明を表示しています。

kettleofketchup/DraftForge152026年9月14日 更新

Proper usage of Bash and file operation tools. Use this skill when executing shell commands, writing files, or when tempted to use echo/cat/heredoc to pipe content to files. Prevents permission circumvention patterns like piping multiline content through echo instead of using Write tool. Covers Bash tool, Write tool, Edit tool, and Read tool best practices.

日本語の概要は準備中です。原文の説明を表示しています。

kettleofketchup/DraftForge152026年9月14日 更新

brand

無料

DraftForge brand/theming review. Flags raw <button> over PrimaryButton/SecondaryButton, hardcoded violet/slate over brand tokens, inline styles, missing UserAvatar/EntityBreadcrumb.

日本語の概要は準備中です。原文の説明を表示しています。

kettleofketchup/DraftForge152026年9月14日 更新

Browser automation, debugging, and performance analysis using Puppeteer CLI scripts. Use for automating browsers, taking screenshots, analyzing performance, monitoring network traffic, web scraping, form automation, and JavaScript debugging.

日本語の概要は準備中です。原文の説明を表示しています。

kettleofketchup/DraftForge152026年9月14日 更新

Django Redis caching with django-cacheops. This skill should be used when implementing caching, adding cache invalidation, optimizing API performance, modifying models that affect cached data, or debugging cache-related issues in the Django backend.

日本語の概要は準備中です。原文の説明を表示しています。

kettleofketchup/DraftForge152026年9月14日 更新

Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.

日本語の概要は準備中です。原文の説明を表示しています。

kettleofketchup/DraftForge152026年9月14日 更新

kettleofketchup のスキルをすべて見る

このスキルの問題を報告する