appium_lib 0.9.1 → 0.10.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.
@@ -403,13 +403,12 @@ module Appium::Android
403
403
  # JavaScript code from https://github.com/appium/appium/blob/master/app/android.js
404
404
  #
405
405
  # ```javascript
406
- # Math.round((duration * 1000) / 200)
407
- # (.20 * 1000) / 200 = 1
406
+ # Math.round(1.0/28.0 * 28) = 1
408
407
  # ```
409
408
  #
410
409
  # We want steps to be exactly 1. If it's zero then a tap is used instead of a swipe.
411
410
  def fast_duration
412
- 0.20
411
+ 0.0357 # 1.0/28.0
413
412
  end
414
413
 
415
414
  # Lists package, activity, and adb shell am start -n value for current app.
@@ -223,8 +223,8 @@ module Appium::Common
223
223
  x = opts.fetch :x, 0
224
224
  y = opts.fetch :y, 0
225
225
 
226
- OpenStruct.new( x: x.to_f / w.width.to_f,
227
- y: y.to_f / w.height.to_f )
226
+ OpenStruct.new( x: "#{x.to_f} / #{w.width.to_f}",
227
+ y: "#{y.to_f} / #{w.height.to_f}" )
228
228
  end
229
229
 
230
230
  def lazy_load_strings
@@ -58,8 +58,8 @@ module Appium::Common
58
58
  def location_rel
59
59
  xy = self.location
60
60
  w = $driver.window_size
61
- OpenStruct.new( x: xy.x.to_f / w.width.to_f,
62
- y: xy.y.to_f / w.height.to_f )
61
+ OpenStruct.new( x: "#{xy.x.to_f} / #{w.width.to_f}",
62
+ y: "#{xy.y.to_f} / #{w.height.to_f}" )
63
63
  end
64
64
  end
65
65
  end # module Appium::Common
@@ -103,7 +103,7 @@ def patch_webdriver_bridge
103
103
  path_str = path
104
104
  path_str = '/' + path_str unless path_str.nil? ||
105
105
  path_str.length <= 0 || path_str[0] == '/'
106
- path_match = path.match /.*\h{8}-\h{4}-\h{4}-\h{4}-\h{12}/
106
+ path_match = path.match /.*\h{8}-?\h{4}-?\h{4}-?\h{4}-?\h{12}/
107
107
  path_str = path.sub(path_match[0], '') unless path_match.nil?
108
108
 
109
109
  puts "#{verb} #{path_str}"
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Appium
3
3
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
4
- VERSION = '0.9.1' unless defined? ::Appium::VERSION
5
- DATE = '2013-09-19' unless defined? ::Appium::DATE
4
+ VERSION = '0.10.0' unless defined? ::Appium::VERSION
5
+ DATE = '2013-09-20' unless defined? ::Appium::DATE
6
6
  end
@@ -151,6 +151,25 @@ module Appium
151
151
  require 'android/element/generic'
152
152
  require 'android/element/textfield'
153
153
 
154
+ def self.promote_singleton_appium_methods main_module
155
+ raise 'Driver is nil' if $driver.nil?
156
+ main_module.constants.each do |sub_module|
157
+ #noinspection RubyResolve
158
+ $driver.public_methods(false).each do |m|
159
+ const = Woven.const_get(sub_module)
160
+ const.send(:define_singleton_method, m) do |*args, &block|
161
+ begin
162
+ super(*args, &block) # promote.rb
163
+ rescue NoMethodError, ArgumentError
164
+ $driver.send m, *args, &block if $driver.respond_to?(m)
165
+ end
166
+ # override unless there's an existing method with matching arity
167
+ end unless const.respond_to?(m) &&
168
+ const.method(m).arity == $driver.method(m).arity
169
+ end
170
+ end
171
+ end
172
+
154
173
  ##
155
174
  # Promote appium methods to class instance methods
156
175
  #
@@ -151,8 +151,8 @@ module Appium::Ios
151
151
 
152
152
  # Prints a string of interesting elements to the console.
153
153
  # @return [void]
154
- def page
155
- get_page
154
+ def page window_number = 0
155
+ get_page source_window window_number || 0
156
156
  nil
157
157
  end
158
158
 
data/release_notes.md CHANGED
@@ -1,3 +1,10 @@
1
+ #### v0.9.1 2013-09-19
2
+
3
+ - [cd9fc63](https://github.com/appium/ruby_lib/commit/cd9fc636c5fc1071ad95ea08a7ab5c077737e6a7) Release 0.9.1
4
+ - [c5c2b83](https://github.com/appium/ruby_lib/commit/c5c2b832c5f535eacb657b4cfc5cb5d89e0ad8ee) XPath index starts at 1 for textfield
5
+ - [511f76e](https://github.com/appium/ruby_lib/commit/511f76ea711516e5b2a95918343b8e903d17dc1a) Fix server_version path debug output
6
+
7
+
1
8
  #### v0.9.0 2013-09-19
2
9
 
3
10
  - [28f2161](https://github.com/appium/ruby_lib/commit/28f21615a435364246725e8f9adac62c0257dffa) Release 0.9.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: 0.9.1
4
+ version: 0.10.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: 2013-09-19 00:00:00.000000000 Z
11
+ date: 2013-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver