From woocommerce-commerce
Guides WooCommerce plugin testing with PHPUnit unit/integration tests via WP/Woo suites and helpers, Playwright E2E, and WP-CLI scaffolding for test environments.
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin woocommerce-commerceThis skill is limited to using the following tools:
**Fetch live docs**:
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Fetch live docs:
site:developer.woocommerce.com testing for WooCommerce testing guidesite:developer.wordpress.org plugins testing for WordPress Plugin testing handbookwoocommerce e2e testing playwright for E2E patternsIsolated class/function testing:
Tests with WordPress + WooCommerce loaded:
WC_Unit_Test_Case (which extends WP_UnitTestCase)Browser-based tests with Playwright:
wp scaffold plugin-tests my-plugin creates:
tests/bootstrap.php — test bootstraptests/test-sample.php — sample testphpunit.xml.dist — PHPUnit configurationbin/install-wp-tests.sh — install WordPress test suiteAfter WordPress test bootstrap, load WooCommerce and your plugin:
// In tests/bootstrap.php
require_once dirname( __DIR__ ) . '/vendor/woocommerce/woocommerce/tests/legacy/bootstrap.php';
// Or manually: activate WooCommerce, then your plugin
Base class providing:
Factory for creating test products:
WC_Helper_Product::create_simple_product() — simple product with defaultsWC_Helper_Product::create_variation_product() — variable + variationsWC_Helper_Product::create_grouped_product() — grouped productWC_Helper_Product::create_external_product() — external/affiliateFactory for creating test orders:
WC_Helper_Order::create_order( $customer_id ) — order with line itemsWC_Helper_Customer::create_customer() — customer with addressWC_Helper_Customer::create_mock_customer() — mock customer objectWC_Helper_Shipping::create_simple_flat_rate() — flat rate shipping zoneWC_Helper_Coupon::create_coupon() — discount coupon with configurable type/amountVerify your hooks fire correctly:
has_action( 'hook_name', [ $instance, 'method' ] )did_action( 'hook_name' ) to verify an action firedUse WP_REST_Server to dispatch requests:
$request = new WP_REST_Request( 'GET', '/wc/v3/products' )$response = rest_get_server()->dispatch( $request )process_payment() with test credentials$this->createMock( ClassName::class )add_filter( 'pre_http_request', $mock_response )WC_Mock_Payment_Gateway and similar mocksWooCommerce uses @woocommerce/e2e-utils and Playwright:
playwright.config.jstests/e2e/specs/WC_Unit_Test_Case for integration testsWC_Helper_Product, etc.) for test fixtures@group annotations for test organizationFetch the WooCommerce testing documentation and WordPress testing handbook for exact helper methods, bootstrap setup, and E2E configuration before implementing.