I have worked on a Slider component using React Native Slider. And now I want to test it by simulating the sliding gesture. But according to React Native Testing Library documentation, there are only three gestures which are:
- fireEvent.Press
- fireEvent.changeText
- fireEvent.scroll
Is there anyway to simulate the sliding gesture?
CodePudding user response:
If you want to stick with react native library component testing, try out:
fireEvent(el, 'rowOpen', eventData);
// or
fireEvent(el, 'onRowOpen', eventData);
This functionality can also be achieved with either Appium or Detox, and would require starting up a simulator or physical device. Both of them, under-the-hood would be using the Native Espresso/XCUITest drivers to achieve this.
I suggest using Detox, or Appium controlled via WebDriverIO.