This env.rb file provides setup and common functionality across all features. It’s included first before every test run, and the methods provided here can be used in any of the step definitions used in a test.

This is a great place to put shared data like the location of your app, the capabilities you want to test with, and the setup of selenium.

require 'appium_lib'
require 'cucumber'
require 'require_all'

require_all 'lib'
class AppiumWorld
end

caps = {
  caps: {
    'platformName' => ENV['PLATFORM'],
    'platformVersion' => ENV['VERSION'],
    'deviceName' => ENV['DEVICE'],
    ENV['METHOD'] => ENV['METHOD'],
    'app' => ENV['APP_PATH'],
    'newCommandTimeout' => '200'
  }
}

Appium::Driver.new(caps)
Appium.promote_appium_methods AppiumWorld

World { AppiumWorld.new }

def app
  @app = AppBase.new($driver)
end

Before { $driver.start_driver }
After { $driver.driver_quit }
Tagged in : #Ruby

Bibhudatta

She loves coding for web and working with Microsoft Technologies. She has developed enterprise applications with B2B and B2C business models for worlds leading Financial and Retail chain market.

Join The Discussion

Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.