update ruby sample
MODIFY
sample-code/ruby/Gemfile
sample-code/ruby/Gemfile
source 'https://www.rubygems.org'
-gem 'appium_lib', '~> 9.10'
+gem 'appium_lib', '~> 9.15'
gem 'rest-client', '~> 2.0.2'
-gem 'rspec', '~> 3.6.0'
-gem 'cucumber', '~> 2.4.0'
-gem 'rspec-expectations', '~> 3.6.0'
+gem 'rspec', '~> 3.8.0'
+gem 'cucumber', '~> 3.1.2'
+gem 'rspec-expectations', '~> 3.8.1'
gem 'spec', '~> 5.3.4'
-gem 'sauce_whisk', '~> 0.0.13'
-gem 'test-unit', '~> 2.5.5'
+gem 'sauce_whisk', '~> 0.1.0'
+gem 'test-unit', '~> 3.2.8'
+gem 'pry'

MODIFY
sample-code/ruby/Gemfile.lock
sample-code/ruby/Gemfile.lock
GEM
remote: https://www.rubygems.org/
specs:
- appium_lib (9.7.5)
- awesome_print (~> 1.8)
- json (>= 1.8)
- nokogiri (~> 1.6, >= 1.6.6)
- selenium-webdriver (~> 3.4, >= 3.4.1)
+ appium_lib (9.15.0)
+ appium_lib_core (~> 1.9.0)
+ nokogiri (~> 1.8, >= 1.8.1)
tomlrb (~> 1.1)
- awesome_print (1.8.0)
+ appium_lib_core (1.9.0)
+ faye-websocket (~> 0.10.0)
+ selenium-webdriver (~> 3.14)
+ backports (3.11.3)
builder (3.2.3)
- childprocess (0.8.0)
+ childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chronic_duration (0.10.6)
numerizer (~> 0.1.1)
- cucumber (2.4.0)
+ coderay (1.1.2)
+ cucumber (3.1.2)
builder (>= 2.1.2)
- cucumber-core (~> 1.5.0)
+ cucumber-core (~> 3.2.0)
+ cucumber-expressions (~> 6.0.1)
cucumber-wire (~> 0.0.1)
- diff-lcs (>= 1.1.3)
- gherkin (~> 4.0)
+ diff-lcs (~> 1.3)
+ gherkin (~> 5.1.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
- cucumber-core (1.5.0)
- gherkin (~> 4.0)
+ cucumber-core (3.2.0)
+ backports (>= 3.8.0)
+ cucumber-tag_expressions (~> 1.1.0)
+ gherkin (>= 5.0.0)
+ cucumber-expressions (6.0.1)
+ cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
diff-lcs (1.3)
- domain_name (0.5.20170404)
+ domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
- ffi (1.9.23)
- gherkin (4.1.3)
+ eventmachine (1.2.7)
+ faye-websocket (0.10.7)
+ eventmachine (>= 0.12.0)
+ websocket-driver (>= 0.5.1)
+ ffi (1.9.25)
+ gherkin (5.1.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
json (2.1.0)
- mime-types (3.1)
+ method_source (0.9.0)
+ mime-types (3.2.2)
mime-types-data (~> 3.2015)
- mime-types-data (3.2016.0521)
+ mime-types-data (3.2018.0812)
mini_portile2 (2.3.0)
multi_json (1.13.1)
multi_test (0.1.2)
netrc (0.11.0)
- nokogiri (1.8.2)
+ nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
numerizer (0.1.1)
+ power_assert (1.1.3)
+ pry (0.11.3)
+ coderay (~> 1.1.0)
+ method_source (~> 0.9.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
- rspec (3.6.0)
- rspec-core (~> 3.6.0)
- rspec-expectations (~> 3.6.0)
- rspec-mocks (~> 3.6.0)
- rspec-core (3.6.0)
- rspec-support (~> 3.6.0)
- rspec-expectations (3.6.0)
+ rspec (3.8.0)
+ rspec-core (~> 3.8.0)
+ rspec-expectations (~> 3.8.0)
+ rspec-mocks (~> 3.8.0)
+ rspec-core (3.8.0)
+ rspec-support (~> 3.8.0)
+ rspec-expectations (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.6.0)
- rspec-mocks (3.6.0)
+ rspec-support (~> 3.8.0)
+ rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.6.0)
- rspec-support (3.6.0)
+ rspec-support (~> 3.8.0)
+ rspec-support (3.8.0)
rubyzip (1.2.1)
- sauce_whisk (0.0.22)
- json (>= 1.8)
- rest-client (>= 1.8)
- selenium-webdriver (3.10.0)
+ sauce_whisk (0.1.0)
+ json
+ rest-client (~> 2.0)
+ selenium-webdriver (3.14.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
spec (5.3.4)
chronic_duration (~> 0.10.2)
- test-unit (2.5.5)
- tomlrb (1.2.6)
+ test-unit (3.2.8)
+ power_assert
+ tomlrb (1.2.7)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
+ websocket-driver (0.7.0)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.3)
PLATFORMS
ruby
DEPENDENCIES
- appium_lib (~> 9.7.4)
- cucumber (~> 2.4.0)
+ appium_lib (~> 9.15)
+ cucumber (~> 3.1.2)
+ pry
rest-client (~> 2.0.2)
- rspec (~> 3.6.0)
- rspec-expectations (~> 3.6.0)
- sauce_whisk (~> 0.0.13)
+ rspec (~> 3.8.0)
+ rspec-expectations (~> 3.8.1)
+ sauce_whisk (~> 0.1.0)
spec (~> 5.3.4)
- test-unit (~> 2.5.5)
+ test-unit (~> 3.2.8)
BUNDLED WITH
- 1.15.3
+ 1.16.3

MODIFY
sample-code/ruby/spec/android_basic_interactions_spec.rb
sample-code/ruby/spec/android_basic_interactions_spec.rb
@@ -28,7 +28,7 @@ desired_caps = {
describe 'Basic Android interactions' do
before(:all) do
- @driver = Appium::Driver.new(desired_caps, true).start_driver
+ @driver = Appium::Driver.new(desired_caps, false).start_driver
end
after(:all) do
@@ -36,28 +36,28 @@ describe 'Basic Android interactions' do
end
it 'should send keys to search box and then check the value' do
- @search_box_element = @driver.find_element(:id, 'txt_query_prefill')
- @search_box_element.send_keys('Hello world!')
+ search_box_element = @driver.find_element :id, 'txt_query_prefill'
+ search_box_element.send_keys 'Hello world!'
- @on_search_requested_button = @driver.find_element(:id, 'btn_start_search')
- @on_search_requested_button.click()
+ on_search_requested_button = @driver.find_element :id, 'btn_start_search'
+ on_search_requested_button.click
- @search_text = @driver.find_element(:id, 'android:id/search_src_text')
- @search_text_value = @search_text.text()
- expect(@search_text_value).to eql('Hello world!')
+ search_text = @driver.find_element :id, 'android:id/search_src_text'
+ search_text_value = search_text.text
+ expect(search_text_value).to eql 'Hello world!'
end
it 'should click a button that opens an alert and then dismisses it' do
@driver.start_activity app_package: PACKAGE, app_activity: ALERT_DIALOG_ACTIVITY
- @open_dialog_button = @driver.find_element(:id, 'io.appium.android.apis:id/two_buttons')
- @open_dialog_button.click()
+ open_dialog_button = @driver.find_element :id, 'io.appium.android.apis:id/two_buttons'
+ open_dialog_button.click
- @alert_element = @driver.find_element(:id, 'android:id/alertTitle')
- @alert_text = @alert_element.text()
- expect(@alert_text).to eql("Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto siwuf cakso dodtos anr koop.")
- @close_dialog_button = @driver.find_element(:id, 'android:id/button1')
+ alert_element = @driver.find_element :id, 'android:id/alertTitle'
+ alert_text = alert_element.text
+ expect(alert_text).to eql "Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto siwuf cakso dodtos anr koop."
+ close_dialog_button = @driver.find_element :id, 'android:id/button1'
- @close_dialog_button.click()
+ close_dialog_button.click
end
end

MODIFY
sample-code/ruby/spec/android_create_session_spec.rb
sample-code/ruby/spec/android_create_session_spec.rb
@@ -26,8 +26,8 @@ describe 'Create Android session' do
@activity = @driver.current_activity
@pkg = @driver.current_package
- expect("#{@pkg}#{@activity}").to eql('io.appium.android.apis.ApiDemos')
+ expect("#{@pkg}#{@activity}").to eql 'io.appium.android.apis.ApiDemos'
- @driver.quit()
+ @driver.quit
end
end

MODIFY
sample-code/ruby/spec/android_create_web_session_spec.rb
sample-code/ruby/spec/android_create_web_session_spec.rb
@@ -25,9 +25,9 @@ describe 'Create Chrome web session' do
@driver.get('https://www.google.com')
- @page_title = @driver.title()
- expect(@page_title).to eql('Google')
+ @page_title = @driver.title
+ expect(@page_title).to eql 'Google'
- @driver.quit()
+ @driver.quit
end
end

MODIFY
sample-code/ruby/spec/android_selectors_spec.rb
sample-code/ruby/spec/android_selectors_spec.rb
@@ -35,22 +35,22 @@ describe 'Basic Android selectors' do
end
it 'should find elements by Accessibility ID' do
- @search_parameters_element = @driver.find_elements(:accessibility_id, 'Content')
- expect(@search_parameters_element.length).to eql 1
+ search_parameters_element = @driver.find_elements :accessibility_id, 'Content'
+ expect(search_parameters_element.length).to eql 1
end
it 'should find elements by ID' do
- @action_bar_container_elements = @driver.find_elements(:id, 'android:id/action_bar_container')
- expect(@action_bar_container_elements.length).to eql 1
+ action_bar_container_elements = @driver.find_elements :id, 'android:id/action_bar_container'
+ expect(action_bar_container_elements.length).to eql 1
end
it 'should find elements by class name' do
- @linear_layout_elements = @driver.find_elements(:class_name, 'android.widget.FrameLayout')
- expect(@linear_layout_elements.length).to be > 1
+ linear_layout_elements = @driver.find_elements :class_name, 'android.widget.FrameLayout'
+ expect(linear_layout_elements.length).to be > 1
end
it 'should find elements by XPath' do
- @linear_layout_elements = @driver.find_elements(:xpath, "//*[@class='android.widget.FrameLayout']")
- expect(@linear_layout_elements.length).to be > 1
+ linear_layout_elements = @driver.find_elements :xpath, "//*[@class='android.widget.FrameLayout']"
+ expect(linear_layout_elements.length).to be > 1
end
end

MODIFY
sample-code/ruby/spec/ios_basic_interactions_spec.rb
sample-code/ruby/spec/ios_basic_interactions_spec.rb
@@ -23,7 +23,7 @@ desired_caps = {
# Start the driver
describe "IOS Basic Interactions" do
before(:all) do
- @driver = Appium::Driver.new(desired_caps, true).start_driver
+ @driver = Appium::Driver.new(desired_caps, false).start_driver
end
after(:all) do
@@ -31,19 +31,19 @@ describe "IOS Basic Interactions" do
end
it "should send keys to inputs" do
- @textFieldEl = @driver.find_element(:id, "TextField1")
- expect(@textFieldEl.attribute(:value)).to be_nil
- @textFieldEl.send_keys("Hello World!")
- expect(@textFieldEl.attribute(:value)).to eq("Hello World!")
+ textFieldEl = @driver.find_element :id, "TextField1"
+ expect(textFieldEl.attribute(:value)).to be_nil
+ textFieldEl.send_keys "Hello World!"
+ expect(textFieldEl.attribute(:value)).to eq "Hello World!"
end
it "should click a button that opens an alert" do
- @buttonElementId = "show alert"
- @buttonElement = @driver.find_element(:accessibility_id, @buttonElementId)
- @buttonElement.click()
- @alertTitleId = "Cool title"
- @alertTitleElement = @driver.find_element(:accessibility_id, @alertTitleId)
- @alertTitle = @alertTitleElement.attribute(:value)
- expect(@alertTitle.attribute(:value)).to eq("Cool title")
+ buttonElementId = "show alert"
+ buttonElement = @driver.find_element :accessibility_id, buttonElementId
+ buttonElement.click
+ alertTitleId = "Cool title"
+ alertTitleElement = @driver.find_element :accessibility_id, alertTitleId
+ alertTitle = alertTitleElement.attribute :name
+ expect(alertTitle).to eq "Cool title"
end
end

MODIFY
sample-code/ruby/spec/ios_create_session_spec.rb
sample-code/ruby/spec/ios_create_session_spec.rb
@@ -22,11 +22,11 @@ desired_caps = {
describe 'Create session' do
it 'should create and destroy IOS sessions' do
- @driver = Appium::Driver.new(desired_caps, true).start_driver
+ @driver = Appium::Driver.new(desired_caps, false).start_driver
- @application_element = @driver.find_element(:class_name, 'XCUIElementTypeApplication')
- @application_name = @application_element.attribute(:name)
- expect(@application_name).to eq('TestApp')
+ application_element = @driver.find_element :class_name, 'XCUIElementTypeApplication'
+ application_name = application_element.attribute :name
+ expect(application_name).to eq 'TestApp'
@driver.quit
end

MODIFY
sample-code/ruby/spec/ios_create_web_session_spec.rb
sample-code/ruby/spec/ios_create_web_session_spec.rb
@@ -22,10 +22,10 @@ desired_caps = {
describe 'Create Safari session' do
it 'should create and destroy IOS Safari session' do
- @driver = Appium::Driver.new(desired_caps, true).start_driver
+ @driver = Appium::Driver.new(desired_caps, false).start_driver
- @driver.get('https://www.google.com')
- expect(@driver.title).to eql('Google')
+ @driver.get 'https://www.google.com'
+ expect(@driver.title).to eql 'Google'
@driver.quit
end

MODIFY
sample-code/ruby/spec/ios_selectors_spec.rb
sample-code/ruby/spec/ios_selectors_spec.rb
@@ -8,7 +8,7 @@ APP_PATH = ENV['SAUCE_LABS'] ? 'http://appium.github.io/appium/assets/TestApp7.1
desired_caps = {
caps: {
platformName: 'iOS',
- platformVersion: ENV["IOS_PLATFORM_VERSION"] || '11.1',
+ platformVersion: ENV["IOS_PLATFORM_VERSION"] || '10.3',
deviceName: ENV["IOS_DEVICE_NAME"] || 'iPhone 6s',
app: APP_PATH,
automationName: 'XCUITest',
@@ -30,28 +30,28 @@ describe 'Basic IOS selectors' do
end
it 'should find elements by Accessibility ID' do
- @compute_sum_buttons = @driver.find_elements(:accessibility_id, 'ComputeSumButton')
- expect(@compute_sum_buttons.length).to eql(1)
- @compute_sum_buttons[0].click()
+ compute_sum_buttons = @driver.find_elements :accessibility_id, 'ComputeSumButton'
+ expect(compute_sum_buttons.length).to eql 1
+ compute_sum_buttons[0].click
end
it 'should find elements by class name' do
- @window_elements = @driver.find_elements(:class_name, 'XCUIElementTypeWindow')
- expect(@window_elements.length).to be > 1
+ window_elements = @driver.find_elements :class_name, 'XCUIElementTypeWindow'
+ expect(window_elements.length).to be > 1
end
it 'should find elements by NSPredicateString' do
- @all_visible_elements = @driver.find_elements(:predicate, 'visible = 1')
- expect(@all_visible_elements.length).to be > 1
+ all_visible_elements = @driver.find_elements :predicate, 'visible = 1'
+ expect(all_visible_elements.length).to be > 1
end
it 'should find elements by class chain' do
- @window_element = @driver.find_elements(:class_chain, 'XCUIElementTypeWindow[1]/*[2]')
- expect(@window_element.length).to be(1)
+ window_element = @driver.find_elements :class_chain, 'XCUIElementTypeWindow[1]/*[2]'
+ expect(window_element.length).to be 1
end
it 'should find elements by XPath' do
- @buttons = @driver.find_elements(:xpath, '//XCUIElementTypeWindow//XCUIElementTypeButton')
- expect(@buttons.length).to be > 1
+ buttons = @driver.find_elements :xpath, '//XCUIElementTypeWindow//XCUIElementTypeButton'
+ expect(buttons.length).to be > 1
end
end

update ruby sample (#11203)