Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestIds not working correctly for Maestro #2743

Open
ChristopherGabba opened this issue Aug 14, 2024 · 6 comments
Open

TestIds not working correctly for Maestro #2743

ChristopherGabba opened this issue Aug 14, 2024 · 6 comments
Labels

Comments

@ChristopherGabba
Copy link

ChristopherGabba commented Aug 14, 2024

Describe the bug

I am using Maestro and the Ignite boilerplate, and no matter what I name my text fields testId field, maestro never picks it up. I'm not sure if this is a bug with Maestro, or if this is a bug with the ignite TextField component. If it turns out to be Maestro, please feel free to close this issue.

        <TextField
          ref={firstNameInput}
          value={firstName}
          onChangeText={(e) => setProp("firstName", e)}
          autoCapitalize="words"
          autoComplete="name-given"
          autoCorrect={false}
          labelTx="enterNameScreen.firstNameLabel"
          helper={firstNameError}
          status={firstNameError ? "error" : undefined}
          onSubmitEditing={() => lastNameInput.current?.focus()}
          testID={'firstNameTextField'} // <---------------------------- `worthless` field :)
        />
# test.yaml
# TEST ENTERNAMESCREEN
appId: com.chris.testapp
---

- tapOn: 
     id: "firstNameTextField" # never focuses text field, have to use point: 50%,30%

Ignite version

9.8

Additional info

System
platform darwin
arch arm64
cpu 10 cores Apple M2 Pro
directory TestApp /Users/christophergabba/Documents/TestApp

JavaScript (and globally-installed packages)
node 22.6.0 /opt/homebrew/bin/node
npm 10.8.2 /opt/homebrew/bin/npm
@aws-amplify/cli-internal 12.12.0
@aws-amplify/cli 12.12.1
@react-native-community/netinfo 9.4.1
eas-cli 10.2.2
expo-cli 6.3.10
firebase-tools 11.24.1
n 9.1.0
node-gyp 10.0.1
node 20.6.0
npm 10.7.0
pod-install 0.2.2
react-native-spinkit 1.5.1
test-app -
testappwebsite 0.0.0
typescript 5.4.5
yarn 1.22.22
yarn 1.22.22 /opt/homebrew/bin/yarn
create-amplify 1.0.1
pnpm - not installed
bun - not installed
expo 51.0.26 managed

Ignite
ignite-cli 9.8.2 /Users/christophergabba/.npm/_npx/e31027f3785124a8/node_modules/.bin/ignite
ignite src build /Users/christophergabba/.npm/_npx/e31027f3785124a8/node_modules/ignite-cli/build

Android
java 1.8.0_371 /usr/bin/java
android home - /Users/christophergabba/Library/Android/sdk

iOS
xcode 15.4
cocoapods 1.12.1 /opt/homebrew/bin/pod

Tools
git git version 2.39.2 /opt/homebrew/bin/git

@frankcalise
Copy link
Contributor

Hi @ChristopherGabba thanks for the report, sorry you're having trouble.

It very well could be something with the component, we'll look into that. We do have an example of logging into the app in a maestro test, but yeah this isn't using test ID - you don't however have to rely on point, we used placeholder here as an example: https://github.com/infinitered/ignite/blob/master/boilerplate/.maestro/Login.yaml

Will check into it, thanks!

@ChristopherGabba
Copy link
Author

That's correct, the placeholder field seems to work fine, my app just doesn't use them. Without the testIds I have to use the screen coordinates which is super tedious haha

@frankcalise
Copy link
Contributor

@ChristopherGabba can you let me know what platforms you were testing with this so I can properly reproduce?

@ChristopherGabba
Copy link
Author

ChristopherGabba commented Aug 16, 2024

@frankcalise Sorry about that,Expo Managed Workflow on iPhone simulator build

@frankcalise
Copy link
Contributor

frankcalise commented Aug 16, 2024

@ChristopherGabba thanks. Confirmed it is working on Android.

After my first pass, it seems to do with the TouchableOpacity that is over the TextInput not allowing access to the testID perhaps. The testID is properly set on the RCTUITextField (I confirmed this with Xcode).

As a workaround for now, you can try setting the testID prop on TouchableOpacity around line 179 in app/components/TextField.tsx.

<TouchableOpacity
      activeOpacity={1}
      style={$containerStyles}
      onPress={focusInput}
      accessibilityState={{ disabled }}
      testID={TextInputProps.testID} // you could also just make this change for iOS specifically
    >

@ChristopherGabba
Copy link
Author

Ah perfect! That's a super simple workaround, will do! This will speed up so much. The same issue may be on the Button and Icon component as well, I'm not 100% sure yet but remember I may have had issues with one of those as well. I'm not near my computer for the next couple of days but I'll look to see if those act the same.

Thanks @frankcalise!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants