woocommerce / woocommerce-google-analytics-integration

WordPress plugin: Provides the integration between WooCommerce and Google Analytics.
http://wordpress.org/plugins/woocommerce-google-analytics-integration/
172 stars 69 forks source link

Add E2E tests for the WP Consent API integration #429

Closed martynmjones closed 4 months ago

martynmjones commented 5 months ago

Changes proposed in this Pull Request:

Follow-up to #425

Adds E2E tests for the integration with WP Consent API.

Scenarios covered:

  1. GA4W sets the global wp_consent_type variable to optin if it's not currently set
  2. Consent granted update is sent for analytics_storage when the WP Consent API category statistics is allowed
  3. Consent granted update is sent for ad_storage, ad_user_data, and ad_personalization when the WP Consent API category marketing is allowed
  4. The current consent state is sent when the page loads if the default state is denied and the current state is granted
  5. The current consent state is sent when the page loads if the default state is granted and the current state is denied

_Note: Scenario 2 & 3 cover on page updates via the wp_listen_for_consent_change event listener. Scenario 4 & 5 are immediate updates when the page loads based on the current event state._

Screenshots:

Screenshot 2024-05-31 at 18 24 07

Detailed test instructions:

  1. Checkout add/wp-consent-api-integration-tests and build extension
  2. Setup E2E environment and run tests
  3. Confirm all tests pass
tomalec commented 4 months ago

I've added two more tests so we check also revoking the consent.