3.2 KiB
WordPress Playground Testing
This document explains how to use WordPress Playground for testing our plugin.
What is WordPress Playground?
WordPress Playground is a project that runs WordPress entirely in the browser using WebAssembly. This means:
- No server required - WordPress runs in the browser
- Fast startup times
- Isolated testing environment
- Works well with CI/CD pipelines
Using WordPress Playground Online
The easiest way to test our plugin with WordPress Playground is to use the online version:
-
Single site testing: Open in WordPress Playground
-
Multisite testing: Open in WordPress Playground
- After WordPress loads, go to Settings > General
- Scroll down and check "Allow network access" and "Create a multisite network"
- Click "Apply Settings & Reset Playground"
These links will automatically set up WordPress with our plugin installed and activated.
Running Tests with WordPress Playground
We have two blueprints for testing:
playground/blueprint.json- For single site testingplayground/multisite-blueprint.json- For multisite testing
To run tests with WordPress Playground:
-
Open the appropriate WordPress Playground link:
- Single site
- Multisite (requires manual multisite activation)
-
Test the plugin manually in the browser
Local Testing with HTML Files
We've also included HTML files that embed WordPress Playground:
- Open
playground/index.htmlin your browser for single site testing - Open
playground/multisite.htmlin your browser for multisite testing
You can serve these files locally with a simple HTTP server:
# Using Python
python -m http.server 8888 --directory playground
# Then open http://localhost:8888/index.html in your browser
Customizing Blueprints
You can customize the blueprints to suit your testing needs. See the WordPress Playground Blueprints documentation for more information.
CI/CD Integration
We have a GitHub Actions workflow that uses WordPress Playground for testing. See .github/workflows/playground-tests.yml for more information.
Performance Testing
We also use the WP Performance Tests GitHub Action for performance testing. This action tests our plugin against various WordPress versions and PHP versions to ensure it performs well in different environments.