Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2E tests for the WP Consent API integration #429

Merged
merged 6 commits into from
Jun 3, 2024

Conversation

martynmjones
Copy link
Contributor

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

@martynmjones martynmjones self-assigned this May 31, 2024
@martynmjones martynmjones added the changelog: none Skip changelog entry for this PR label May 31, 2024
@github-actions github-actions bot added type: enhancement The issue is a request for an enhancement. changelog: add A new feature, function, or functionality was added. labels May 31, 2024
@eason9487 eason9487 removed type: enhancement The issue is a request for an enhancement. changelog: add A new feature, function, or functionality was added. labels Jun 3, 2024
Copy link
Member

@eason9487 eason9487 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the tests. I can run all E2E tests successfully. LGTM.

The only comment is not a blocker and can be ignored.

tests/e2e/specs/js-scripts/wp-consent-api.test.js Outdated Show resolved Hide resolved
@martynmjones martynmjones merged commit ac52e1d into trunk Jun 3, 2024
7 checks passed
@martynmjones martynmjones deleted the add/wp-consent-api-integration-tests branch June 3, 2024 17:33
@tomalec
Copy link
Member

tomalec commented Jun 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: none Skip changelog entry for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants