Skip to content

[Hack Week] Add products check to the troubleshooting tool#15584

Draft
hichamboushaba wants to merge 6 commits intohack-week/improve-troubleshooting-screenfrom
hack-week/improve-troubleshooting-screen-m2
Draft

[Hack Week] Add products check to the troubleshooting tool#15584
hichamboushaba wants to merge 6 commits intohack-week/improve-troubleshooting-screenfrom
hack-week/improve-troubleshooting-screen-m2

Conversation

@hichamboushaba
Copy link
Copy Markdown
Member

@hichamboushaba hichamboushaba commented Mar 30, 2026

Description

Adds a "Fetching products in your store" connectivity check as the 5th and final test in the Troubleshoot Connection screen (Milestone 2). Also aligns all connectivity tool analytics event values with iOS for cross-platform consistency.

Test Steps

Happy path:

  1. Open the app and navigate to Settings > Troubleshoot Connection
  2. Verify all 5 checks run sequentially: Internet → WordPress.com → Store → Orders → Products
  3. Confirm each check shows a green checkmark on success
  4. Verify the "No connection issues" summary appears at the bottom

Products failure:

  1. Set up ApiFaker to return an error for the products endpoint:
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.CLEAR_ENDPOINTS
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.ADD_ENDPOINT \
  --es api_type "wp-api" \
  --es path "/wc/v3/products" \
  --es http_method "GET" \
  --ei response_status_code 500 \
  --es response_body '{}'
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.SET_STATUS --ez enabled true
  1. Navigate to Settings > Troubleshoot Connection
  2. Verify the first 4 checks pass (Internet, WordPress.com, Store, Orders)
  3. Verify the Products check shows a red error icon with a failure message and retry button
  4. Disable ApiFaker:
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.SET_STATUS --ez enabled false
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.CLEAR_ENDPOINTS
  1. Tap Retry on the Products check and verify it now succeeds

Orders failure (products check should not run):

  1. Set up ApiFaker to return an error for the orders endpoint:
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.CLEAR_ENDPOINTS
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.ADD_ENDPOINT \
  --es api_type "wp-api" \
  --es path "/wc/v3/orders" \
  --es http_method "GET" \
  --ei response_status_code 500 \
  --es response_body '{}'
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.SET_STATUS --ez enabled true
  1. Navigate to Settings > Troubleshoot Connection
  2. Verify the Orders check fails and the Products check never starts (sequential check stops on first failure)
  3. Clean up:
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.SET_STATUS --ez enabled false
adb shell am broadcast -p com.woocommerce.android.dev -a com.woocommerce.android.apifaker.CLEAR_ENDPOINTS

Images/gif

verification_recording.mov
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. category: unit tests Related to unit testing. category: tracks Related to analytics, including Tracks Events. labels Mar 30, 2026
@dangermattic
Copy link
Copy Markdown
Collaborator

2 Messages
📖

This PR contains changes to Tracks-related logic. Please ensure (author and reviewer) the following are completed:

  • The tracks events must be validated in the Tracks system.
  • Verify the internal Tracks spreadsheet has also been updated.
  • Please consider registering any new events.
  • The PR must be assigned the category: tracks label.
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@hichamboushaba hichamboushaba changed the title Add products check as 5th connectivity test (M2) [Hack Week] Add products check as 5th connectivity test (M2) Mar 30, 2026
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Mar 30, 2026

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

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Build Number736
Version24.4-rc-1
Application IDcom.woocommerce.android.prealpha
Commitb1cc403
Installation URL50fpd9dgb7b8g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@hichamboushaba hichamboushaba force-pushed the hack-week/improve-troubleshooting-screen branch from f594d3e to a9027ed Compare March 30, 2026 17:33
Add StoreProductsCheckUseCase that fetches products via WCProductStore
and maps errors to appropriate FailureTypes. Integrate the new check
into the connectivity tool state machine, view model, and UI.
Add StoreProductsCheckUseCaseTest covering success, timeout, parse,
jetpack, and generic error scenarios. Update OrderConnectivityToolViewModelTest
to include the products check mock and add a dedicated test case.
Add VALUE_CONNECTIVITY_PRODUCTS to the connectivity tool section of
AnalyticsTracker instead of reusing the onboarding VALUE_PRODUCTS.
Add ViewModel test for products check failure terminating the flow.
Use dedicated constants with "connectivity_" prefix matching iOS values:
- Property key: "test" instead of "type"
- WP.com value: "wpCom" instead of "wp_com"
- Orders value: "orders" instead of "jetpack_tunnel"
- Internet/site/products values already matched
@hichamboushaba hichamboushaba force-pushed the hack-week/improve-troubleshooting-screen-m2 branch from 51dfa57 to b1cc403 Compare March 30, 2026 17:37
@hichamboushaba hichamboushaba changed the title [Hack Week] Add products check as 5th connectivity test (M2) [Hack Week] Add products check to the troubleshooting tool Mar 30, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.65%. Comparing base (a9027ed) to head (b1cc403).

Files with missing lines Patch % Lines
...d/ui/connectivitytool/ConnectivityToolViewModel.kt 80.00% 3 Missing and 4 partials ⚠️
...ectivitytool/useCases/StoreProductsCheckUseCase.kt 70.58% 0 Missing and 5 partials ⚠️
...d/ui/connectivitytool/ConnectivityCheckCardData.kt 92.30% 1 Missing ⚠️
Additional details and impacted files
@@                              Coverage Diff                               @@
##             hack-week/improve-troubleshooting-screen   #15584      +/-   ##
==============================================================================
+ Coverage                                       39.62%   39.65%   +0.02%     
- Complexity                                      11333    11342       +9     
==============================================================================
  Files                                            2260     2261       +1     
  Lines                                          130588   130644      +56     
  Branches                                        18301    18311      +10     
==============================================================================
+ Hits                                            51750    51803      +53     
+ Misses                                          73542    73538       -4     
- Partials                                         5296     5303       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: tracks Related to analytics, including Tracks Events. category: unit tests Related to unit testing. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants