Skip to content

Expand deterministic Playwright E2E coverage#495

Open
Alexia-Soare wants to merge 7 commits into
developmentfrom
feat/e2e-mocked-suite
Open

Expand deterministic Playwright E2E coverage#495
Alexia-Soare wants to merge 7 commits into
developmentfrom
feat/e2e-mocked-suite

Conversation

@Alexia-Soare

Copy link
Copy Markdown

Summary

  • mock external ThemeIsle services for deterministic, offline E2E coverage
  • cover onboarding, Templates Cloud dashboard/editor flows, REST endpoints, imports, and API failures
  • document the suite, exclude E2E assets from distributions, and preserve Playwright failure artifacts in CI

Test plan

  • Run npm run test:playwright (23 tests passed)
  • Run Prettier checks for E2E JavaScript and TypeScript
  • Validate the E2E mu-plugin with php -l

Made with Cursor

Alexia-Soare and others added 7 commits July 13, 2026 15:40
…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>
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 14, 2026
@pirate-bot

Copy link
Copy Markdown
Collaborator

Plugin build for fb66a9b is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants