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:
<View style={styles.row}>
<View style={styles.buttonContainer}>
<TouchableOpacity style={styles.buttonIcon} onPress={this.goToFaqsList.bind(this)} accessible={true} accessibility_id={'FAQs'}>
<Icon style={styles.icon} size={32} name="help" color="white"> </Icon>
</TouchableOpacity>
<Text style={styles.buttonText}>FAQ's</Text>
</View>
<View style={styles.buttonContainer}>
The test:
require 'rubygems'
require 'appium_lib'
capabilities = {
platformName: 'Android',
deviceName: 'Android',
app: '~/workspace/maps2/android/app/build/outputs/apk/app-debug.apk',
}
server_url = "http://0.0.0.0:4723/wd/hub"
# Start the driver
Appium::Driver.new(caps: capabilities).start_driver
Appium.promote_appium_methods Object
wait = Selenium::WebDriver::Wait.new :timeout => 10
wait.until { elementByAccessibilityId("FAQs").displayed? }
source
mobileElement = elementByAccessibilityId("FAQs")
puts(mobileElement)
driver_quit
The " elementByAccessibilityId " was an approach I saw in another topic but I'm getting an error:
Failure/Error: wait.until { elementByAccessibilityId("FAQs").displayed? }
NoMethodError:
undefined method `elementByAccessibilityId' for main:Object
Can someone tell my mistake and point me in the right direction?
Thanks.