Skip to content

test(e2e): skip cross-domain SSO spec until wp-env supports mapped non-standard ports#1323

Merged
superdav42 merged 5 commits into
mainfrom
fix/e2e-sso-cross-domain-env-skip
Jun 2, 2026
Merged

test(e2e): skip cross-domain SSO spec until wp-env supports mapped non-standard ports#1323
superdav42 merged 5 commits into
mainfrom
fix/e2e-sso-cross-domain-env-skip

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 29, 2026

Summary

Skips the cross-domain SSO Cypress spec at tests/e2e/cypress/integration/060-sso-cross-domain.spec.js because it has never passed on main and was the sole reason the required cypress (8.2, chrome) check failed on every PR. Replaces the failing assertions with a describe.skip(...) and a detailed FIXME pointing at the env limitation and the restoration tracking issue.

Why this is the right fix (not a workaround)

The spec was introduced in b232e296 (Feb 16 2026) and 4/4 tests have failed on every E2E workflow run since. The failure mode is identical every time and matches what the spec's own header note already documents: wp-env runs on port 8889, WordPress only strips ports 80/443, so the mapped host 127.0.0.1:8889 is not resolved by Ultimate Multisite's domain mapping and the request is 302-redirected back to localhost:8889. The assertions below were nevertheless written as if the mapping worked end-to-end:

Test Expectation Reality on every run
Should resolve mapped domain to the correct subsite 200 from http://127.0.0.1:8889/ 302 to http://localhost:8889/
Should trigger SSO redirect when visiting wp-admin on mapped domain redirect location includes sso=login redirect goes to http://localhost:8889/ with no SSO params
Should auto-authenticate on subsite via SSO after main-site login final URL includes /wp-admin/ within 60 s stays on http://localhost:8889/, times out
Should preserve redirect_to parameter through SSO flow final URL includes /wp-admin/ within 60 s same — times out

The SSO trigger logic that does work in this env is already covered by tests/e2e/cypress/integration/065-sso-redirect-loop.spec.js (6/6 passing on the same runs).

Verification

Tracking restoration

#1322 captures:

  1. Root cause analysis (env, not product).
  2. Four candidate fixes (run wp-env on port 80, container host alias, Caddy/Traefik reverse proxy, or drop the spec in favour of the existing PHPUnit + 065-sso-redirect-loop.spec.js coverage).
  3. Files to touch, reference pattern (065-sso-redirect-loop.spec.js), and verification steps.

When the env is reconfigured, remove describe.skip(...) and the FIXME block — no other test-code changes should be needed.

For #1322


Summary by CodeRabbit

  • Bug Fixes
    • Ensure memberships are correctly updated after a Stripe checkout completes even when no external subscription is created, preventing missed renewals or reactivations.
  • Tests
    • Updated Stripe checkout test to handle multiple gateway representations robustly.
    • Marked SSO cross-domain test suite as skipped due to known CI environment limitations.

…n-standard ports

The spec at tests/e2e/cypress/integration/060-sso-cross-domain.spec.js
has been the sole failing case in the required `cypress (8.2, chrome)`
check on every E2E run since it was added in b232e29 (Feb 16 2026).

Root cause is an environment limitation, not a product bug: wp-env runs
on port 8889 and Ultimate Multisite's domain mapping does not take
effect for the mapped host `127.0.0.1:8889` on a non-standard port —
the request is 302-redirected back to `localhost:8889` before the
subsite is resolved. The spec's own header note acknowledges this, but
its assertions still expect the mapping to work end-to-end:

  - expects 200 from http://127.0.0.1:8889/ (gets 302 to localhost)
  - expects `sso=login` in the redirect location (never reached)
  - waits 60 s for /wp-admin/ on mapped host (times out on localhost)

Marks the describe block as `describe.skip(...)` with a detailed FIXME
documenting:

  - the precise reason the assertions fail in this env
  - that 065-sso-redirect-loop.spec.js already covers the SSO trigger
    logic that works in this env (6/6 passing)
  - candidate env-reconfiguration paths (port 80, host alias, reverse
    proxy) that would let the suite be unskipped
  - the tracking issue (#1322) for restoration

Unblocks the required `cypress (8.2, chrome)` status check on PRs to
main without pretending the env limitation has been fixed.

For #1322
@superdav42 superdav42 added testing origin:interactive Created by interactive user session labels May 29, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d91ab39-22f6-421f-a688-831409e80982

📥 Commits

Reviewing files that changed from the base of the PR and between 06cfe78 and 9b2ba3b.

📒 Files selected for processing (1)
  • inc/gateways/class-stripe-gateway.php

📝 Walkthrough

Walkthrough

This PR updates E2E tests and adds a new membership-update path in the Stripe gateway: the Stripe checkout E2E test now tolerates either a radio or hidden gateway input; the SSO cross-domain spec is skipped with added environment notes; Stripe_Gateway now updates local membership when no Stripe subscription is created for auto-renew flows.

Changes

E2E Test Adjustments

Layer / File(s) Summary
Stripe gateway selector conditional handling
tests/e2e/cypress/integration/030-stripe-checkout-flow.spec.js
The "select Stripe gateway" step now checks whether input[name="gateway"][value="stripe"] is a radio (force-check) or asserts it's a hidden input otherwise.
SSO cross-domain test skip and environment documentation
tests/e2e/cypress/integration/060-sso-cross-domain.spec.js
Header expanded with wp-env CI domain-mapping limitations (port 8889) and the suite changed to describe.skip() to disable running the entire spec.

Stripe Gateway Updates

Layer / File(s) Summary
Webhook listener settings reformat
inc/gateways/class-stripe-gateway.php
Reformatted the require entry for stripe_webhook_listener_explanation (active_gateways => 'stripe') without changing the condition.
Membership update when no Stripe subscription created
inc/gateways/class-stripe-gateway.php
When a recurring payment completes but no Stripe subscription object exists and checkout type is not downgrade, update membership gateway/customer linkage, clear subscription id, increment times_billed, and call reactivate(false) or renew(false, $membership_status) before trigger_payment_processed().

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Suggested labels

review-feedback-scanned

Poem

🐰 I hopped through tests with gentle care,
Radio or hidden, Stripe is fair,
SSO takes a quiet nap in CI,
Memberships mend when subs pass by,
A rabbit's cheer for passing sky-high!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the primary change: skipping the cross-domain SSO spec due to wp-env port limitations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2e-sso-cross-domain-env-skip

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42
Copy link
Copy Markdown
Collaborator Author

CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-05-30T06:59:14Z aidevops_version=3.20.5 opencode_version=1.15.12 exit=0 session_count=1

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42
Copy link
Copy Markdown
Collaborator Author

CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-05-30T15:04:24Z aidevops_version=3.20.5 opencode_version=1.15.12 exit=0 session_count=1

@superdav42
Copy link
Copy Markdown
Collaborator Author

CLAIM_RELEASED reason=process_exit runner=superdav42 ts=2026-05-31T15:31:00Z aidevops_version=3.20.6 opencode_version=1.15.13 exit=0 session_count=1

@superdav42
Copy link
Copy Markdown
Collaborator Author

MERGE_SUMMARY

Summary

  • Kept the cross-domain SSO Cypress skip from this PR.
  • Fixed the new failing cypress (8.1, chrome) Stripe checkout verification by activating one-time Stripe checkout memberships once the PaymentIntent succeeds without a recurring subscription.
  • Preserved Stripe gateway/customer metadata on the membership so verify-stripe-checkout-results.php can observe an active membership with Stripe IDs.

Verification

  • php -l inc/gateways/class-stripe-gateway.php
  • vendor/bin/phpcs inc/gateways/class-stripe-gateway.php
  • WP_TESTS_DIR=/tmp/wordpress-tests-lib vendor/bin/phpunit --filter Stripe_Gateway_Process_Checkout_Test (passes: 6 tests, 19 assertions; existing PHP 8.2 dynamic-property deprecation noise)
  • Pre-commit hook on fix(stripe): activate one-time checkout memberships ran PHPCS and PHPStan successfully.

CI focus

  • Previous terminal failure: cypress (8.1, chrome) in 030-stripe-checkout-flow.spec.js, expected 'pending' to equal 'active' for um_membership_status.
  • Pushed branch head: 9b2ba3bfdd012f49453be1a1f14a6796bfca1513.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42
Copy link
Copy Markdown
Collaborator Author

CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-06-01T09:26:52Z aidevops_version=3.20.7 opencode_version=1.15.13

…ain-env-skip

# Conflicts:
#	tests/e2e/cypress/integration/060-sso-cross-domain.spec.js
@superdav42
Copy link
Copy Markdown
Collaborator Author

MERGE_SUMMARY

Summary

Resolved the merge conflict from origin/main on fix/e2e-sso-cross-domain-env-skip and pushed the updated PR branch. The Cypress spec remains skipped with the FIXME explaining the wp-env non-standard-port domain-mapping limitation and restoration tracking in #1322.

Verification

  • bash bin/check-env.sh — passed
  • node --check tests/e2e/cypress/integration/060-sso-cross-domain.spec.js — passed
  • vendor/bin/phpcs inc/models/class-customer.php tests/WP_Ultimo/Models/Customer_Test.php — passed
  • ./node_modules/.bin/eslint assets/js/checkout.js --ignore-pattern '*.min.js' — passed
  • git diff --check — passed
  • pre-commit hook on merge commit — passed PHPCS, PHPStan, and lint-staged for staged PHP/JS files

Note: npm run lint:js still fails on pre-existing repository-wide ESLint issues outside this PR's resolved conflict scope; targeted lint for the merged changed source file passed.


aidevops.sh v3.20.7 plugin for OpenCode v1.15.13 with gpt-5.5 spent 4m and 77,725 tokens on this as a headless worker.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit e5945fa into main Jun 2, 2026
10 of 11 checks passed
@superdav42 superdav42 added the review-feedback-scanned Merged PR already scanned for quality feedback label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

origin:interactive Created by interactive user session review-feedback-scanned Merged PR already scanned for quality feedback testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant