I have been trying to trigger a tap event from my tests, the non accessible behaviour comes from a swipe with PanResponder. No there is no onPress on the page, rather we enable the View as a role="button" and add the onAccessibilityTap which tested via screen reader and works as expected.
<View
accessible
accessibilityLabel={a11yLabel}
onAccessibilityTap={onTapCallback}
accessibilityRole="button"
>
...
</View>
I've looked at the docs and I can only see press, scroll, and changeText. Attempting to use it by fireEvent(elemInstance, 'eventName') does not work either for various combinations.
Do we know if this is possible? If so how?
Many thanks!
You could use fireEvent(elementInstance, 'accessibilityTap');. Event name is built as can be seen here: https://github.com/callstack/react-native-testing-library/blob/master/src/fireEvent.js#L85-L86
Thanks @RafikiTiki !
Most helpful comment
You could use
fireEvent(elementInstance, 'accessibilityTap');. Event name is built as can be seen here: https://github.com/callstack/react-native-testing-library/blob/master/src/fireEvent.js#L85-L86