test: add mocked E2E coverage for the publish-now flow - #1094
Merged
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>
- Upgrade actions/checkout and actions/setup-node to v7 (keep master refs) - Update @wordpress/env to 11.12.0, @playwright/test to 1.62.1, @wordpress/e2e-test-utils-playwright to 1.52.0 - Point Playwright webServer at the wp-env override port - Fix e2e specs: wait for Vue binding, assert free-plan upsell and permalink-based share link - Ignore test-results, playwright-report, flaky-tests Co-authored-by: Cursor <cursoragent@cursor.com>
lucadobrescu
added a commit
that referenced
this pull request
Aug 3, 2026
The e2e utils that came in with #1094 enable pretty permalinks in the test site, so `rest_url()` — and therefore `ropApiSettings.root` — no longer carries a query string. Appending `&req=...` to it produced `/wp-json/tweet-old-post/v8/api/&req=add_account_li`, which the REST server resolved to nothing: all 10 LinkedIn tests failed with `rest_no_route` / 404 after merging development. Let URL/searchParams place `?` or `&`, the way the plugin's own `fetchAJAX` passes `req` through vue-resource's `params` option. Works under either permalink mode. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lucadobrescu
added a commit
that referenced
this pull request
Aug 3, 2026
Copilot review feedback on #1100. `is_set_not_empty()` deliberately accepts array values — `is_valid_serialize_data()` maps over them — so a payload of `{ id: [<valid>], pages: [<valid>] }` cleared the guard and reached `base64_decode()`, which raises a PHP 8 TypeError. That is the same critical-error response this PR set out to remove; verified locally, the request returned HTTP 500 "There has been a critical error on this website" without the new check. Guard both encoded fields as strings before decoding, and cover the payload with an e2e test that fails without it. Also reset the services store in `beforeEach`. The happy-path test registers a LinkedIn account and only cleans up on success, so with CI retries enabled a failed run left that account behind and assertions like `not.toContain('linkedin')` could pass or fail depending on order. Uses the `ropUtils` fixture that came in with #1094 rather than a second bespoke helper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 9.4.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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