Fix WordPress Playground tests: update Cypress test URL, improve blueprints, enhance documentation

This commit is contained in:
2025-04-22 16:37:01 +01:00
parent 0f83330d85
commit 8fa2c19fe4
4 changed files with 27 additions and 4 deletions

View File

@@ -6,6 +6,10 @@ This document explains how to use the testing framework for our plugin.
Our testing framework uses:
See also:
* [.wiki/Architecture-Overview.md](Architecture-Overview.md) high-level design
* [.wiki/Multisite-Development.md](Multisite-Development.md) deeper multisite guidance
* **wp-env**: For setting up WordPress environments (both single site and multisite)
* **WordPress Playground**: For browser-based testing without Docker
* **Cypress**: For end-to-end testing
@@ -16,6 +20,8 @@ Our testing framework uses:
1. **Node.js**: Version 16 or higher
2. **npm**: For package management
3. **Docker**: For running WordPress environments with wp-env (not needed for WordPress Playground)
4. **PHP**: Version 7.4 or higher (for future PHPUnit tests)
5. **Composer**: For managing PHP dependencies
## Testing Approaches
@@ -35,6 +41,9 @@ We provide scripts to easily set up test environments:
```bash
# Set up a single site environment
npm run setup:single
# You can also use the unified setup script:
bash bin/setup-test-env.sh single
```
This will:
@@ -48,6 +57,9 @@ This will:
```bash
# Set up a multisite environment
npm run setup:multisite
# Or via the setup script:
bash bin/setup-test-env.sh multisite
```
This will:
@@ -127,6 +139,7 @@ You can serve these files locally with a simple HTTP server:
python -m http.server 8888 --directory playground
# Then open http://localhost:8888/index.html in your browser
# Or open http://localhost:8888/test.html for a unified single/multisite switcher
```
## Writing Tests

View File

@@ -2,7 +2,7 @@
describe('WordPress Playground Single Site Tests', () => {
beforeEach(() => {
// Visit the WordPress Playground page
cy.visit('/index.html');
cy.visit('/');
// Wait for the iframe to load
cy.get('iframe').should('be.visible');

View File

@@ -27,8 +27,14 @@
}
},
{
"step": "wp-cli",
"command": "wp plugin activate plugin-toggle kadence-blocks"
"step": "activatePlugin",
"pluginName": "Plugin Toggle",
"pluginPath": "/wordpress/wp-content/plugins/plugin-toggle"
},
{
"step": "activatePlugin",
"pluginName": "Kadence Blocks",
"pluginPath": "/wordpress/wp-content/plugins/kadence-blocks"
}
]
}

View File

@@ -35,7 +35,11 @@
},
{
"step": "wp-cli",
"command": "wp plugin activate plugin-toggle kadence-blocks --network"
"command": "wp plugin activate plugin-toggle --network"
},
{
"step": "wp-cli",
"command": "wp plugin activate kadence-blocks --network"
}
]
}