React Native Automation

I am not able to get id, accessibilityLabel or testId in IOS app build, Could anyone help me to figure out this.

Developers may need to add them (if they haven’t). Hopefully this helps:

https://appiumpro.com/editions/76-testing-react-native-apps-with-appium

I have added testID and accessibilityLabel in the code but it is not reflecting for IOS. Could you please help on that ?

I take it from this that you have access to the source code for the app and have added a testID and accessibilityLabel that are not working. Sorry I don’t have experience with this.

can you see your added ids e.g. in xCode inspector?

I can able to see in Xcode Inspector but for IOS build the id is not showing in Appium
Example: I gave emailId and passwordId for two different Input fields
Android: It’s coming as expected while clicking emailTextbox the id is emailId
IOS: If I click emailTextbox the id is emailId passwordId expected behaviour is it should show only emailId while clicking emailTextbox

pls show example of any element. how it looks in xCode layout inspector on real iPhone and same with Appium.

This is app code which may work incorrectly.

Could you please suggest me what could be the solution for this issue ?

  1. I bet in xCode is same. it is just problem how you write code. to fix in code - i have no solution. you need ask at react native forum.
  2. now let see what we have:
  • email input which we can found by class XCUIElementTypeTextField and id emailInput. use them BOTH to find input for email.
  • we have element with id submitEmail. use it to tap on “Submit” button

The ids are coming properly in Xcode but not in Appium, That is what we are not able to figure out.

Prove it with screenshot from xCode inspector

As per the screen shot emailInput is coming in Xcode inspector, But in Appium it is emailInput submitEmail. It should be unique id but it is getting all the testID’s of the page.

With xCode see class name not same. You pointing in xCode to last element (TypeTextField) which has same id in Appium inspector.

Hi @Aleksei could you pls add some more points to understand better,
the last comment i couldn’t under stand ,kindly do the needful

see in xCode inspector class ends with TextField which on Appium Inspector matching XCUIElementTypeTextField
image

Deep element structure is React Native code specific which makes harder find correct element plus it slows test execution.

We are able to find testid’s but we are not able to navigate child element in Appium. Please check the attached screenshot.