mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.86k stars 280 forks source link

TapOn text input using its placeholder doesnt alway work on React Native(iOS) #2062

Open itsramiel opened 1 month ago

itsramiel commented 1 month ago

Is there an existing issue for this?

Steps to reproduce

  1. Clone https://github.com/itsramiel/MaestroInputTapOnRepro
  2. run yarn, then cd ios && pod install to install dependencies
  3. run the ios app with npx react-native@latest run-ios
  4. run maestro test with maestro test __e2e__/test.yaml
  5. Observe that the test fails because step: - tapOn: 'Enter text' fails

Actual results

For some reason the test fails to pick up tapOn commands in certain conditions.

For example it works if you remove the top level Pressable and replace it with a View like so:

    <View style={styles.screen}>
      <View
        style={{
          padding: 10,
          backgroundColor: 'black',
          flexDirection: 'row',
          gap: 16,
        }}>
        <TextInput placeholder="Enter text" placeholderTextColor="red" />
        <Pressable style={{ width: 32, height: 32, backgroundColor: 'red' }}>
          <Text>Hello</Text>
        </Pressable>
      </View>
    </View>

or it works if you remove the Hello sibling to the text input:

    <View style={styles.screen}>
      <Pressable
        style={{
          padding: 10,
          backgroundColor: 'black',
          flexDirection: 'row',
          gap: 16,
        }}>
        <TextInput placeholder="Enter text" placeholderTextColor="red" />
      </Pressable>
    </View>

Expected results

I expect the text input with the visible placeholder text to be correctly tapped on

About app

React Native open source

About environment

macOS: 14.6.1, Apple M3 chip

Logs

Logs ``` ```

Maestro version

1.38.1

How did you install Maestro?

Homebrew

Anything else?

No response