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

Enhance/#6932 - GA4 dashboard prompt banner notification #7026

Merged
merged 8 commits into from
May 16, 2023

Conversation

hussain-t
Copy link
Collaborator

@hussain-t hussain-t commented May 11, 2023

Summary

Addresses issue:

Relevant technical choices

  • Although the IB didn't state adding tests, this PR includes appropriate unit tests for the submitChanges action to ensure the correct functionality of the changes made.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 5.6.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@github-actions
Copy link

github-actions bot commented May 11, 2023

Size Change: +2.34 kB (0%)

Total Size: 1.31 MB

Filename Size Change
./dist/assets/css/googlesitekit-admin-css-********************.min.css 48.7 kB +84 B (0%)
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.2 kB +105 B (+1%)
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 7.55 kB +85 B (+1%)
./dist/assets/js/googlesitekit-activation-********************.js 22.8 kB +115 B (+1%)
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 42.7 kB +89 B (0%)
./dist/assets/js/googlesitekit-adminbar-********************.js 32 kB +116 B (0%)
./dist/assets/js/googlesitekit-api-********************.js 9.58 kB -2 B (0%)
./dist/assets/js/googlesitekit-components-gm2-********************.js 6.11 kB -2 B (0%)
./dist/assets/js/googlesitekit-data-********************.js 2.17 kB -1 B (0%)
./dist/assets/js/googlesitekit-datastore-forms-********************.js 9.23 kB -2 B (0%)
./dist/assets/js/googlesitekit-datastore-site-********************.js 16.3 kB +1 B (0%)
./dist/assets/js/googlesitekit-datastore-ui-********************.js 9.31 kB -4 B (0%)
./dist/assets/js/googlesitekit-datastore-user-********************.js 22.7 kB +25 B (0%)
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 64.4 kB +201 B (0%)
./dist/assets/js/googlesitekit-main-dashboard-********************.js 76.2 kB +161 B (0%)
./dist/assets/js/googlesitekit-modules-adsense-********************.js 90.3 kB +207 B (0%)
./dist/assets/js/googlesitekit-modules-analytics-********************.js 85 kB +225 B (0%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 28.7 kB +34 B (0%)
./dist/assets/js/googlesitekit-modules-********************.js 21.3 kB +9 B (0%)
./dist/assets/js/googlesitekit-modules-optimize-********************.js 19 kB +18 B (0%)
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 21.4 kB +47 B (0%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 51 kB +207 B (0%)
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32.2 kB +30 B (0%)
./dist/assets/js/googlesitekit-settings-********************.js 47.6 kB +161 B (0%)
./dist/assets/js/googlesitekit-splash-********************.js 65.6 kB +125 B (0%)
./dist/assets/js/googlesitekit-user-input-********************.js 40.4 kB +120 B (0%)
./dist/assets/js/googlesitekit-vendor-********************.js 318 kB +4 B (0%)
./dist/assets/js/googlesitekit-widgets-********************.js 16.6 kB +66 B (0%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 61.5 kB +117 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/js/30-********************.js 2.8 kB
./dist/assets/js/31-********************.js 2.28 kB
./dist/assets/js/32-********************.js 3.72 kB
./dist/assets/js/33-********************.js 3.12 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 769 B
./dist/assets/js/googlesitekit-components-gm3-********************.js 9.73 kB
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.1 kB
./dist/assets/js/googlesitekit-i18n-********************.js 3.92 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 378 B
./dist/assets/js/runtime-********************.js 1.26 kB

compressed-size-action

Copy link
Collaborator

@techanvil techanvil left a comment

Choose a reason for hiding this comment

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

Thanks @hussain-t, this is working well in my testing but we should avoid disabling the complexity rule, so I'm sending back your way for a bit of refactoring.

@@ -84,6 +85,7 @@ async function submitGA4Changes( { select, dispatch } ) {
return await dispatch( MODULES_ANALYTICS_4 ).submitChanges();
}

// eslint-disable-next-line complexity
Copy link
Collaborator

Choose a reason for hiding this comment

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

@hussain-t, I really don't think we should be disabling this rule in any new scenarios. By disabling the rule it means we can keep adding more complexity to this function without any warning or check on it, which is a bit of a step backward.

Please can you instead refactor this function a bit, extracting some of it into new functions if needs be.

@@ -621,6 +627,132 @@ describe( 'modules/analytics settings', () => {
} );
} );

describe( 'dismiss switch ga4 dashboard view notification', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should capitalise the initials in GA4 when using it in a sentence... I'd also make the following minor grammatical tweak:

Suggested change
describe( 'dismiss switch ga4 dashboard view notification', () => {
describe( 'dismiss the switch to GA4 dashboard view notification', () => {

'^/google-site-kit/v1/core/user/data/dismiss-item'
);

it( 'should not dismiss the switch ga4 dashboard view notification if it is a UA dashboard view', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above:

Suggested change
it( 'should not dismiss the switch ga4 dashboard view notification if it is a UA dashboard view', async () => {
it( 'should not dismiss the switch to GA4 dashboard view notification when setting the dashboard view to UA', async () => {

).toBe( false );
} );

it( 'should not dismiss the switch ga4 dashboard view notification if it is already dismissed', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above:

Suggested change
it( 'should not dismiss the switch ga4 dashboard view notification if it is already dismissed', async () => {
it( 'should not dismiss the switch to GA4 dashboard view notification if it is already dismissed', async () => {

);
} );

it( 'should dismiss the switch ga4 dashboard view notification if it has not been dismissed yet', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above:

Suggested change
it( 'should dismiss the switch ga4 dashboard view notification if it has not been dismissed yet', async () => {
it( 'should dismiss the switch to GA4 dashboard view notification if it has not been dismissed yet when setting the dashboard view to GA4', async () => {

await registry
.dispatch( MODULES_ANALYTICS )
.submitChanges();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing as we have to wait for resolvers to run in the successful test case below, we should probably add it here too, to ensure this test isn't giving us a false positive.

Suggested change
// Wait for resolvers to run.
await waitForDefaultTimeouts();

await registry
.dispatch( MODULES_ANALYTICS )
.submitChanges();

Copy link
Collaborator

Choose a reason for hiding this comment

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

As above:

Suggested change
// Wait for resolvers to run.
await waitForDefaultTimeouts();

Copy link
Collaborator

@techanvil techanvil left a comment

Choose a reason for hiding this comment

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

LGTM, nice one @hussain-t & @kuasha420!

Although the E2E test suite is failing, this isn't due to this PR and will be addressed via #7050, so this is good to go.

@techanvil techanvil merged commit 4951645 into develop May 16, 2023
@techanvil techanvil deleted the enhance/#6932-dismiss-ga4-dashboard-banner branch May 16, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants