Skip to content

Add wp-admin smoke test#87

Open
conatus wants to merge 2 commits intomasterfrom
e2e/wp-admin-smoke
Open

Add wp-admin smoke test#87
conatus wants to merge 2 commits intomasterfrom
e2e/wp-admin-smoke

Conversation

@conatus
Copy link
Copy Markdown
Member

@conatus conatus commented Apr 24, 2026

Summary

  • Adds a Playwright spec that proves the plugin's single wp-admin surface (the Carbon Fields "Join" settings page) is not broken.
  • Motivation: the most recent release fixed a bug where clicking around the backend with the plugin active produced errors. No automated test existed to catch that class of regression.
  • Out of scope (future tier): the Gutenberg block editor surface.

What it covers

  1. Tab navigation — iterates all 6 settings-page tabs (Features, Membership Plans, Theme, Copy, Integrations, Logging), asserts each loads without a PHP error or 5xx, and that the tab panel actually changes.
  2. Carbon Fields round-trip — updates organisation_name on the Copy tab, clicks Save, confirms settings-updated=true redirect, reloads, and asserts the database value persisted. Restores the original value so local re-runs are idempotent.

Notable implementation decisions

  • scripts/setup.php now pre-populates the three required Copy-tab fields plus one membership plan so Carbon Fields' save button and cross-validator stay unlocked in the test environment.
  • A test.afterAll hook restores stripe_direct_debit_only=true via wp eval after the round-trip, because Carbon Fields saves the entire container and would otherwise wipe options that aren't mirrored as visible form fields.
  • The tab test filters the pre-existing "Please call Stripe() with your publishable key" SDK warning — that fires any time the admin loads with empty credentials and is not a regression signal.

Test plan

  • cd packages/join-e2e && npx wp-env start
  • bash scripts/seed.sh
  • npx playwright test tests/wp-admin-smoke.spec.ts --reporter=list — both tests pass
  • npx playwright test --reporter=list — full suite passes (59 tests across 9 spec files)
  • Break the admin deliberately (e.g. add trigger_error(..., E_USER_ERROR) to Settings.php::registerSettings) and re-run — both tests must fail. Revert and confirm green again.

Suite count

Was: 57 tests / 8 spec files
Now: 59 tests / 9 spec files

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant