appium_lib 2.1.0 → 3.0.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.
@@ -94,7 +94,7 @@ def patch_webdriver_bridge
94
94
  # For complex_find, we pass a whole array
95
95
  if command_hash.kind_of? Array
96
96
  print_command[:args] = [command_hash.clone]
97
- print_command[:script] = 'mobile: find' if command == :complex_find
97
+ print_command[:script] = 'complex_find' if command == :complex_find
98
98
  else
99
99
  print_command = command_hash.clone
100
100
  end
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '2.1.0' unless defined? ::Appium::VERSION
4
- DATE = '2014-05-21' unless defined? ::Appium::DATE
3
+ VERSION = '3.0.0' unless defined? ::Appium::VERSION
4
+ DATE = '2014-05-30' unless defined? ::Appium::DATE
5
5
  end
@@ -163,18 +163,25 @@ module Appium
163
163
 
164
164
  add_endpoint_method(:complex_find, 'session/:session_id/appium/app/complex_find') do
165
165
  def complex_find(opts)
166
- mode = opts.fetch :mode, false
166
+ # allow: complex_find([[[3, 'app']]])
167
+ opts = { selectors: opts } if opts.is_a?(Array)
168
+ mode = opts.fetch :mode, false # mode can be 'all' or 'scroll'
167
169
  selectors = opts.fetch :selectors, false
168
170
  raise 'Complex find must have selectors' unless selectors
169
- selectors.insert(0, mode) if mode
171
+ selectors = selectors.dup.insert(0, mode) if mode # must dupe before insert
170
172
 
171
173
  ids = execute :complex_find, {}, selectors
174
+ ids = [ids] unless ids.is_a? Array # wrap single result in an array
172
175
 
173
- if mode == 'all' && ids.length > 1
174
- return ids.map { |id| Selenium::WebDriver::Element.new self, element_id_from(id) }
175
- else
176
- return Selenium::WebDriver::Element.new self, element_id_from(ids)
176
+ # mode can be set directly in the selectors
177
+ find_all = mode == 'all' || selectors.first == 'all'
178
+
179
+ result = ids.map do |id|
180
+ resolved_id = element_id_from(id)
181
+ Selenium::WebDriver::Element.new self, resolved_id
177
182
  end
183
+ # when not finding all, don't return an array
184
+ return find_all ? result : result.first
178
185
  end
179
186
  end
180
187
 
data/release_notes.md CHANGED
@@ -1,3 +1,12 @@
1
+ #### v3.0.0 2014-05-30
2
+
3
+ - [77d64af](https://github.com/appium/ruby_lib/commit/77d64af57b0e6a828c5d61008c444518e6597e4b) Release 3.0.0
4
+ - [86f1655](https://github.com/appium/ruby_lib/commit/86f1655d51ee74ec32e720ff285c30175283d4fd) Rename mobile find to complex_find
5
+ - [109139b](https://github.com/appium/ruby_lib/commit/109139bd6ff664e020609a5828ab755c9f6dbf2e) Merge pull request #207 from appium/no_xpath
6
+ - [682797d](https://github.com/appium/ruby_lib/commit/682797d252a040ffcc225a43491842c3e0d6e2ad) Use uiselector instead of xpath
7
+ - [0c51bca](https://github.com/appium/ruby_lib/commit/0c51bcab548826d125b9f90418079fc8af72071a) Update complex find constants
8
+
9
+
1
10
  #### v2.1.0 2014-05-21
2
11
 
3
12
  - [f0db091](https://github.com/appium/ruby_lib/commit/f0db0910ea077e04329d3e0cafb434f829760abb) Release 2.1.0
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: 2.1.0
4
+ version: 3.0.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: 2014-05-21 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver