appium_lib 9.1.3 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/docs/ios_xcuitest.md CHANGED
@@ -8,6 +8,7 @@
8
8
  ## find elements
9
9
  - supported elements by find_element are:
10
10
  - [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver/blob/master/lib/commands/find.js#L17)
11
+ - [locatorStrategies](https://github.com/appium/appium-xcuitest-driver/blob/95886f1118d71fe950768f8262179d3608b40fc7/lib/driver.js#L81)
11
12
  - [WebDriverAgent](https://github.com/facebook/WebDriverAgent/blob/8346199212bffceab24192e81bc0118d65132466/WebDriverAgentLib/Commands/FBFindElementCommands.m#L111)
12
13
  - Mapping
13
14
  - https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m#L19
data/ios_tests/appium.txt CHANGED
@@ -8,3 +8,4 @@ app = "./UICatalog.app"
8
8
  [appium_lib]
9
9
  sauce_username = ""
10
10
  sauce_access_key = ""
11
+ wait = 30
@@ -32,21 +32,19 @@ describe 'driver' do
32
32
 
33
33
  describe 'Appium::Driver attributes' do
34
34
  t 'verify all attributes' do
35
- 2.times { set_wait 30 } # must set twice to validate last_waits
36
35
  actual = driver_attributes
37
36
  caps_app_for_teardown = actual[:caps][:app]
38
- actual[:caps][:app] = File.basename actual[:caps][:app]
39
-
37
+ expected_app = File.absolute_path('UICatalog.app')
40
38
  expected_caps = ::Appium::Driver::Capabilities.init_caps_for_appium(platformName: 'ios',
41
39
  platformVersion: '10.1',
42
40
  automationName: 'XCUITest',
43
41
  deviceName: 'iPhone Simulator',
44
- app: 'UICatalog.app')
42
+ app: expected_app)
45
43
  expected = { caps: expected_caps,
44
+ automation_name: 'XCUITest',
46
45
  custom_url: false,
47
46
  export_session: false,
48
47
  default_wait: 30,
49
- last_waits: [30, 30],
50
48
  sauce_username: nil,
51
49
  sauce_access_key: nil,
52
50
  port: 4723,
@@ -90,14 +88,12 @@ describe 'driver' do
90
88
 
91
89
  t 'no_wait' do
92
90
  no_wait
93
- default_wait.must_equal 0
94
- set_wait 30
91
+ proc { find_element(:accessibility_id, 'zz') }.must_raise Selenium::WebDriver::Error::NoSuchElementError
92
+ set_wait
95
93
  end
96
94
 
97
95
  t 'default_wait attr' do
98
- set_wait 31 # set wait and no_wait update default_wait
99
- default_wait.must_equal 31
100
- set_wait 30
96
+ default_wait.must_equal 30
101
97
  end
102
98
 
103
99
  t 'app_path attr' do
@@ -219,11 +215,11 @@ describe 'driver' do
219
215
  set_wait(2).must_equal(2)
220
216
  set_wait.must_equal(30)
221
217
  set_wait(3).must_equal(3)
222
- set_wait.must_equal(2)
218
+ set_wait.must_equal(30)
223
219
 
224
220
  set_wait(2).must_equal(2)
225
221
  set_wait(3).must_equal(3)
226
- set_wait.must_equal(2)
222
+ set_wait.must_equal(30)
227
223
  end
228
224
 
229
225
  t 'default_wait' do
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '9.1.3'.freeze unless defined? ::Appium::VERSION
4
- DATE = '2017-01-04'.freeze unless defined? ::Appium::DATE
3
+ VERSION = '9.2.0'.freeze unless defined? ::Appium::VERSION
4
+ DATE = '2017-01-09'.freeze unless defined? ::Appium::DATE
5
5
  end
@@ -8,7 +8,7 @@ module Appium
8
8
  #
9
9
  # ```ruby
10
10
  # action_1 = TouchAction.new.press(x: 45, y: 100).wait(5).release
11
- # action_2 = TouchAction.new.tap(element: el, x: 50, y:5, count: 3).release
11
+ # action_2 = TouchAction.new.tap(element: el, x: 50, y:5, count: 3)
12
12
  #
13
13
  # multi_touch_action = MultiTouch.new
14
14
  # multi_touch_action.add action_1
@@ -75,7 +75,8 @@ module Appium
75
75
  chain_method(:release, args)
76
76
  end
77
77
 
78
- # Touch a point on the screen
78
+ # Touch a point on the screen.
79
+ # Alternatively, you can use `press(...).release.perform` instead of `tap(...).perform`.
79
80
  #
80
81
  # @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
81
82
  # @option opts [integer] :x x co-ordinate to tap
@@ -280,9 +280,7 @@ module Appium
280
280
  # Returns the default client side wait.
281
281
  # This value is independent of what the server is using
282
282
  # @return [Integer]
283
- attr_accessor :default_wait
284
- # Array of previous wait time values
285
- attr_accessor :last_waits
283
+ attr_reader :default_wait
286
284
  # Username for use on Sauce Labs
287
285
  attr_accessor :sauce_username
288
286
  # Access Key for use on Sauce Labs
@@ -291,7 +289,8 @@ module Appium
291
289
  attr_accessor :appium_port
292
290
  # Device type to request from the appium server
293
291
  attr_accessor :appium_device
294
- # Automation name sent to appium server
292
+ # Automation name sent to appium server or received from server
293
+ # If automation_name is nil, it is not set both client side and server side.
295
294
  attr_reader :automation_name
296
295
  # Appium's server version
297
296
  attr_reader :appium_server_version
@@ -340,7 +339,6 @@ module Appium
340
339
  @custom_url = appium_lib_opts.fetch :server_url, false
341
340
  @export_session = appium_lib_opts.fetch :export_session, false
342
341
  @default_wait = appium_lib_opts.fetch :wait, 0
343
- @last_waits = [@default_wait]
344
342
  @sauce_username = appium_lib_opts.fetch :sauce_username, ENV['SAUCE_USERNAME']
345
343
  @sauce_username = nil if !@sauce_username || (@sauce_username.is_a?(String) && @sauce_username.empty?)
346
344
  @sauce_access_key = appium_lib_opts.fetch :sauce_access_key, ENV['SAUCE_ACCESS_KEY']
@@ -401,10 +399,10 @@ module Appium
401
399
  def driver_attributes
402
400
  attributes = {
403
401
  caps: @caps,
402
+ automation_name: @automation_name,
404
403
  custom_url: @custom_url,
405
404
  export_session: @export_session,
406
405
  default_wait: @default_wait,
407
- last_waits: @last_waits,
408
406
  sauce_username: @sauce_username,
409
407
  sauce_access_key: @sauce_access_key,
410
408
  port: @appium_port,
@@ -550,6 +548,7 @@ module Appium
550
548
  #
551
549
  # @return [Selenium::WebDriver] the new global driver
552
550
  def start_driver
551
+ # open_timeout and read_timeout are explicit wait.
553
552
  @http_client ||= Selenium::WebDriver::Remote::Http::Default.new(open_timeout: 999_999, read_timeout: 999_999)
554
553
 
555
554
  begin
@@ -578,44 +577,30 @@ module Appium
578
577
  @appium_server_version = appium_server_version
579
578
 
580
579
  check_server_version_xcuitest
580
+ set_automation_name_if_nil
581
581
 
582
582
  @driver.manage.timeouts.implicit_wait = @default_wait
583
583
 
584
584
  @driver
585
585
  end
586
586
 
587
- # Set implicit wait and default_wait to zero.
587
+ # Set implicit wait to zero.
588
588
  def no_wait
589
- @last_waits = [@default_wait, 0]
590
- @default_wait = 0
591
589
  @driver.manage.timeouts.implicit_wait = 0
592
590
  end
593
591
 
594
- # Set implicit wait and default_wait to timeout, defaults to 30.
595
- # if set_wait is called without a param then the second to last
596
- # wait will be used.
592
+ # Set implicit wait. Default to @default_wait.
597
593
  #
598
594
  # ```ruby`
599
595
  # set_wait 2
600
- # set_wait 3
601
- # set_wait # 2
596
+ # set_wait # @default_wait
602
597
  #
603
598
  # ````
604
599
  #
605
600
  # @param timeout [Integer] the timeout in seconds
606
601
  # @return [void]
607
602
  def set_wait(timeout = nil)
608
- if timeout.nil?
609
- # Appium::Logger.info "timeout = @default_wait = @last_wait"
610
- # Appium::Logger.info "timeout = @default_wait = #{@last_waits}"
611
- timeout = @default_wait = @last_waits.first
612
- else
613
- @default_wait = timeout
614
- # Appium::Logger.info "last waits before: #{@last_waits}"
615
- @last_waits = [@last_waits.last, @default_wait]
616
- # Appium::Logger.info "last waits after: #{@last_waits}"
617
- end
618
-
603
+ timeout = @default_wait if timeout.nil?
619
604
  @driver.manage.timeouts.implicit_wait = timeout
620
605
  end
621
606
 
@@ -698,6 +683,15 @@ module Appium
698
683
  driver_quit
699
684
  exit # exit pry
700
685
  end
686
+
687
+ private
688
+
689
+ # If "automationName" is set only server side, this method set "automationName" attribute into @automation_name.
690
+ # Since @automation_name is set only client side before start_driver is called.
691
+ def set_automation_name_if_nil
692
+ return unless @automation_name.nil?
693
+ @automation_name = @driver.capabilities['automationName']
694
+ end
701
695
  end # class Driver
702
696
  end # module Appium
703
697
 
@@ -7,6 +7,15 @@ module Appium
7
7
  # ```ruby
8
8
  # find_elements :uiautomation, 'elements()
9
9
  # ```
10
+ #
11
+ # @!method ios_predicate_string_find
12
+ # find_element/s can be used with a [Predicates](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html)
13
+ #
14
+ # ```ruby
15
+ # find_elements :predicate, "isWDVisible == 1"
16
+ # find_elements :predicate, 'wdName == "Buttons"'
17
+ # find_elements :predicate, 'wdValue == "SearchBar" AND isWDDivisible == 1'
18
+ # ```
10
19
  def extended(_mod)
11
20
  ::Appium::Driver::SearchContext::FINDERS[:uiautomation] = '-ios uiautomation'
12
21
  ::Appium::Driver::SearchContext::FINDERS[:predicate] = '-ios predicate string'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.3
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -206,6 +206,7 @@ files:
206
206
  - ".gitignore"
207
207
  - ".rubocop.yml"
208
208
  - ".travis.yml"
209
+ - CHANGELOG.md
209
210
  - Gemfile
210
211
  - LICENSE-2.0.txt
211
212
  - Rakefile