chore: incorporate the e2e Playwright suite into the monorepo (NPPM-2919) - #409
Merged
Conversation
These don't pass on CI still, due to font mismatch and image loading discrepancies.
This updates reader registration tests to match the new my account experience.
* fix: account for mobile my account links * fix: copilot feedback
The post editor canvas is rendered inside iframe[name="editor-canvas"] in modern Gutenberg, so the top-level #editor selector doesn't reach the homepage-articles block. Also harden a couple of fragile bits: click the title link (not the block wrapper) so navigation is reliable, and read h1.entry-title (not any h1) for the captured title. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WordPress permalinks end with /, so checking for the absence of a trailing slash never matched and waitForURL hung the test. Wait for pathname !== '/' (i.e. not the homepage) instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The snapshot setup phase (USE_SNAPSHOTS) could not complete on a local isolated env, for two reasons, both fixed in e2e-reset.sh: 1. The snapshots admin UI is gated by newspack-manager's can_do_something_very_serious(), which on a non-proxied env reduces to NEWSPACK_MANAGER_ADMIN_USERNAME === current user. The suite logs in as admin, so pin the constant to match. On Atomic/staging the a8c-proxy / domain-allowlist branch overrides this, so it is a no-op there. 2. Snapshots store site_url() at creation and the load handler refuses to ingest a snapshot whose stored URL doesn't match the running site. WP-CLI has is_ssl()===false, so site_url() downgrades to http:// even on an https env, while the browser-driven load runs over https — a scheme mismatch that blocked the load (and silently left the test logged in, hanging the setup). Pass --url so WP-CLI reports the site's real scheme. On https staging this equals the live value, so it is a no-op there. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stripe Elements now renders an extra aria-hidden "Secure payment input frame" (the ACH bank-search results frame) alongside the card input frame, so the selector matched two elements and failed in strict mode. Exclude hidden frames. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After staging was updated to WP 7.0, `npm run test:snapshots` failed in
`loadSnapshot`. The snapshots themselves were intact, but two version-mismatch
effects broke the flow:
1. WordPress core was bumped without the schema upgrade running, so
`wp-admin/admin.php` redirected every admin request to `upgrade.php`. The
snapshots admin page rendered empty and the test threw "Snapshot not found".
2. Each snapshot's DB dump is captured at the core version it was created on.
Loading one (created on 6.9) rolls `db_version` back below the running core,
re-arming the same upgrade redirect. After the load the browser landed on
`upgrade.php` instead of the login page, so the existing
`waitForSelector('label:text("Username or Email Address")')` timed out.
Clear any pending DB schema upgrade via `upgrade.php?step=1` (no auth/nonce
required, and a no-op when nothing is pending) both before login and right
after loading a snapshot. The brittle post-load login-label wait is replaced
with a `waitForURL` that accepts either landing page (login or upgrade.php).
Verified end to end: reproduced the failure locally with old-schema snapshots,
then 10/10 desktop+mobile specs pass both locally and against
e2e.newspackstaging.com (WP 7.0).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
adekbadek
force-pushed
the
nppm-2919-incorporate-e2e-into-workspace
branch
from
June 24, 2026 13:24
6187468 to
2ce8396
Compare
The CI testing section still described the retired CircleCI setup and its `SSH_*` variables. The suite now runs on TeamCity against the Atomic staging site, parameterised by `E2E_*` variables (`E2E_SITE_URL`, `E2E_WP_USERNAME`/`E2E_WP_PASSWORD`, and `E2E_SSH_HOST`/`E2E_SSH_USER`/ `E2E_SSH_USER_PASS`/`E2E_SSH_KNOWN_HOST`). Document the current variables, the build steps, and the snapshot/admin-password coupling. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WxF7NnBU1VTBtLGjtC7ewE
The Donations test asserted the modal checkout summary read exactly "Donate: $15.00 / month". A Newspack update now renders it as "Donate: Monthly: $15.00 / month" (the cadence label moved into the summary), so the `has-text` substring no longer matched and the test timed out waiting for the summary. Assert on the stable "$15.00 / month" part instead. That label prefix has already churned once before (see #21), and the amount + cadence is the bit actually worth checking. Verified end to end against the staging site: the full donation flow, including "Transaction successful", passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WxF7NnBU1VTBtLGjtC7ewE
setupSite read E2E_SSH_PASS, but the TeamCity build supplies the SSH password as E2E_SSH_USER_PASS; with it unset, provisioning fell back to key auth and failed. Standardise on the name TeamCity already uses. Docs note sshpass must be on the agent PATH.
Point the root AGENTS.md at e2e/ and ignore the suite's local-only artifacts (test-videos/, .playwright-mcp/).
adekbadek
force-pushed
the
nppm-2919-incorporate-e2e-into-workspace
branch
from
July 7, 2026 19:51
2ce8396 to
0cc7f78
Compare
…NPPM-2919) The e2e suite now provisions the site itself each run (its setup projects run e2e-setup.sh / site-setup.sh via npm run test:setup) instead of loading DB snapshots, so the helper no longer resets the DB or seeds content — it only stands up the env, installs the e2e helper plugin, and configures .env. - Default --e2e-repo to the in-repo e2e/ (was a sibling newspack-e2e-tests). - Drop the e2e-reset.sh run, the snapshot/manager/premium-Woo tolerance, and the post-reset permalink re-assertion (provisioning handles all of that now). - Rely on the env's ./repos and ./plugins mounts for newspack-manager and the WooCommerce stack; install only the single-file e2e-plugin here. - Fix the build-marker check: worktrees are served from /newspack-plugins (themes: /newspack-themes), not /newspack-repos, so the old path never matched and force-rebuilt every plugin every run. Also point newspack-plugin's marker at dist/commons.asset.php (dist/editor.asset.php is no longer emitted). - Use the correct STRIPE_SECRET_KEY var name the suite reads.
Contributor
|
Hey @adekbadek, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
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.
All Submissions:
Changes proposed in this Pull Request:
Brings the standalone
newspack-e2e-testsPlaywright suite into the monorepo undere2e/, so the end-to-end tests live alongside the product code they exercise. This is step 1 of NPPM-2919 (the port). Enabling on-demand per-PR runs is step 2 and is designed separately.e2e/with full git history preserved. Paths were rewritten (git filter-repo --to-subdirectory-filter e2e) before an unrelated-histories merge, sogit blame e2e/…traverses the original commits rather than dead-ending at the import.e2e/as a self-contained npm project, deliberately outside the pnpm workspace. The per-package CI matrix selects jobs by pnpm workspace membership, soe2e/is invisible to it — the suite must not run in the lint/build/test matrix; it needs a live site.n env e2e-setuplocal helper (bin/setup-local-e2e.sh) for the from-scratch provisioning model: the suite now provisions the site itself each run, so the helper no longer resets the DB, loads snapshots, or seeds content — it stands up the env, installs the single-filee2e-plugin, and points.envat the site (newspack-managerand the WooCommerce stack come from the env's./repos/./pluginsmounts). Also fixes a stale build-marker check that force-rebuilt every plugin on every run.AGENTS.mdpointing ate2e/, and ignores the suite's local-only artifacts.The suite provisions the site from scratch each run (
site-setup.sh/e2e-setup.sh) rather than restoring a DB fixture, so there is nothing to drift out of date.Nightly CI continues to run on TeamCity; pointing its VCS root at this repo (working directory
e2e/, build steps unchanged) is a one-time infra step tracked in the issue, not part of this diff.Part of NPPM-2919.
How to test the changes in this Pull Request:
git blame e2e/tests/donations.spec.ts— history traces into the originalnewspack-e2e-testscommits, not a single import commit.n env e2e-setup <name>, thencd e2e && npm ci && npx playwright install && USE_SETUP=true npx playwright test --project="Vanilla in Desktop Chrome". The setup project provisions the env viae2e-setup.sh; the@vanillaspecs pass..envpere2e/.env-sample):npm run test:setupprovisions and runs;npm truns against the current site state.e2e/(it is outside the pnpm workspace).Other information: