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

Update RRM SettingsEdit to handle missing ID error. #10222

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

juniovitorino
Copy link
Collaborator

@juniovitorino juniovitorino commented Feb 13, 2025

Summary

Addresses issue:

Relevant technical choices

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 7.4.
  • 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.
  • Ensure there are no unexpected significant changes to file sizes.

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.

@juniovitorino juniovitorino marked this pull request as ready for review February 14, 2025 12:17
Copy link

github-actions bot commented Feb 14, 2025

Build files for 51daf92 are ready:

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 @juniovitorino, this is looking good, but could use a couple of tweaks. Please see my comments.

Additionally, it would be good to provide a bit more detail to the QA Brief - specifically, how we can reproduce the error in E2E testing. Please feel free to drop me a line if you could use some help with this.

@juniovitorino
Copy link
Collaborator Author

Thanks @juniovitorino, this is looking good, but could use a couple of tweaks. Please see my comments.

Additionally, it would be good to provide a bit more detail to the QA Brief - specifically, how we can reproduce the error in E2E testing. Please feel free to drop me a line if you could use some help with this.

@techanvil I chose to go with your recommendations; they all seemed reasonable to me. Since you know the codebase much better than I do, I’ll learn from your suggestions.

Also, could you share an example of a QA Brief to give me a better idea of how to write one?

@juniovitorino juniovitorino force-pushed the enhancement/10131-handle-error-if-the-saved-product-id-is-no-longer-available branch from 8a1a319 to 1277172 Compare February 17, 2025 12:16
@techanvil
Copy link
Collaborator

techanvil commented Feb 17, 2025

@techanvil I chose to go with your recommendations; they all seemed reasonable to me. Since you know the codebase much better than I do, I’ll learn from your suggestions.

Also, could you share an example of a QA Brief to give me a better idea of how to write one?

Thanks @juniovitorino! I've left a couple of additional comments, as you've probably noticed.

For example QA Briefs, pretty much all issues which have progressed to Code Review and beyond should have one, so you can browse issues in GitHub/ZenHub to get a broad range of examples to help understand how we write them.

For a more focused set of examples I'd suggest browsing issues in the RRM Phase 2 epic. And, the most relevant issues to this one are #10065, #9952 and #9954.

In fact, #10065 is the issue which actually integrates the ability for the user to set the productID setting, but this is still in CR. So we can't properly test this in an integrated manner until the PR for 10065 is merged.

However we are often in similar situations, so we can use JS snippets to help model scenarios to short-circuit the testing process.

In this particular case, I would suggest that the QAB should take the following approach:

  • Set up RRM using a publication which has a contribution or paywall CTA set up with one or more product IDs associated with it.
  • Navigate to the RRM settings edit screen.
  • Use the following snippet in the JS console to examine/verify the product IDs for the publication:
googlesitekit.data.select('modules/reader-revenue-manager').getProductIDs();
// Example output:
['CAownIG4DA:basic-product-id', 'CAownIG4DA:advanced-product-id']
  • Use the following snippet to select one of the existing product IDs:
googlesitekit.data.dispatch('modules/reader-revenue-manager').setProductID( /* Use a product ID from the actual list output from the command above */ "CAownIG4DA:basic-product-id");
googlesitekit.data.dispatch('modules/reader-revenue-manager').saveSettings();
  • The error message should not appear. Reload the page to test with the persisted settings, again the error message should not appear.

  • Use the snippet above but with a non-existent product ID to simulate the case where the selected product ID has been removed from settings.

googlesitekit.data.dispatch('modules/reader-revenue-manager').setProductID( /* Use a product ID that doesn't exist in the list output above */ "CAownIG4DA:some-non-existent-product-id");
googlesitekit.data.dispatch('modules/reader-revenue-manager').saveSettings();
  • The error message should now appear. Reload the page to test with the persisted settings, the error message should again appear.

It would of course be preferable to test this in a fully integrated manner, which would involve the user setting the productID setting in SK (once #10065 is merged), and then editing the publication in Publication Center to add a product ID, syncing the publication settings (see #9954), then removing the product ID from the publication in PC, resyncing the publication settings and then reloading the SK page - this would properly exercise the real-world flow of events for showing this error. But, in the name of pragmatism I think we can take the JS console shortcuts above for this one.

I hope that helps, please let me know if you have any further questions. I'm not sure how much exposure you've had to creating publications in the Publisher Center, if you've not done this yet the RRM Phase 1 bug bash instructions has got some useful info on it, although it doesn't get into setting the product IDs which is what Phase 2 tackles. You can add product IDs to a paywall or contribution CTA at the point of creating the subscription plan or contribution amounts.

Again, please drop me a line if you want to discuss any of this further, I'd be happy to jump on a call if that would help.

Copy link

Size Change: +111 B (+0.01%)

Total Size: 2.02 MB

Filename Size Change
./dist/assets/js/googlesitekit-activation-********************.js 23.7 kB +2 B (+0.01%)
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 54.3 kB +3 B (+0.01%)
./dist/assets/js/googlesitekit-adminbar-********************.js 34.8 kB +1 B (0%)
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 84.9 kB +1 B (0%)
./dist/assets/js/googlesitekit-main-dashboard-********************.js 165 kB -2 B (0%)
./dist/assets/js/googlesitekit-modules-ads-********************.js 36.3 kB +1 B (0%)
./dist/assets/js/googlesitekit-modules-adsense-********************.js 116 kB +22 B (+0.02%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 192 kB +16 B (+0.01%)
./dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 44.6 kB +75 B (+0.17%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 69.5 kB -7 B (-0.01%)
./dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 32.7 kB -1 B (0%)
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32.2 kB +2 B (+0.01%)
./dist/assets/js/googlesitekit-settings-********************.js 128 kB +2 B (0%)
./dist/assets/js/googlesitekit-splash-********************.js 68.9 kB +1 B (0%)
./dist/assets/js/googlesitekit-user-input-********************.js 43.9 kB +1 B (0%)
./dist/assets/js/googlesitekit-vendor-********************.js 325 kB -3 B (0%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 63.2 kB -3 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-admin-css-********************.min.css 63 kB
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.8 kB
./dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 846 B
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.48 kB
./dist/assets/js/33-********************.js 2.76 kB
./dist/assets/js/34-********************.js 2.25 kB
./dist/assets/js/35-********************.js 3.64 kB
./dist/assets/js/36-********************.js 935 B
./dist/assets/js/37-********************.js 892 B
./dist/assets/js/38-********************.js 1.61 kB
./dist/assets/js/39-********************.js 1.57 kB
./dist/assets/js/40-********************.js 1.61 kB
./dist/assets/js/41-********************.js 1.59 kB
./dist/assets/js/42-********************.js 1.83 kB
./dist/assets/js/43-********************.js 3.12 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 901 B
./dist/assets/js/blocks/googlesitekit-reader-revenue-manager-block-editor.js 478 B
./dist/assets/js/blocks/sign-in-with-google/editor-styles.css 75 B
./dist/assets/js/blocks/sign-in-with-google/editor-styles.js 490 B
./dist/assets/js/blocks/sign-in-with-google/index.js 18 kB
./dist/assets/js/googlesitekit-api-********************.js 10.1 kB
./dist/assets/js/googlesitekit-components-gm2-********************.js 6.46 kB
./dist/assets/js/googlesitekit-components-gm3-********************.js 10.1 kB
./dist/assets/js/googlesitekit-consent-mode-********************.js 25.6 kB
./dist/assets/js/googlesitekit-data-********************.js 2.37 kB
./dist/assets/js/googlesitekit-datastore-forms-********************.js 8.96 kB
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.08 kB
./dist/assets/js/googlesitekit-datastore-site-********************.js 20.3 kB
./dist/assets/js/googlesitekit-datastore-ui-********************.js 10 kB
./dist/assets/js/googlesitekit-datastore-user-********************.js 28.4 kB
./dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 646 B
./dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 624 B
./dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 630 B
./dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 712 B
./dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 675 B
./dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 634 B
./dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 657 B
./dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 633 B
./dist/assets/js/googlesitekit-i18n-********************.js 3.93 kB
./dist/assets/js/googlesitekit-metric-selection-********************.js 52.1 kB
./dist/assets/js/googlesitekit-modules-********************.js 22.3 kB
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 22.7 kB
./dist/assets/js/googlesitekit-notifications-********************.js 43.6 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 378 B
./dist/assets/js/googlesitekit-widgets-********************.js 104 kB
./dist/assets/js/runtime-********************.js 1.4 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.

Hey @juniovitorino, please note the VRT suite is currently failing in CI for this PR.

image

In fact so is the E2E suite, but these are known flaky test failures so you don't need to worry about them for this PR.

You can see which tests are currently known to be flaky by searching for "flaky" in ZenHub for example:

image

Back to the VRT suite - most of the failures should be fixed by updating the product IDs in the story file as per my other comment.

However, at a minimum you'll need to add the VRT reference images for the new scenario you added for the MissingProductID story.

I don't know if you've seen it yet, but you can download the VRT report for the failing run from the Summary page for the run on GitHub:

image

Unzip and view the HTML report and you can filter to just show the failed tests.

image

You'll want to add the new images (or update where relevant, probably not for this PR but in future). You can do this by generating them locally with npm run test:visualtest and then npm run test:visualapprove to copy them into tests/backstop/reference. Or, a shortcut can be to copy relevant images directly from the downloaded report into tests/backstop/reference, that's what I often do.

There's more info on the VRT suite in our documentation, please drop me a line if you've any questions!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update the remaining product IDs in this file :)

The calls to setProductId() need updating, and so does the MissingProductID story.

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.

2 participants