test: token-free PHPUnit + Playwright E2E suite#75
Open
akzmoudud wants to merge 1 commit into
Open
Conversation
Adds a dokan-lite-style test suite that never spends a Gemini token (docs/adr/0002-token-free-test-strategy.md). PHPUnit (27) — boots real WP + WooCommerce; the try-on Gemini call is stubbed via a pre_http_request filter plus a network guard so nothing can reach the API. Covers every REST controller (settings, generate/try-on, promotion, dashboard/usage, product, video-thumbnail), bulk try-on, container wiring, and the promo-banner 30-day dismissal logic. Playwright E2E on @wordpress/env — one suite, dokan-style @lite/@Pro tags: - @lite (Pro off, 10): dashboard nav, enhancer image generation (browser page.route Gemini stub), image-config field->request combinations, the promo banner / plugins-screen link / sidebar Upgrade, settings save. - @Pro (Pro on, 7): promo touchpoints hidden when Pro is active, video generation via a stubbed Veo operation + fake-URI + a committed 1.7 KB MP4, and video-config combinations. tryaura-pro is mapped into wp-env; the license is simulated in the test-guard mu-plugin (no license server in CI). Run: composer test | (tests/pw) npm run test:lite / npm run test:pro Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UL9nyXmJTkPB7QmT7jTKGF
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A token-free test suite for the free plugin, modelled on dokan-lite — no test ever calls the real Gemini/Veo API, so CI runs for $0. Design recorded in
docs/adr/0002-token-free-test-strategy.md.PHPUnit — 27 tests
Boots real WP + WooCommerce (
bin-less, viawp-phpunit). The one server-side Gemini path (customer try-on) is stubbed with apre_http_requestfilter, plus a network guard so nothing unstubbed can reach the internet. Covers every REST controller (settings, generate/try-on, promotion, dashboard/usage, product, video-thumbnail), bulk try-on, container/provider wiring, and the promo-banner 30-day dismissal logic.Playwright E2E — @wordpress/env, one suite, dokan-style
@lite/@protags@lite(Pro off, 10): dashboard nav, enhancer image generation (browserpage.routeGemini stub), image-config field→request combinations (2K/4K model-upgrade, background, apparel), promo banner / plugins-screen link / sidebar Upgrade, settings save.@pro(Pro on, 7): promo touchpoints hidden when Pro is active, video generation via a stubbed Veo operation + fake URI + a committed 1.7 KB MP4, and video-config combinations (aspect ratio, duration, prompt). tryaura-pro is mapped into wp-env; the license is simulated in the test-guard mu-plugin (no license server in CI).How to run
composer testtests/pw):npm ci && npm run env:start, thennpm run test:lite/npm run test:proToken-free by construction
Both Gemini paths are stubbed (browser
page.route; serverpre_http_request) and a guard blocks any unstubbed call. The returned images/video are hand-authored fixtures (a 1×1 PNG, a 1.7 KB MP4) — the tests assert the plugin's own request-building and response-handling, never real AI output. See ADR 0002 for the trade-off (fixture drift) and rationale.Notes
fix/16-post-gemini-bugfixes(the code under test); retarget tomainafter that merges.@prolicense simulation is test-only (intests/pw/mu-plugins, gated on tryaura-pro being active) — the real key was rejected by the license server, so features are simulated as licensed for CI.setImageConfig/setVideoConfig+ request capture) makes adding more a few lines each.🤖 Generated with Claude Code
https://claude.ai/code/session_01UL9nyXmJTkPB7QmT7jTKGF