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

MSD - Handle Single Dashboard Card Error in UI #15893

Merged
merged 24 commits into from
Feb 18, 2022

Conversation

ashiagr
Copy link
Contributor

@ashiagr ashiagr commented Feb 2, 2022

Parent #15750
References pbArwn-3ny-p2 (if one card fails - error inside card state and title copy change in this comment)
References wordpress-mobile/WordPress-FluxC-Android#2251

This PR handles errors within Posts and Today's Stats cards using mocked data.

Note: As unauthorised, jetpack_disconnected and jetpack_disabled errors are irrecoverable (see p1643789176707579-slack-C0290FLA0RM), these error are filtered out from displaying. The condition for showing these error cards can be modified in the future in the corresponding builder classes. The tests ensure that no card (neither with error nor with data) is displayed when these errors are returned for that card type.

To test:

Prerequisites

  • Launch the app.
  • Select a wpcom site.
  • Navigate to My Site -> App Settings -> Debug Settings.
  • Ensure that the MySiteDashboardPhase2FeatureConfig is to set to on.
  • Restart the app.
  1. Notice that no card exists for Today's Stats and Posts in the My Site Dashboard with the given mocked JSON.

  2. [Optional, covered in unit tests] Replace mocked JSON error node with different supported error types and reinstall the app:

    Today's Stats: `unauthorized`, `jetpack_disconnected` and `jetpack_disabled` 
    Posts: `unauthorized`
    

    Notice that these errors are never shown.

  3. Replace mocked JSON error node with a fallback generic_error and reinstall the app. Notice that a generic error within a card is displayed as shown. We can further discuss showing fallback errors in this Slack thread (p1644303679654909/1643829887.600439-slack-C0290FLA0RM). An error within a card, when shown, is tracked as follows (see pbArwn-2zs-p2#comment-4731). Tracking can be tested by enabling My Site -> App Settings -> Privacy settings -> Collect information and switching between sites.

    🔵 Tracked: my_site_dashboard_card_shown, Properties: {"type":"error","subtype":"todays_stats"}
    🔵 Tracked: my_site_dashboard_card_shown, Properties: {"type":"error","subtype":"post"}
    

Merge Instructions

This PR is still in draft mode as it depends on the previous unmerged Today's Card UI with mocked data and the linked draft FluxC PR requiring changes after the endpoint is live. Please wait to merge the PR until mentioned PRs are merged to develop.

Regression Notes

  1. Potential unintended areas of impact
    Cards should not be displayed with default values (like 0 likes, 0 views) when an error exists.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manually tested.

  3. What automated tests I added (or what prevented me from doing so)
    Add unit tests.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@ashiagr ashiagr added Part of a WIP Feature This label is used to disable milestone checks for PRs that are not against `develop` or `release`. My Site Dashboard labels Feb 2, 2022
@ashiagr ashiagr added this to the Future milestone Feb 2, 2022
@ashiagr ashiagr self-assigned this Feb 2, 2022
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Feb 2, 2022

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@ashiagr ashiagr changed the title MSD - Today's Stats Card - Show Error Inside Card MSD - Handle Single Dashboard Card Error Feb 2, 2022
@ashiagr ashiagr changed the title MSD - Handle Single Dashboard Card Error MSD - Handle Single Dashboard Card Error in UI Feb 2, 2022
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Feb 2, 2022

You can test the changes on this Pull Request by downloading the APKs:

…d class

This is done to allow enclosing error card within parent sealed class for today's stats in a future commit.
unauthorized, jetpack_disconnected, jetpack_disabled errors are not shown as they're irrecoverable on pull to refresh.
To test that unauthorized, jetpack_disconnected, jetpack_disabled errors are not shown and that cards with empty state (default values) are also shown when these error exist.
Since this PR only handles errors within a card, the existing mocked response JSON file is modified to include only errors instead of creating a new JSON file specifically for errors. This fixes lint issue complaining about unused mocked resource file.

Anyone using the mocked JSON file after this point should appropriately modify the file content.
@ashiagr ashiagr requested a review from zwarm February 8, 2022 05:15
@ashiagr ashiagr added Tooling and removed Tooling labels Feb 8, 2022
@ashiagr ashiagr requested a review from tiagomar February 8, 2022 12:18
@ashiagr ashiagr added Tooling and removed Tooling labels Feb 8, 2022
@ashiagr ashiagr removed the request for review from zwarm February 16, 2022 09:49
@ashiagr ashiagr mentioned this pull request Feb 16, 2022
3 tasks
Copy link
Contributor

@AjeshRPai AjeshRPai left a comment

Choose a reason for hiding this comment

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

👋 @ashiagr !

I have reviewed and tested this PR as per the instructions, everything works as expected, great job! 🌟 🌟

I have left one suggestion (💡) and some minor (🔍) comments for you to consider

@ashiagr ashiagr added Tooling and removed Tooling labels Feb 17, 2022
@ashiagr ashiagr requested a review from AjeshRPai February 17, 2022 04:54
Copy link
Contributor

@AjeshRPai AjeshRPai left a comment

Choose a reason for hiding this comment

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

@ashiagr Thanks for making the changes as per my suggestions. 🙌 👍

@AjeshRPai AjeshRPai marked this pull request as ready for review February 17, 2022 06:11
…le-card-error-state

# Conflicts:
#	WordPress/src/main/res/raw/mocked_site_dashboard_cards.json
#	build.gradle
@ashiagr ashiagr added Tooling and removed Tooling labels Feb 17, 2022
Base automatically changed from issue/15201-stats-card-ui to trunk February 18, 2022 07:01
@ashiagr ashiagr modified the milestones: Future, 19.3 Feb 18, 2022
@ashiagr
Copy link
Contributor Author

ashiagr commented Feb 18, 2022

👋 @AjeshRPai

As discussed on Slack, merging it now.

@ashiagr ashiagr merged commit fafb295 into trunk Feb 18, 2022
@ashiagr ashiagr deleted the issue/15750-handle-single-card-error-state branch February 18, 2022 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
My Site Dashboard Part of a WIP Feature This label is used to disable milestone checks for PRs that are not against `develop` or `release`.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants