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

Dynamic Dashboard: Reviews card states and unit tests #12806

Merged
merged 17 commits into from
May 31, 2024

Conversation

hafizrahman
Copy link
Contributor

@hafizrahman hafizrahman commented May 21, 2024

Please do not merge until target is trunk

Closes: #12742

Description

This PR completes the Reviews card task by adding the following:

  1. Finalizing UI for loading state,
  2. UI for error state,
  3. UI for empty state (both for when there's no reviews at all in the site, and when there's no reviews after filtering). The wording here follows Android's implementation.
  4. Dismiss and onError retry trackings
  5. Unit tests

Testing instructions

Please check and compare with screenshots posted below:

  1. Start with no internet, ensure "error state" is shown.
  2. Retry, ensure this is tracked: Tracked dynamic_dashboard_card_retry_tapped, ... with type: reviews included.
  3. Restart test, now with internet on a site with no reviews. ensure "Empty state case: absolutely no reviews" case shown.
  4. Add one review on the site, but do not approve it. Go back to site, filter by "Approved". Ensure "Empty state case: no filtered reviews" case is shown.
  5. Try reloading and ensure loading state is shown correctly.
  6. HIde the card, ensure this is tracked: Tracked dynamic_dashboard_hide_card_tapped, ... with type: reviews included.

Screenshots

Error case:

Empty state case: absolutely no reviews Empty state case: no filtered reviews
Simulator Screenshot - iPhone 15 iOS 17 4 - 2024-05-22 at 09 42 07 Simulator Screenshot - iPhone 15 iOS 17 4 - 2024-05-22 at 09 39 49
Loading state case: no reviews ever loaded Loading state case: some reviews were shown before
Simulator Screenshot - iPhone 15 iOS 17 4 - 2024-05-20 at 16 54 32 Simulator Screenshot - iPhone 15 iOS 17 4 - 2024-05-20 at 16 54 21

@hafizrahman hafizrahman changed the base branch from trunk to feat/12742-review-card-functionality-ii May 21, 2024 23:53
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 22, 2024

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr12806-0724980
Version18.8
Bundle IDcom.automattic.alpha.woocommerce
Commit0724980
App Center BuildWooCommerce - Prototype Builds #9330
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@hafizrahman hafizrahman marked this pull request as ready for review May 22, 2024 02:44
@hafizrahman hafizrahman added the type: task An internally driven task. label May 22, 2024
@hafizrahman hafizrahman added this to the 18.8 milestone May 22, 2024
@hafizrahman hafizrahman added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label May 22, 2024
@itsmeichigo itsmeichigo self-assigned this May 22, 2024

func emptyView(isFiltered: Bool) -> some View {
VStack(spacing: 0) {
ReviewsDashboardEmptyView(isFiltered: isFiltered)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this view is simple so can be part of this file, not necessary to be separate unless it's to be reused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, updated in 811f143


static let noFilteredReviewsText = NSLocalizedString(
"mostActiveCouponsEmptyView.noFilteredReviewsText",
value: "No reviews match the selected filter, please try changing the filter.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: if this view is kept in ReviewDashboardCard, you can use the current filter to display in the message. Something like: "No reviews matching Hold status". This would be more explicit and concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, that's more useful. Added in 811f143

await viewModel.reloadData()

// Then
XCTAssertEqual(viewModel.data.count, self.sampleReviews.count)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should compare the data rather than just the count, to make sure that the details are correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated in 8739e01

@itsmeichigo itsmeichigo modified the milestones: 18.8, 18.9 May 24, 2024
Base automatically changed from feat/12742-review-card-functionality-ii to trunk May 28, 2024 05:00
Conflicts:
	WooCommerce/Classes/ViewRelated/Dashboard/Reviews/ReviewsDashboardCard.swift
Conflicts:
	WooCommerce/WooCommerce.xcodeproj/project.pbxproj
@hafizrahman hafizrahman removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label May 29, 2024
Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

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

Hey @hafizrahman 👋 As discussed in the previous PR, I think we should not always show the review list when there is existing data. From my testing, when refreshing the card, we show the list without the shimmering animation, making it confusing to understand if data is being reloaded.

@hafizrahman
Copy link
Contributor Author

@itsmeichigo I think something might have gone wrong / unaccounted for after merging from the latest branch, I was just responding to the previous feedbacks without adding any logic change. Let me check, thanks!

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 18.9. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@hafizrahman
Copy link
Contributor Author

hafizrahman commented May 30, 2024

@itsmeichigo I decided to revamp the loading state to match similar behavior in InboxDashboardCard and have placeholder data displayed always when loading. I also simplified the syncing to only show items when there's full text with product names and notifications loaded, just makes things easier to follow that way.

Added in b758898 and 8d87f7f

Video of latest loading state:

Simulator.Screen.Recording.-.iPhone.15.iOS.17.4.-.2024-05-30.at.10.37.49.mp4

Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

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

Thanks Hafiz, LGTM :shipit:

@hafizrahman hafizrahman merged commit 34b8bca into trunk May 31, 2024
22 checks passed
@hafizrahman hafizrahman deleted the feat/12742-review-card-states-tests branch May 31, 2024 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Last 3 reviews card logic
4 participants