-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Summary
E2E tests for the REST→AJAX→bypass fallback chain, ad-blocker simulation (block REST+AJAX → bypass must still track), and complete-block graceful failure.
Motivation
#174 (high): REST + sendBeacon broken — TrackingRestController overwrites raw_post_array for text/plain requests. Ad-blocker bypass is a key differentiating feature.
Dependencies
- Depends on: testing: Set up @wordpress/env Docker environment for reproducible test execution #192 (
@wordpress/env) - Depends on: testing: Correlation ID harness — MU-plugin + TypeScript helper for E2E row isolation #194 (Correlation ID harness)
Implementation
Files to create
tests/e2e/helpers/transport.ts(skill spec §2.5)tests/e2e/specs/transport/transport-fallback.spec.ts
transport.ts route blocking
```typescript
blockTransport('rest'): page.route('/wp-json/slimstat/', r => r.abort())
blockTransport('ajax'): page.route('/admin-ajax.phpaction=slimstat', r => r.abort())
blockTransport('bypass'): page.route('/wp-content/plugins/wp-slimstat/**', r => r.abort())
```
Test scenarios
- All available → REST used (URL contains
/wp-json/slimstat/) - Block REST → AJAX fallback (
admin-ajax.php) — @link Outbound link tracking broken with REST + sendBeacon #174 - Block REST+AJAX → bypass transport used (plugin file)
- Ad-blocker simulation (REST+AJAX blocked) → bypass tracks → DB row confirmed
- All blocked → 0 DB rows, 0 console errors
Standards
blockTransport()usespage.route()— never JS-side override (skill spec §2.5)- Scenario 4 asserts DB row via
getCorrelatedRows()— not just request capture - Transport robustness gate: bypass success rate ≥98% when REST+AJAX blocked (research 01 §C)
Acceptance criteria
- All 5 scenarios pass
-
transport.tsfully implemented per skill spec §2.5 - Scenario 4 asserts DB row (not just network request)
- Scenario 5: 0 DB rows + 0 console errors
- S2 detects Outbound link tracking broken with REST + sendBeacon #174 regression if reintroduced
References
- Research 01 §D — Transport robustness, §C — correctness gates
- Skill spec §2.5 (transport.ts)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
Todo