mirror of
https://github.com/appium/appium.git
synced 2026-01-14 06:10:01 -06:00
34 lines
1.0 KiB
Ruby
34 lines
1.0 KiB
Ruby
require 'rubygems'
|
|
require 'appium_lib'
|
|
require 'test/unit'
|
|
extend Test::Unit::Assertions
|
|
|
|
APP_PATH = ENV['SAUCE_LABS'] ? 'http://appium.github.io/appium/assets/ApiDemos-debug.apk' : '../apps/ApiDemos-debug.apk'
|
|
|
|
desired_caps = {
|
|
caps: {
|
|
platformName: 'Android',
|
|
platformVersion: ENV['SAUCE_LABS'] ? (ENV["ANDROID_PLATFORM_VERSION"] || '7.1') : ENV["ANDROID_PLATFORM_VERSION"],
|
|
deviceName: ENV["ANDROID_DEVICE_VERSION"] || 'Android',
|
|
app: APP_PATH,
|
|
automationName: 'UIAutomator2',
|
|
},
|
|
appium_lib: {
|
|
sauce_username: ENV['SAUCE_LABS'] ? ENV['SAUCE_USERNAME'] : nil,
|
|
sauce_access_key: ENV['SAUCE_LABS'] ? ENV['SAUCE_ACCESS_KEY'] : nil,
|
|
wait: 60
|
|
}
|
|
}
|
|
|
|
describe 'Create Android session' do
|
|
it 'should create and destroy Android sessions' do
|
|
@driver = Appium::Driver.new(desired_caps, true).start_driver
|
|
|
|
@activity = @driver.current_activity
|
|
@pkg = @driver.current_package
|
|
expect("#{@pkg}#{@activity}").to eql 'io.appium.android.apis.ApiDemos'
|
|
|
|
@driver.quit
|
|
end
|
|
end
|