简体   繁体   English

如何测试 React Native Slider

[英]How to test React Native Slider

I have worked on a Slider component using React Native Slider .我使用React Native Slider处理了一个 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:但是根据React Native 测试库文档,只有三个手势是:

  1. fireEvent.Press fireEvent.Press
  2. fireEvent.changeText fireEvent.changeText
  3. fireEvent.scroll fireEvent.scroll

Is there anyway to simulate the sliding gesture?反正有模拟滑动手势吗?

If you want to stick with react native library component testing, try out:如果您想坚持使用 react 原生库组件测试,请尝试:

fireEvent(el, 'rowOpen', eventData);
// or
fireEvent(el, 'onRowOpen', eventData);

Source 资源

This functionality can also be achieved with either Appium or Detox, and would require starting up a simulator or physical device.此功能也可以通过 Appium 或 Detox 实现,并且需要启动模拟器或物理设备。 Both of them, under-the-hood would be using the Native Espresso/XCUITest drivers to achieve this.他们俩在后台都将使用 Native Espresso/XCUITest 驱动程序来实现这一点。

I suggest using Detox , or Appium controlled via WebDriverIO .我建议使用Detox通过 WebDriverIO 控制的 Appium

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM