I'm trying to test a
<Text> component and am getting the error:
Cannot read property 'children' of undefined
You need to
<Text> component before testing it, otherwise Cavy
does not have access to its props. See the API documentation
for examples of using the
How does Cavy compare to Appium? What is the benefit?
Cavy is a comparable tool to Appium. The key difference is that Appium uses native hooks to access components (accessibility IDs), wheras Cavy uses React Native refs. This means that Cavy sits directly within your React Native environment (working identically with both Android and iOS builds), making it easy to integrate into your application very quickly, without much overhead.
What does this allow me to do that Jest does not?
Jest is a useful tool for unit testing individual React Native components, whereas Cavy is an integration testing tool allowing you to run end-to-end user interface tests.
How does Cavy compare to other end-to-end frameworks for React Native?
The most obvious comparison is to Detox:
|Installation and set up||This is a major plus for Cavy - installation and set up is identical for both iOS and Android. The only set up you need to do is wrap your app in Cavy's Tester component.||Installation and set up is different for both iOS and Android - both involve a fair amount of configuration. You also need to choose and set up a third party test runner e.g. Jest. In order to run tests you need to add app-specific configuration to your ||Cavy is really lightweight, and is much easier to set up and get running quickly. There is no custom configuration.|
|Testing on devices||Cavy supports running tests on real devices and simulators for both Android and iOS.||Detox supports running tests on real devices and simulators for Android. For iOS, only simulators are supported, with realdevice support still on the roadmap.||Cavy offers more real-device support.|
|Hooking up components||Hook up components by setting a test reference as its ref. If you're using refs for another purpose already, you can still pass these in as a second argument.||Hook up components by setting a test reference as its ||Overhead for both Cavy and Detox is about the same.|