-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RNMobile] Test Helpers: Provide onPickerButtonPressed
arg to setupPicker
helper
#50493
[RNMobile] Test Helpers: Provide onPickerButtonPressed
arg to setupPicker
helper
#50493
Conversation
The onManualTrigger arg is optional, and necessary for times when the picker is manually triggered via a user event.
This change is necessary now that the selectOption function is async.
Size Change: +3.5 kB (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
setupPicker
test helper function for iOS
Flaky tests detected in a9ee3c7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4938177806
|
setupPicker
test helper function for iOSsetupPicker
helper function
|
This commit pulls in the changes from this PR, which are needed to use the picker in our tests: WordPress/gutenberg#50493
setupPicker
helper functiononPickerButtonPressed
arg to setupPicker
helper
@SiobhyB following this comment, I'm not sure if we really need this change to test the picker. Could you share an example of the issue you were having? Thanks! |
Closing, as discussed in wordpress-mobile/gutenberg-mobile#5754 (comment). |
What?
This PR adds an optional
onPickerButtonPressed
callback to thesetupPicker
helper function, allowing easier testing on iOS for components likeSelectControl
, which display a native iOS action sheet only when pressed.Why?
In certain test cases for iOS, the picker is only displayed after manually pressing a button, for example in
SelectControl
. Attempting to usesetupPicker
in these cases doesn't work as expected out-of-the-box due to timeout issues.By providing an
onPickerButtonPressed
callback, we can avoid timeout issues and more accurately simulate user interaction.How?
The
setupPicker
function now accepts an optional third argument,onPickerButtonPressed
, which defaults to an empty function. By awaiting theonPickerButtonPressed
function, we ensure that any required setup or interaction occurs before the picker is displayed.Testing Instructions
setupPicker
helper on iOS.successfully uploads items
Gallery test. Apply the following patch to isolate that test:After applying the above patch, run the
TEST_RN_PLATFORM=ios npm run native test -- gallery/test/index
command in the terminal to verify it still passes following the changes in this PR.Verify that it's possible to successfully pass the new argument to the helper. An example of this being used be found in VideoPress block: Add tests to verify Privacy and Rating settings wordpress-mobile/gutenberg-mobile#5754.