To input text to a TextInput component, first the component needs to be selected. This can be done using the tapOn command. For the component definition:
<TextInput placeholder="Change me!"/>
The following commands will enter "Hello, Maestro!" in the TextInput component:
Run npm start in the react native app source directory
Select either Android or iOS Simulator
In another terminal, run maestro test flow.yaml
When the Expo app launches, select the app that you’re testing
Demo
Interacting with nested components on iOS
In some cases, you may run into issues with nested tappable / accessible elements on iOS. You can resolve these issues by enabling accessibility for the inner component and disabling it for the outer container.
Example: Tapping on nested Text Component
<TouchableOpacitystyle={{ borderWidth:1, margin:5, padding:10, backgroundColor:'#ddd' }} accessible={false}> <Text>This is the wrapper button </Text> <TouchableOpacitystyle={{ backgroundColor:'red', padding:5, width:'50%', marginTop:10 }} accessible={true}> <Text>I'm a small button</Text> </TouchableOpacity></TouchableOpacity>
The following command will tap on the nested Text Component: