Expand deterministic Playwright E2E coverage#495
Open
Alexia-Soare wants to merge 7 commits into
Open
Conversation
…coverage The Playwright suite previously hit live ThemeIsle APIs (sites feed, license check, starter ranking, demo content) making it slow, flaky and tied to the remote catalog. Following the Otter pattern, a test-only mu-plugin (mounted via wp-env, gated by the TPC_E2E constant) now short-circuits every server-side external fetch with fixtures, and config/mocks.js provides page.route mocks for browser-side fetches (ti-demo-data, templates cloud, tracking). The full site-import flow runs offline against the existing PHPUnit fixtures; only the wordpress.org install paths still use the network, as they are themselves under test. New coverage: Templates Cloud dashboard (My Library + Settings, via a tpc-e2e/v1 state toggle for legacy-TC mode), the block editor import modal, and request-level smoke tests for the ti-sites-lib REST endpoints. Brittle remote-data assertions are now fixture-derived. Housekeeping: package.json metadata pointed at the right repo, dead code removed from global-setup, unused CYPRESS_LICENSE_KEY dropped from CI. Deferred (documented in README): Elementor/Beaver libraries, dashboard starter-sites grid (needs Neve theme), Zelle migration flow, and the editor header button whose portal target no longer exists in current WordPress. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mocks previously modeled only the happy path. The mu-plugin now
supports scenario modes via a tpc-e2e/v1/api-mode REST route ('down' =
ThemeIsle APIs unreachable, 'invalid' = license rejected), flushing the
cached license and starter-ranking order on switch so modes apply
immediately.
New specs/error-states.spec.js covers: the onboarding error UI when the
demo-data fetch 500s, the empty sites list when the feed is down, the
license activate UI on an invalid license, and starter_order degrading
to an empty order when the ranking API is unreachable.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The one write flow that produces real site state: the editor modal's
Import now runs end-to-end against a mocked templates/{id}/import
response (blocks parsed and inserted into the post, asserted in the
canvas), and /import_single_templates is smoke-tested to create a real
published page. Rename/duplicate/delete CRUD against the mock is
deliberately skipped — it would only test the mock.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The .distignore excluded the old cypress dir but never the Playwright suite, so release zips shipped the entire e2e-tests directory (including the test mu-plugin — inert outside wp-env, but test infra doesn't belong in the wordpress.org package). The starter_order assertion derived its expected value from the same fixture the mock computes its response from — tautological. Replaced with independent literals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Local run commands, the two mock layers (mu-plugin pre_http_request + page.route helpers), the tpc-e2e/v1 state toggles and their reset rule, the fixture-derived-assertions convention, why workers stays at 1, and the deferred coverage list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The setup workflow used cache: npm against a yarn-locked root (fails before wp-env starts), installed Playwright browsers globally before e2e deps existed (version mismatch with @playwright/test), and used yarn's --frozen-lockfile flag with npm. Now: yarn cache, npm ci in e2e-tests, browsers installed from the pinned @playwright/test version, then wp-env start — the agent gets a running test environment. AGENTS.md gains a TDD practices section (seams, red-green loop, no tautological assertions, boundary-only mocking) for agents without access to the tdd skill. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keep the Playwright sources consistently formatted and upload diagnostics from the directory where the suite actually writes them. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
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
Test plan
npm run test:playwright(23 tests passed)php -lMade with Cursor