test: add mocked E2E coverage for the publish-now flow#1094
Open
Alexia-Soare wants to merge 4 commits into
Open
test: add mocked E2E coverage for the publish-now flow#1094Alexia-Soare wants to merge 4 commits into
Alexia-Soare wants to merge 4 commits into
Conversation
- Add rop-e2e-bootstrap mu-plugin: mocks the Revive Social server (post-on-x/logs) via pre_http_request, records payloads, and exposes rop-e2e/v1 REST endpoints (reset, account, publish-now, requests) - Add ropUtils Playwright fixture wrapping those endpoints; migrate post-format and publish-now specs to it and drop the UI-driven addFakeTwitterAccount helper - Make runs deterministic: DISABLE_WP_CRON in wp-env, purge leftover publish-now queue meta on reset, clear the scheduled hook before firing the publish-now action - Harden Playwright config: retries + trace/screenshot/video on CI, flaky-tests reporter (renamed from flasky), PLAYWRIGHT_CHANNEL override for local runs on newer macOS - CI: setup-node with npm cache, richer failure artifacts; add copilot-setup-steps workflow that prepares wp-env - Docs: mock architecture + TDD practices in AGENTS.md and e2e README - Bump version to 9.4.0 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Playwright 1.40 requests libasound2, renamed to libasound2t64 on Ubuntu 24.04, so apt fails; the runner image already ships the required libraries. Matches the e2e workflow's install step. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Revert the 9.4.0 version bump and readme changelog entry that were accidentally included with the publish-now E2E work. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore custom-content post-format coverage, use a resilient @testaccount locator, and align publish-now bootstrap with reset/seed. Read testsPort from .wp-env.override.json in Playwright (Otter pattern) and document port conflicts in AGENTS.md and the e2e README. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Adds deterministic, fully mocked E2E coverage for the instant-share (publish now) flow, modeled on the e2e setups in Otter and WooCommerce. No test talks to real social APIs.
Mock infrastructure
tests/e2e/mu-plugins/rop-e2e-bootstrap.php— mapped into wp-env as an mu-plugin. InterceptsROP_POST_ON_X_API/ROP_POST_LOGS_APIrequests viapre_http_request, records their payloads, and exposesrop-e2e/v1REST endpoints:/reset,/account,/publish-now,/requests(allmanage_options-gated).tests/e2e/fixtures/index.js—ropUtilsPlaywright fixture wrapping those endpoints; specs use it for seeding and for asserting on captured request payloads instead of driving setup through the UI.Determinism fixes
DISABLE_WP_CRONin wp-env — the manual/publish-nowtrigger is the only share path, eliminating a double-fire race with the event scheduled at publish time (time() + 10)./resetpurges leftoverrop_publish_now*post meta, so a failed attempt can't leak queued posts into a retry's share run.Tests
post-on-xpayload incl.sharing_type, auth token, post text;logspayload incl. network/handle/content/link). Captured requests attached to the test report.addFakeTwitterAccounthelper.CI / tooling
flasky-),PLAYWRIGHT_CHANNELoverride for local runs where the bundled Chromium crashes on newer macOS.setup-nodewith built-in npm cache, richer failure artifacts.copilot-setup-steps.ymlpreparing a ready-to-use wp-env for the Copilot coding agent.AGENTS.mdandtests/e2e/README.md.Test plan
PLAYWRIGHT_CHANNEL=chrome npm run test:e2e:playwright— 4/4 passed locally against a fresh wp-envDISABLE_WP_CRONand the mu-plugin are active in the tests containerphp -lon the mu-plugin; workflow YAMLs validated