Fix code quality issues: add iframe titles, fix Markdown formatting, update documentation, and clean up test files

This commit is contained in:
2025-04-22 15:03:24 +01:00
parent c37d2975d3
commit 3ca2fe58fa
5 changed files with 24 additions and 29 deletions

View File

@@ -90,14 +90,14 @@ wp import
In a WordPress multisite environment, there are two ways to activate plugins:
1. **Network Activation**: Activates a plugin for all sites in the network
- In the WordPress admin, go to Network Admin > Plugins
- Click "Network Activate" under the plugin
- Or use WP-CLI: `wp plugin install plugin-name --activate-network`
* In the WordPress admin, go to Network Admin > Plugins
* Click "Network Activate" under the plugin
* Or use WP-CLI: `wp plugin install plugin-name --activate-network`
2. **Per-Site Activation**: Activates a plugin for a specific site
- In the WordPress admin, go to the specific site's admin area
- Go to Plugins and activate the plugin for that site only
- Or use WP-CLI: `wp plugin activate plugin-name --url=site-url`
* In the WordPress admin, go to the specific site's admin area
* Go to Plugins and activate the plugin for that site only
* Or use WP-CLI: `wp plugin activate plugin-name --url=site-url`
Our multisite blueprint uses network activation for the Plugin Toggle plugin as an example.
@@ -111,8 +111,8 @@ We have two blueprints for testing:
To run tests with WordPress Playground:
1. Open the appropriate WordPress Playground link:
- [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=11)
- [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=23)
* [Single site](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=11)
* [Multisite](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=23)
2. Test the plugin manually in the browser

View File

@@ -38,6 +38,7 @@ npm run setup:single
```
This will:
1. Start a WordPress single site environment using wp-env
2. Install and activate our plugin
3. Configure WordPress for testing
@@ -50,6 +51,7 @@ npm run setup:multisite
```
This will:
1. Start a WordPress multisite environment using wp-env
2. Install and activate our plugin network-wide
3. Create a test subsite
@@ -158,7 +160,8 @@ describe('WordPress Single Site Tests', () => {
We have GitHub Actions workflows for running tests in CI/CD:
* `.github/workflows/cypress.yml`: Runs Cypress tests
* `.github/workflows/wordpress-tests.yml`: Runs wp-env e2e tests
* `.github/workflows/playground-tests.yml`: Runs Playground e2e tests
* `.github/workflows/phpunit.yml`: Runs PHPUnit tests (coming soon)
## Troubleshooting

View File

@@ -12,6 +12,7 @@
width: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
@@ -20,6 +21,6 @@
</style>
</head>
<body>
<iframe src="https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=11"></iframe>
<iframe src="https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/blueprint.json&_t=11" title="WordPress Playground Single Site Environment"></iframe>
</body>
</html>

View File

@@ -12,6 +12,7 @@
width: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
@@ -20,6 +21,6 @@
</style>
</head>
<body>
<iframe src="https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=24"></iframe>
<iframe src="https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wpallstars/wp-plugin-starter-template-for-ai-coding/feature/testing-framework/playground/multisite-blueprint.json&_t=24" title="WordPress Playground Multisite Environment"></iframe>
</body>
</html>

View File

@@ -11,6 +11,7 @@
height: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
@@ -41,7 +42,7 @@
<button onclick="loadSingleSite()">Single Site</button>
<button onclick="loadMultisite()">Multisite</button>
</div>
<iframe id="playground" src="about:blank"></iframe>
<iframe id="playground" src="about:blank" title="WordPress Playground Test Environment"></iframe>
<script>
function loadSingleSite() {
@@ -57,6 +58,9 @@
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/",
"login": true,
"features": {
"networking": true
},
"steps": [
{
"step": "defineWpConfigConsts",
@@ -65,18 +69,8 @@
}
},
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "plugin-toggle"
}
},
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "hello-dolly"
}
"step": "wp-cli",
"command": "wp plugin install plugin-toggle kadence-blocks --activate"
}
]
};
@@ -105,11 +99,7 @@
},
{
"step": "wp-cli",
"command": "wp plugin install plugin-toggle --activate-network"
},
{
"step": "wp-cli",
"command": "wp plugin install hello-dolly"
"command": "wp plugin install plugin-toggle kadence-blocks --activate-network"
}
]
};