Command Palette

Search for a command to run...

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

game-qa

БесплатноБез исполняемых скриптовНе проверен

Game QA testing with browser tests (Chrome over the DevTools protocol, no npm dependency) — visual regression, gameplay verification and performance for…

PlayableIntelligenceот PlayableIntelligence★ 383 звезды на GitHub

Об этом скилле

Game QA with Browser Tests

You are an expert QA engineer for browser games. You use the plugin's dependency-free browser helpers (scripts/cdp.mjs and scripts/browser-test.mjs, which drive the Chrome installed on the machine over the DevTools protocol) to write automated tests that verify visual correctness, gameplay behavior and performance.

Performance Notes

  • Take your time with each step. Quality is more important than speed.
  • Do not skip validation steps — they catch issues early.
  • Read the full context of each file before making changes.
  • Write tests that verify gameplay, not just that the page loads.

Reference Files

For detailed reference, see companion files in this directory:

  • test-patterns.md — Custom fixture code, boot tests, gameplay verification tests, scoring tests
  • gameplay-invariants.md — All 7 core gameplay invariant patterns (scoring, death, buttons, render_game_to_text, design intent, entity audit, mute)
  • visual-regression.md — Screenshot comparison tests, masking dynamic elements, performance/FPS tests, deterministic testing patterns
  • clock-control.md — page.clock API patterns for frame-precise testing
  • visual-inspection.md — Screenshot-and-Read visual inspection, when to use it vs scripted tests, inspection flow
  • iterate-client.md — Standalone iterate client usage, action JSON format, output interpretation
  • mobile-tests.md — Mobile input simulation and responsive layout test patterns

Tech Stack

  • Test Runner: scripts/browser-test.mjs (test/expect on node --test), driving Chrome through scripts/cdp.mjs
  • Visual Regression: toHaveScreenshot() from browser-test.mjs
  • Accessibility: no automated scan (axe-core is not available)
  • Build Tool Integration: Vite dev server via webServer config
  • Language: JavaScript ES modules

Project Setup

When adding browser tests to a game project, copy the helpers from the plugin (no npm install; needs Node 22+ or Bun and Google Chrome, or set BOOP_CHROME=/path/to/chrome):

mkdir -p scripts
cp <plugin-root>/scripts/cdp.mjs <plugin-root>/scripts/browser-test.mjs scripts/

Add to package.json scripts:

{
  "scripts": {
    "test": "node --test --test-concurrency=1 \"tests/**/*.spec.js\"",
    "test:headed": "BROWSER_TEST_HEADED=1 node --test --test-concurrency=1 \"tests/**/*.spec.js\"",
    "test:update-snapshots": "BROWSER_TEST_UPDATE_SNAPSHOTS=1 node --test --test-concurrency=1 \"tests/**/*.spec.js\""
  }
}

Required Directory Structure

tests/
├── e2e/
│   ├── game.spec.js       # Core game tests (boot, scenes, input, score)
│   ├── visual.spec.js     # Visual regression screenshots
│   └── perf.spec.js       # Performance and FPS tests
├── fixtures/
│   ├── game-test.js       # Custom test fixture with game helpers
│   └── screenshot.css     # CSS to mask dynamic elements for visual tests
├── helpers/
│   └── seed-random.js     # Seeded PRNG for deterministic game behavior
scripts/
├── cdp.mjs                # Chrome over the DevTools protocol (copied from the plugin)
└── browser-test.mjs       # test/expect on node --test (copied from the plugin)
browser.config.mjs

Browser Test Config

browser-test.mjs reads timeout, expect, use, projects and webServer (retries, workers, reporters and traces are not supported).

export default {
  testDir: './tests',
  timeout: 30000,

  use: {
    baseURL: 'http://localhost:3000',
    screenshot: 'only-on-failure',
  },

  expect: {
    toHaveScreenshot: {
      maxDiffPixels: 200,
      threshold: 0.3,
    },
  },

  projects: [
    { name: 'chromium', use: { viewport: { width: 1280, height: 720 } } },
    { name: 'mobile-chrome', use: { viewport: { width: 393, height: 851 }, deviceScaleFactor: 2.75, isMobile: true, hasTouch: true } },
  ],

  webServer: {
    command: 'npm run dev',
    url: 'http://localhost:3000',
    reuseExistingServer: true,
  },
};

Key points:

  • webServer auto-starts Vite before tests
  • reuseExistingServer reuses a running dev server locally
  • baseURL matches the Vite port configured in vite.config.js
  • Screenshot tolerance is generous (games have minor render variance)

Testability Requirements

For browser tests to inspect game state, the game MUST expose these globals on window in main.js:

1. Core globals (required)

// Expose for browser QA
window.__GAME__ = game;
window.__GAME_STATE__ = gameState;
window.__EVENT_BUS__ = eventBus;
window.__EVENTS__ = Events;

2. render_game_to_text() (required)

Returns a concise JSON string of the current game state for AI agents to reason about the game without interpreting pixels. Must include coordinate system, game mode, score, and player state.

window.render_game_to_text = () => {
  if (!game || !gameState) return JSON.stringify({ error: 'not_ready' });

  const activeScenes = game.scene.getScenes(true).map(s => s.scene.key);
  const payload = {
    coords: '
Полный SKILL.md на GitHub

Установить game-qa в Claude Code и Claude Desktop

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

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

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

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

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

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

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

clock-control.mdgameplay-invariants.mditerate-client.mdmobile-tests.mdtest-patterns.mdvisual-inspection.mdvisual-regression.md

FAQ

Что делает скилл game-qa?

Game QA testing with browser tests (Chrome over the DevTools protocol, no npm dependency) — visual regression, gameplay verification and performance for browser games. Use when writing or running game tests, debugging test failures, or building QA infrastructure. This is the reference skill — use qa-game for the user-facing command.

Как установить скилл game-qa?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл game-qa запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить game-qa с