1. Home
  2. EdminBoost
  3. Developers
  4. Running tests

Running tests

What the test stack is

EdminBoost uses two automated layers locally:

  1. PHPUnit — PHP unit tests (settings, Command Center helpers, features)
  2. Playwright — browser tests (admin UI flows)

Plus a manual checklist in tests/manual/regression-matrix.md for things automation does not cover.

Prerequisites

  • Local WordPress (README assumes MAMP: Apache + MySQL)
  • PHP 7.4+ (project targets 7.4; QA docs may reference MAMP PHP 8.x path)
  • Composer (PHP dependencies)
  • Node.js 18+ (Playwright)

One-time setup (from plugin root)

composer install npm install

Copy config templates:

cp .env.qa.example .env.qa cp tests/wp-tests-config.sample.php tests/wp-tests-config.php

Install Playwright browser (project may use a local browser path):

npx playwright install chromium

Optional QA site helper (symlink plugin + QA users on your local WP):

bash bin/setup-qa-site.sh

Edit tests/wp-tests-config.php if your MySQL socket, database name, or credentials differ from the sample.

PHPUnit database note

Tests use WordPress’s test suite tables with prefix wptests_ in the configured database—separate from your live site tables when set up correctly.

Run PHPUnit

composer test

Or:

bash bin/run-phpunit.sh

Tests extend Edminboost_Test_Case, which resets options and Command Center caches between tests.

Run Playwright (E2E)

npm run test:e2e

Useful variants:

npm run test:e2e:ui — debug with UI npm run test:e2e:report — open HTML report

E2E reads .env.qa:

  • BASE_URL — e.g. http://localhost:8888/wordpress
  • ADMIN_USER / ADMIN_PASSWORD
  • PLUGIN_SLUG — must match EDMINBOOST_PLUGIN_SLUG (edminboost-smart-admin-productivity-tool)

Playwright saves auth state under tests/e2e/.auth/ (gitignored).

What to run before a PR

  • composer test for PHP changes (sanitize, presets, bar, theme, features)
  • npm run test:e2e for admin UI or JS changes
  • Spot-check tests/manual/regression-matrix.md for drawer, role matrix, or visual items

Adding tests

PHPUnit: new file or methods in tests/phpunit/*Test.php, name tests test_{behavior}.

Playwright: specs under tests/e2e/specs/, use stable selectors (#edminboost-, .edminboost-).

Do not commit

.env.qa, tests/wp-tests-config.php, vendor/, node_modules/, playwright-report/, test-results/, .phpunit.result.cache

Install WordPress test library

If PHPUnit bootstrap fails, run the project installer (see tests/README.md):

bash bin/install-wp-tests.sh

Adjust for your DB host/socket as documented in tests/README.md.

Quick sanity check without full E2E

composer test

If that passes, core PHP helpers and sanitization are in good shape; E2E still recommended for UI-heavy changes.

How can we help?