React Native automation testing using appium, run on Android emulator


#1

I have a script testcase using appium with ruby, here’s my config file:

require 'selenium-webdriver'
require 'appium_lib'

class AppiumWorld
  def capabilities
    {
        'platformName' => 'Android',
        'deviceName' => 'Samsung Galaxy S6',
        'platformVersion' => '6.0',
        'apppackage' => 'com.btaskee',
        'appactivity' => 'com.btaskee.MainActivity',
        'androidDeviceReadyTimeout' => 10,
        'dontStopAppOnReset' => true,
        'app' => File.expand_path('../android/app/build/outputs/apk/app-debug.apk', Dir.pwd),
      }
  end

  def server_url
    "http://127.0.0.1:4723/wd/hub"
  end
end

def selenium
  @driver ||= Selenium::WebDriver.for(:remote, :desired_capabilities => AppiumWorld.new.capabilities, :url => AppiumWorld.new.server_url)
end

In the other file, I run the testcase using this code:

action = Appium::TouchAction.new.swipe(start_x: 200, start_y: 200, offset_x: 200, offset_y: 500, duration: 500)
action.perform

And I’m getting an error:

undefined method `device_is_android?' for nil:NilClass (NoMethodError)

I’m using appium 1.7.1
Please help !!!


#2

Hi, I am learning react native and was wondering if you could answer. Do you use Appium or Selenim for ui automation tests on react native?
Do you have some good suggestions to look at how to do that, like tutorials, links, articles etc?
Why not using yest for react native? (I havent used yest either but heard lots of people recommending it)