-
Notifications
You must be signed in to change notification settings - Fork 137
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
[POS] Custom payment UI — Part 5 | Unit tests clean up #12943
Conversation
`given collect payment shown, when RETRY message received, then collect payment hint updated`
77a1b42
to
8676fe1
Compare
`given collect payment shown, when INSERT_CARD received, then collect payment hint updated`
`given collect payment shown, when SWIPE_CARD received, then collect payment hint updated`
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
`given collect payment shown, when REMOVE_CARD received, then collect payment hint updated`
`given collect payment shown, when TRY_OTHER_CARD message received, then collect payment hint updated`
`given collect payment shown, when CARD_REMOVED_TOO_EARLY message received, then collect payment hint updated`
`given collect payment shown, when TRY_OTHER_READ message received, then collect payment hint updated`
`given collect payment shown, when MULTIPLE_CARDS_DETECTED received, then collect payment hint updated`
`given fetching order fails, when payment screen shown, then ExternalReaderFailedPayment state is shown`
`given fetching order fails and tpp, when payment screen shown, then BuiltInReaderFailedPayment state is shown`
`when fetching order fails, then event tracked`
`given fetching order succeeds, when payment screen shown, then order currency stored `
`when payment screen shown, then loading data state is emitted`
`when payment not collectable, then error event emitted and flow terminated`
`when flow started, then correct payment description is propagated to CardReaderManager`
`when flow started, then correct statement descriptor is propagated to CardReaderManager`
`when initializing payment, then Loading state emitted`
`when collecting payment, then CollectingPayment state emitted`
`given built in reader,when collecting payment, then ui CollectingPayment state emitted`
`when processing payment, then ProcessingPayment state emitted`
`given built in reader, when processing payment, then ProcessingPayment state emitted`
`when processing payment completed with card present, then tracking keeper stores payment type`
`given billing email empty and built in, when user clicks on print receipt button, then event tracked`
`given billing email not empty and external, when user clicks on print receipt button, then event tracked`
`given billing email not empty and built in, when user clicks on print receipt button, then event tracked`
`given get receipt url fails, when user clicks on print receipt button, then error event emitted`
`given get receipt url succeeds, when user clicks on print receipt button, then PrintReceipt emitted`
`when OS accepts the print request, then print success event tracked` `when OS refuses the print request, then print failed event tracked` `when manually cancels the print request, then print cancelled event tracked`
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:background="?attr/colorSurface" |
Check warning
Code scanning / Android Lint
Overdraw: Painting regions more than once Warning
@@ -4372,4 +4381,5 @@ | |||
<string name="woo_shipping_labels_package_creation_add_package">Add Package</string> | |||
<string name="woo_shipping_labels_package_creation_box_type">Box</string> | |||
<string name="woo_shipping_labels_package_creation_envelope_type">Envelope</string> | |||
<string name="email_not_registered_wpcom">Hmm, we can\'t find a WordPress.com account connected to this email address.</string> |
Check warning
Code scanning / Android Lint
Unused resources Warning
`given collect payment NOT shown, when show additional info event received, then event ignored`
#12943
Description
The intent of This PR is to clean up unit tests of
CardReaderPaymentControllerTest
andCardReaderPaymentViewModelTest
.This is part 5 of 5 PRs refactoring the Payment flow:
💡 This PR intends to merge changes to the
feature/custom-payment-ui
feature branch, that will be additionally tested and merged totrunk
later.Testing information
This PR is quite big, however, it modifies only two files:
CardReaderPaymentControllerTest
andCardReaderPaymentViewModelTest
. It also does not introduce any new tests, only moves test methods around so that they are closer to the class they are testing.ViewState
testsI copied all the unit test methods verifying
CardReaderPaymentViewModel.viewStateData
toCardReaderPaymentControllerTest
and adapted them to testCardReaderPaymentController.paymentState
instead. I left original tests as well because they are testing theCardReaderPaymentStateToViewStateMapper
as a black box.ViewState
were moved toCardReaderPaymentControllerTest
(and removed fromCardReaderPaymentViewModelTest
)The tests that have been performed
I verified that
CardReaderPaymentViewModelTest
does not contain test methods that are more suitable for the controller.Testing
I recommend checking this PR as a whole
CardReaderPaymentViewModelTest
and look if there is a class that could be moved or copied/adapted to theCardReaderPaymentController
class.Images/gif
—
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: