Run with Python, pytest and Playwright Chromium installed:
python3 -m pytest tests/rm_analytics -q
Fixture tests run locally. test_real_site_smoke.py fetches the published
article and RightMessage script and injects the local tracker. It replaces
PostHog with a recorder and blocks all outbound non-GET requests. Signup
requests receive mocked success or failure responses; no subscriber is added.
These smoke tests depend on the current published widget and experiment IDs.
The tracker emits rm_widget_viewed, rm_offer_viewed, and
rm_form_submitted. Views require visible content in a visible tab and count
once per widget/offer per page. Successful submissions come from RightMessage’s
integration.hooks.onFormSubmitted; its offer_conversions bus event also
fires after failed requests and must not be used as a success signal.
Keep RightMessage’s native PostHog integration disabled to avoid a second
producer of rm_form_submitted. New RightMessage placements are discovered
automatically. When cloning a newsletter offer, add its offer ID to
NEWSLETTER_OFFER_IDS so the newsletter-only placement chart includes it.