Hi,
I’m developing a React Native app for Android and I’ve been learning and trying to do my first test in Ruby. Right now I would like my test to wait for the app’s main screen to load and then touch a React ‘TouchableOpacity’ button.
The React Native code is the following:
In Ruby methods are usually not camelcased. You’ll find that they almost always use lowercase and underscores. I think what you are looking for is more like:
However, ‘FAQs’ doesn’t look like an accessibility_id. It looks more like the name of an element to me (although I could be wrong, of course). Since you’ve already called Appium.promote_appium_methods, you can call @driver.find_element directly. Maybe something like:
Thank you both for the quick replies. I finally got it working. @wreed, find_element(:name, ‘FAQs’) throws an error saying that “name” is not a valid Locator, and then:
Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
However in the React Native code I changed the attribute accessibility_id={‘FAQs’} to accessibilityLabel={‘FAQ’}, and in the ruby test file find_element(:accessibility_id, ‘FAQs’). And it’s working! Now I can .click() the button and continue testing
I’ll take a look in the docs https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md and see what other functions we have available to use