appium_lib 0.5.12 → 0.5.13

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.
@@ -8,21 +8,23 @@ def self.method_missing method, *args, &block
8
8
  raise "driver is nil. called #{method}" if $driver == nil
9
9
 
10
10
  if $driver.respond_to?(method)
11
- # puts "[method_missing] Calling driver.send for #{method}"
12
- $driver.send( method, *args, &block )
11
+ # puts "[method_missing] Calling driver.send for #{method}"
12
+ $driver.send(method, *args, &block)
13
+ elsif self.respond_to?(method)
14
+ # puts "[method_missing] Calling super for #{method}"
15
+ super(*args, &block)
13
16
  else
14
- # puts "[method_missing] Calling super for #{method}"
15
- super(*args, &block )
16
- end
17
+ super
18
+ end
17
19
  end
18
20
 
19
21
  module Appium
20
22
  # @private
21
23
  def self.add_to_path file, path=false
22
- path = path ? "../#{path}/" : '..'
23
- path = File.expand_path path, file
24
+ path = path ? "../#{path}/" : '..'
25
+ path = File.expand_path path, file
24
26
 
25
- $:.unshift path unless $:.include? path
27
+ $:.unshift path unless $:.include? path
26
28
  end
27
29
 
28
30
  add_to_path __FILE__
@@ -216,4 +216,13 @@ module Appium::Common
216
216
  def tag tag_name
217
217
  find_element :tag_name, tag_name
218
218
  end
219
+
220
+ # Lists package, activity, and adb shell am start -n value for current app.
221
+ # Works on local host only (not remote).
222
+ def current_app
223
+ line = `adb shell dumpsys window windows`.each_line.grep(/mFocusedApp/).first
224
+ puts line
225
+ pair = line.split(' ').last.gsub('}','').split('/')
226
+ { package: pair.first, activity: pair.last, am_start: pair.first + '/' + pair.last }
227
+ end
219
228
  end # module Appium::Common
@@ -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.5.12' unless defined? ::Appium::VERSION
5
- DATE = '2013-06-18' unless defined? ::Appium::DATE
4
+ VERSION = '0.5.13' unless defined? ::Appium::VERSION
5
+ DATE = '2013-06-19' unless defined? ::Appium::DATE
6
6
  end
@@ -191,15 +191,14 @@ module Appium
191
191
  $driver.public_methods(false).each do | m |
192
192
  Object.class_eval do
193
193
  define_method m do | *args, &block |
194
- begin
195
- # puts "[Object.class_eval] Calling super for #{m}"
196
- # prefer existing method.
197
- # super will invoke method missing on driver
198
- super(*args, &block)
199
- rescue NoMethodError
200
- # puts '[Object.class_eval] NoMethodError'
201
- $driver.send m, *args, &block
202
- end
194
+ if defined?(super) # check if method is defined on super
195
+ # puts "[Object.class_eval] Calling super for #{m}"
196
+ # prefer existing method.
197
+ super(*args, &block)
198
+ else
199
+ # puts '[Object.class_eval] not on super, calling driver.'
200
+ $driver.send m, *args, &block
201
+ end
203
202
  end
204
203
  end
205
204
  end
data/readme.md CHANGED
@@ -76,14 +76,3 @@ Appium::Driver.new(apk).start_driver
76
76
  - [Overview](https://github.com/appium/ruby_lib/blob/master/docs/docs.md)
77
77
  - [Android methods](https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md)
78
78
  - [iOS methods](https://github.com/appium/ruby_lib/blob/master/docs/ios_docs.md)
79
-
80
- Print the currently active activity using Pry.
81
-
82
- ```ruby
83
- def current_app
84
- pair = `adb shell dumpsys window windows`.each_line.grep(/mFocusedApp/).first.split(' ').last.gsub('}','').split('/')
85
- { pkg: pair.first, act: pair.last }
86
- end
87
-
88
- current_app
89
- ```
@@ -1,3 +1,9 @@
1
+ #### v0.5.12 2013-06-18
2
+
3
+ - [89b0902](https://github.com/appium/ruby_lib/commit/89b0902ed94ed43d8a9f0e364463da77015dcfb7) Release 0.5.12
4
+ - [7c4e8d1](https://github.com/appium/ruby_lib/commit/7c4e8d16d909112cebd2a80f0d8140723efd644a) search_id, search_value replaced with xml_keys, xml_values
5
+
6
+
1
7
  #### v0.5.11 2013-06-18
2
8
 
3
9
  - [891e003](https://github.com/appium/ruby_lib/commit/891e003748038a006121c8a4e0c702c12c405799) Release 0.5.11
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  segments:
152
152
  - 0
153
- hash: 3561195948257176739
153
+ hash: -480854943086846232
154
154
  requirements: []
155
155
  rubyforge_project:
156
156
  rubygems_version: 1.8.25