From 8fa2c19fe41460264347fecae81f979e5a074958 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:37:01 +0100 Subject: [PATCH] Fix WordPress Playground tests: update Cypress test URL, improve blueprints, enhance documentation --- .wiki/Testing.md | 13 +++++++++++++ cypress/e2e/playground-single-site.cy.js | 2 +- playground/blueprint.json | 10 ++++++++-- playground/multisite-blueprint.json | 6 +++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.wiki/Testing.md b/.wiki/Testing.md index 620ef2d..871e354 100644 --- a/.wiki/Testing.md +++ b/.wiki/Testing.md @@ -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 diff --git a/cypress/e2e/playground-single-site.cy.js b/cypress/e2e/playground-single-site.cy.js index 9f91815..7e7d835 100644 --- a/cypress/e2e/playground-single-site.cy.js +++ b/cypress/e2e/playground-single-site.cy.js @@ -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'); diff --git a/playground/blueprint.json b/playground/blueprint.json index 374bdc2..c76e3f3 100644 --- a/playground/blueprint.json +++ b/playground/blueprint.json @@ -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" } ] } diff --git a/playground/multisite-blueprint.json b/playground/multisite-blueprint.json index 98b376a..68d5d6a 100644 --- a/playground/multisite-blueprint.json +++ b/playground/multisite-blueprint.json @@ -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" } ] }