
內容簡介
這個 WordPress 外掛允許系統管理員可針對每個使用者簡化後台介面。可以隱藏任何特定的功能表或子功能表(包括在 Admin Bar 中),或者完全隱藏 Admin Bar。
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Lets any Administrator simplify the WordPress Admin interface, on a per-user basis. Hide any specific menu or submenu (including in the admin bar) or hide the admin bar entirely.
Development
Requirements
PHP 7.4 or higher
Composer (for managing PHP dependencies)
Node.js and npm (for building JavaScript assets)
Setup
Clone the repository
Run composer install to install PHP dependencies
Run npm install to install JavaScript dependencies
Run npm run build to build the React application
Code Quality
This plugin uses PHPStan for static analysis to ensure code quality and type safety.
To run PHPStan:
composer install (first time only)
npm run phpstan
Or directly with PHP:
php vendor/bin/phpstan analyse
The project is configured to run PHPStan at level 3 for improved reliability and maintainability.
Testing
The plugin includes PHP unit tests, end-to-end (E2E) tests, and visual regression tests.
PHP Unit Tests
Run PHP unit tests:
npm run test:php
End-to-End Tests
E2E tests use Playwright to test the plugin in a real WordPress environment.
Setup:
Install dependencies: npm install
Start WordPress environment: npm run env:start
Run tests: npm run test:e2e
See tests/e2e/README.md for detailed documentation on running and writing E2E tests.
Available E2E test commands:
npm run env:start – Start WordPress test environment
npm run env:stop – Stop WordPress test environment
npm run test:e2e – Run E2E tests in headless mode
npm run test:e2e:headed – Run E2E tests with visible browser
npm run test:e2e:ui – Run E2E tests in interactive UI mode
npm run test:e2e:debug – Run E2E tests in debug mode
npm run test:e2e:report – View test report
Visual Regression Testing
This plugin uses Playwright for automated visual regression testing to catch unintended visual changes during development.
Prerequisites:
Node.js 18 or higher
Playwright browsers installed (Chromium by default)
Initial Setup:
Install dependencies: npm install
Install Playwright browsers: npx playwright install --with-deps chromium
Build the application: npm run build
Running Visual Tests:
Run all visual tests: npm run test:visual
Run tests in UI mode (interactive): npm run test:visual:ui
Update baseline snapshots: npm run test:visual:update
How It Works:
Visual regression tests capture screenshots of the UI and compare them to baseline images. If there are visual differences, the tests will fail and generate a report showing what changed. This helps detect:
Unintended layout changes
CSS styling issues
Component rendering problems
Responsive design regressions
Test Coverage:
The visual tests cover:
– Initial app state (no user selected)
– User selector dropdown
– Full menu interface with user selected
– Menu list with toggle functionality
– Admin bar options
– Save and reset buttons
– Checked menu states
– Expandable submenus
– Responsive layouts (tablet and mobile views)
Updating Snapshots:
When intentional UI changes are made, update the baseline snapshots:
npm run test:visual:update
Review the changes in the tests/visual/app.spec.js-snapshots/ directory to ensure they match your intended changes.
CI Integration:
Visual regression tests run automatically on GitHub Actions for all pull requests and pushes to main/master branches. Test reports and snapshots are uploaded as artifacts for review.
Running All Tests
Run all tests (PHP unit tests + E2E tests):
npm run test
