testing
БесплатноБез исполняемых скриптовНе проверенGuidance for writing and running tests in Simple History, including the Premium add-on. Covers which framework to use, how to run existing tests, how to…
от bonny★ 315 звёзд на GitHubОб этом скилле
Testing in Simple History
Which framework to use
| What you're testing | Framework | Why |
|---|---|---|
| Browser UI, admin pages, visual behaviour | Playwright | Fast, visible, modern — new default for UI tests |
| PHP logic, WordPress integration, database queries | Codeception / WPUnit | Full WordPress environment loaded in PHP |
| HTTP-level WordPress behaviour | Codeception / Functional | No browser needed |
Rule of thumb: If a human would test it by clicking around in a browser, use Playwright. If it's PHP logic, use Codeception.
Running tests
# Playwright (UI tests) — runs on host machine against the dev WordPress
npm run test:playwright # headless, output in playwright-report/
npm run test:playwright:ui # interactive UI mode (recommended for writing/debugging)
# Codeception (PHP tests) — runs inside Docker
npm run test:wpunit # PHP unit + WordPress integration
npm run test:functional # HTTP-level tests
npm run test:acceptance # legacy browser tests (Selenium — prefer Playwright for new ones)
# Full PHP suite (Codeception only — does NOT include Playwright)
npm test
# In a git worktree these npm scripts fail (container-name clash, symlinked
# vendor, empty tests/plugins). See "Checks and tests inside a worktree" in
# the worktree skill for the docker command that works there.
Note: npm test runs only the Codeception suite. To get full coverage, run both npm run test:playwright and npm test separately.
Testing Simple History Premium
Premium is covered by PHP tests — but they live in this (core) repo, not in the add-ons repo. One harness, in core; Premium borrows it.
| Location | What's there |
|---|---|
tests/wpunit/premium/ |
11 test files, ~229 tests. Alerts (evaluator/logger/module), custom rules, destination senders, formatters, extended settings, WP-CLI alerts command, both REST controllers, core-vs-premium behaviour |
tests/functional/premium/ |
AlertsCliCest.php |
tests/playwright/ |
premium-settings-logging.spec.js, license-reminder.spec.js, plus premium-helpers.js |
tests/_support/Helper/PremiumTestCase.php |
Base class — call $this->activate_premium(); it skips (not fails) when Premium isn't installed |
Run them:
docker compose run --rm php-cli vendor/bin/codecept run wpunit premium # ~15s
How Premium gets loaded
Premium is mounted into the test WordPress at tests/plugins/simple-history-premium,
a symlink to the local add-ons checkout, wired up in compose.yaml. The symlink is
not tracked in git — on a fresh machine it's absent and every Premium test silently
skips. A green run therefore does not prove Premium passed; check the skip count.
Create the link with npm run pair -- link in the add-ons repo (it is what CI runs too).
It is deliberately not in wpunit.suite.yml's plugins list — tests activate it
on demand via activate_premium().
Where to put a new Premium test
- PHP logic (loggers, senders, formatters, REST, WP-CLI, settings) → wpunit in
tests/wpunit/premium/. This is the default. ExtendHelper\PremiumTestCase. - Browser-visible behaviour → Playwright in
tests/playwright/. The dev WordPress runs core + Premium together. Use this only when a human would need a browser to check it — wpunit runs in seconds, Playwright doesn't. - Cross-repo changes (a core hook/filter + a Premium consumer): unit-test the mechanism on the core side, add the Premium-side test under
tests/wpunit/premium/, and runphpcs/phpstanin both repos.
What the add-ons repo does and doesn't have
The add-ons repo has no test runner of its own — no Codeception config, no tests/
dir. Its `npm run t
Установить testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadBashEditWriteFAQ
Что делает скилл testing?
Guidance for writing and running tests in Simple History, including the Premium add-on. Covers which framework to use, how to run existing tests, how to create new ones (codegen recording workflow), and how to test Premium (whose PHP tests live in this repo, not the add-ons repo).
Как установить скилл testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic