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

Implement automatic refresh for RRM module setup flow #8839

Closed
7 tasks done
nfmohit opened this issue Jun 8, 2024 · 3 comments
Closed
7 tasks done

Implement automatic refresh for RRM module setup flow #8839

nfmohit opened this issue Jun 8, 2024 · 3 comments
Labels
Module: RRM Reader Revenue Manager module related issues P0 High priority Sp Wk 2 Issues to be completed in the second week of the assigned sprint Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@nfmohit
Copy link
Collaborator

nfmohit commented Jun 8, 2024

Feature Description

The Reader Revenue Manager module setup should support automatic refresh behaviour similar to the AdSense module's setup flow: If you navigate away for a certain amount of time and then return to the tab, it should automatically re-run the relevant API requests, to see if maybe something on the SwG API side has changed. This is crucial since all write actions happen within the Publisher Center UI and are therefore unknown to Site Kit.


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

Acceptance criteria

  • Similar to the AdSense module's setup flow, the fetched publications from the API should be reset and re-fetched when a user returns to the Reader Revenue Manager setup browser tab from elsewhere after 15 seconds.
  • This reset and re-fetch should only happen as long as the publicationID module setting is not set.

Implementation Brief

  • Create a generator action resetPublications in assets/js/module/reader-revenue-manager/datastore/publications.js added in Implement RRM getPublications() selector #8794.
    • This should clear all the errors for getPublications selector.
    • Invalidate the resolution cache for getPublications using invalidateResolutionForStoreSelector on modules/reader-revenue-manager store. Refer the similar implementation in adsense module.
  • In SetupMain component for the module, create a function reset.
    • It should return and do nothing if publicationID is set in the module settings. It can be checked using getPublicationID selector.
    • If publicationID is not set, resetPublications action should be called.
    • useReFocus hook should be used to call reset function mentioned above every 15 seconds.

Test Coverage

Add tests for resetPublications action.

QA Brief

Scenario i. Publication ID is not set.

  1. Activate the module. This will redirect to the setup screen.

  2. There should be a progress bar which shows the publications are loading.

  3. Once publications dropdown is visible, navigate away from the current tab in browser. You can open a different tab and stay there for 15+ seconds. Come back to the setup tab again and you should see that publications are loading again (a progress bar to load publications).

Scenario ii. Populating publications when synced.

  1. Activate the module. This will redirect to the setup screen. Wait till publication dropdown appears.

  2. Run the following command in browser.

googlesitekit.data.dispatch( 'modules/reader-revenue-manager' ).receiveGetPublications([]);

This will clear all publications from dropdown.

  1. Once publications dropdown is visible, navigate away from the current tab in browser. You can open a different tab and stay there for 15+ seconds. Come back to the setup tab again and you should see that publications are loading again (a progress bar to load publications). Once publication dropdown appears, you must see all publications available again.

Scenario iii. Publication ID is set, publications should not get loaded again.

  1. Activate the module. This will redirect to the setup screen. Wait till publication dropdown appears.

  2. Run the following command in browser.

  const settings = {
      publicationID: "CAow6J6vDA",
      publicationOnboardingState: "ONBOARDING_ACTION_REQUIRED",
      publicationOnboardingStateLastSyncedAtMs: 0
    };

    googlesitekit.data.dispatch('modules/reader-revenue-manager').setSettings( settings );
    googlesitekit.data.dispatch('modules/reader-revenue-manager').saveSettings();
  1. Navigate away from the current tab in browser. You can open a different tab and stay there for 15+ seconds. Come back to the setup tab again and you should see that publications are NOT loading again (a progress bar to load publications).

Changelog entry

  • Add periodic automatic refresh behaviour in the Reader Revenue Manager setup form.
@nfmohit nfmohit self-assigned this Jun 8, 2024
@nfmohit nfmohit added P0 High priority Type: Enhancement Improvement of an existing feature Team M Issues for Squad 2 Module: RRM Reader Revenue Manager module related issues labels Jun 8, 2024
@nfmohit nfmohit removed their assignment Jun 8, 2024
@ivonac4 ivonac4 added Module: RRM Reader Revenue Manager module related issues and removed Module: RRM Reader Revenue Manager module related issues labels Jun 11, 2024
@nfmohit nfmohit assigned nfmohit and unassigned nfmohit Jun 14, 2024
@ankitrox ankitrox assigned ankitrox and unassigned ankitrox Jun 27, 2024
@nfmohit nfmohit self-assigned this Jun 27, 2024
@nfmohit
Copy link
Collaborator Author

nfmohit commented Jun 30, 2024

Nice work, @ankitrox ! IB LGTM 👍 ✅

@nfmohit nfmohit removed their assignment Jun 30, 2024
@ivonac4 ivonac4 added the Sp Wk 2 Issues to be completed in the second week of the assigned sprint label Jul 26, 2024
@ankitrox ankitrox self-assigned this Jul 29, 2024
@ankitrox ankitrox removed their assignment Jul 30, 2024
@nfmohit nfmohit assigned nfmohit and ankitrox and unassigned nfmohit Jul 31, 2024
@ankitrox ankitrox assigned nfmohit and unassigned ankitrox Aug 2, 2024
@nfmohit nfmohit removed their assignment Aug 2, 2024
@kelvinballoo
Copy link
Collaborator

kelvinballoo commented Aug 5, 2024

QA Update ⚠️

One flag is that whenever the publications have already been retrieved and I click on the dropdown, there is a console error. Refer to the video attached. ⚠️
However, it's worth noting that after I did Scenario 3, I could not replicate this issue anymore.

Console error: Screenshot 2024-08-05 at 17 35 15
Scenario.2.flag.aria.error.mov

Other items successfully verified are as follows: ✅

  • Scenario i. Publication ID is not set.

    Scenario.1.success.mov
  • Scenario ii. Populating publications when synced.
    The scenario is verified good overall as per the first video attached in this comment.

  • Scenario iii. Publication ID is set, publications should not get loaded again.

    Scenario.3.success.mov

@kelvinballoo
Copy link
Collaborator

QA Update ✅

After a round of review, this aria hidden console error actually happens on other SK module dropdowns as well.
Hence, this will be tackled in a separate issue, logged here: #9142

This ticket is good to be moved to approval.

The 3 scenarios were verified good: ✅

  • Scenario i. Publication ID is not set.
    Reloading happens as expected.

    Scenario.1.success.mov
  • Scenario ii. Populating publications when synced.
    Reloading happens as expected.

    Scenario.2.flag.aria.error.mov
  • Scenario iii. Publication ID is set, publications should not get loaded again.
    Reloading does not happen, as expected.

    Scenario.3.success.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: RRM Reader Revenue Manager module related issues P0 High priority Sp Wk 2 Issues to be completed in the second week of the assigned sprint Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants