Skip to content

Conversation

@hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Dec 5, 2024

Description

As part of my Hack Week, I'm bringing back the ApiFaker project paqN3M-SI-p2, and I'm splitting the feature into multiple PRs.

This PR adds support for matching endpoints using query parameters too, in the endpoint definition, we can add a list of query parameters that will filter which endpoints to mock, the logic adapts for the syntax of Jetpack tunneled requests and regular endpoints.

Steps to reproduce

  1. Use debug build.
  2. Open the app settings.
  3. Tap on Developer options.
  4. Tap on ApiFaker.
  5. Add a new endpoint definition.
  6. Enter the path and choose the endpoint type.
  7. Tap on ➕ button to add some query parameters.

Testing information

  • Confirm that only endpoints matching the query parameters are matched, you can use the endpoint /wc/v3/orders with query parameter search={some term} and use the search feature of the order list to see if the logic works as expected.
  • Preferrably test using WordPress.com login and site credentials login.

The tests that have been performed

^

Images/gif



  • 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.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@hichamboushaba hichamboushaba added type: task An internally driven task. status: do not merge Dependent on another PR, ready for review but not ready for merge. labels Dec 5, 2024
@hichamboushaba hichamboushaba changed the base branch from trunk to task/api-faker-4 December 5, 2024 20:08
@dangermattic
Copy link
Collaborator

dangermattic commented Dec 5, 2024

2 Errors
🚫 Please add tests for class QueryParameterConverter (or add unit-tests-exemption label to ignore this).
🚫 This PR is tagged with status: do not merge label(s).

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 5, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitad5f00f
Direct Downloadwoocommerce-wear-prototype-build-pr13083-ad5f00f.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 5, 2024

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

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitad5f00f
Direct Downloadwoocommerce-prototype-build-pr13083-ad5f00f.apk

@hichamboushaba hichamboushaba marked this pull request as ready for review December 6, 2024 09:07
@hichamboushaba hichamboushaba added this to the 21.3 milestone Dec 6, 2024
@JorgeMucientes JorgeMucientes self-assigned this Dec 10, 2024
Copy link
Contributor

@JorgeMucientes JorgeMucientes left a comment

Choose a reason for hiding this comment

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

Nicely done @hichamboushaba. Code looks good and everything works as expected.

I just left a really minor nitpick. But nothing concerning. Approving!

This makes sure the log is not printed when the matched endpoints use different query parameters.
@hichamboushaba hichamboushaba merged commit 60ba59a into task/api-faker-4 Dec 17, 2024
4 of 7 checks passed
@hichamboushaba hichamboushaba deleted the task/api-faker-5 branch December 17, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: do not merge Dependent on another PR, ready for review but not ready for merge. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants