appium_lib 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTA4NWY0MDU1NzNmY2ZjMjQ1NjM3MjNhYzJlNjgxMmMzYzlmZWMxNA==
4
+ OTZiYzE1YTUyN2Y0Nzg0YjZhZjhiOWJlYzlmYWZlY2UwMGE2MzlhZQ==
5
5
  data.tar.gz: !binary |-
6
- ODlmYTM1YWJjMmU2MTQxYmFiOTRkOWE3MGI0MDExY2ZhZmFiOWIwOA==
6
+ OWYxYTgxZTNjZWQ4YzQ3ZmY1ODA4OTY1YjMxMzQ0ZjI4MmU5NjdhZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmQyMGE4Y2FiZDA4YmNiMWI2YzYyZGUzNGFhNWI5NWFhMTZkMGY4ZjI4MzBh
10
- MjMzMjk2NjRjMzRjMjhkYzBlZjk1N2E5Zjc5N2E0ZTNjZmE1YWQ0YjRjNGMw
11
- OGNkM2FjODJmMzY3MGE5MzcxM2NiN2E5OWYyOTMyNDlkMjZiM2Y=
9
+ MTMyZjliODBmNDk2MjZmNGY3MGU5NGVkODRjYTAwNzMwMzZmZWZiMTc4ZmFj
10
+ ZGY4YzA3YmU4MzZlN2ViZWY3OGM3NGM2NmM0NWEwMGQ1Yjc0MzYxNGU2OWU4
11
+ ZWU1YjJjYjlkYmRlZmMyMWIwZTliMWVhZTUwMDQzMzg3NTM2Njc=
12
12
  data.tar.gz: !binary |-
13
- OGM0MGJhMzQxMDA5YjU3Zjc0N2I3ZGY1ODE0YThjZmU5NjA5MzY4NWE2OGJh
14
- ZTUyN2VhYjFkODdlNGNmOTBhOTYzZDdlMWIxNGFjNjZlNGUzN2ZhMTQ4MGEz
15
- YjM0OWJkOWYzYWIyOGFiYjQ3YjE2N2NhNGU0ZDE4YjA5YmU0ZTg=
13
+ NDAzZTJjZDRmOWIwZmIzOGRlMjgzNThmODViYTgzYWQwZWY1N2VlYWVkOTdh
14
+ ZmI1YTNjYmNlYjdlODI3YzA2ODE1MzI0NTc4OGI4MTFjM2FhZWFmNjQ4MzE3
15
+ NTJiMjU5ZTFjMTZlM2ZjYzNkNzQzNmMyNWQzZmE2YzFjNzJlZTQ=
@@ -54,9 +54,67 @@ module Appium::Android
54
54
  mobile :find, array
55
55
  end
56
56
 
57
+ def get_selendroid_inspect
58
+ def run node
59
+ r = []
60
+
61
+ run_internal = lambda do |node|
62
+ if node.kind_of? Array
63
+ node.each { |node| run_internal.call node }
64
+ return
65
+ end
66
+
67
+ keys = node.keys
68
+ return if keys.empty?
69
+
70
+ obj = {}
71
+ # name is id
72
+ obj.merge!( { id: node['name'] } ) if keys.include?('name') && !node['name'].empty?
73
+ obj.merge!( { text: node['value'] } ) if keys.include?('value') && !node['value'].empty?
74
+ # label is name
75
+ obj.merge!( { name: node['label'] } ) if keys.include?('label') && !node['label'].empty?
76
+ obj.merge!( { class: node['type'] } ) if keys.include?('type') && !obj.empty?
77
+
78
+ r.push obj if !obj.empty?
79
+ run_internal.call node['children'] if keys.include?('children')
80
+ end
81
+
82
+ run_internal.call node
83
+ r
84
+ end
85
+
86
+ json = get_source
87
+ node = json['children']
88
+ results = run node
89
+
90
+ out = ''
91
+ results.each { |e|
92
+ no_text = e[:text].nil?
93
+ no_name = e[:name].nil? || e[:name] == 'null'
94
+
95
+ # Ignore elements with id only.
96
+ next if no_text && no_name
97
+
98
+ out += e[:class].split('.').last + "\n"
99
+
100
+ # name is id when using selendroid.
101
+ # remove id/ prefix
102
+ e[:id].sub!(/^id\//, '') if e[:id]
103
+
104
+ out += " class: #{e[:class]}\n"
105
+ # id('back_button').click
106
+ out += " id: #{e[:id]}\n" unless e[:id].nil?
107
+ # find_element(:link_text, 'text')
108
+ out += " text: #{e[:text]}\n" unless no_text
109
+ # label is name. default is 'null'
110
+ # find_element(:link_text, 'Facebook')
111
+ out += " name: #{e[:name]}\n" unless no_name
112
+ }
113
+ out
114
+ end
57
115
 
58
116
  # Android only.
59
- def get_inspect
117
+ def get_android_inspect
60
118
  def run node
61
119
  r = []
62
120
 
@@ -101,6 +159,10 @@ module Appium::Android
101
159
  out
102
160
  end
103
161
 
162
+ def get_inspect
163
+ @selendroid ? get_selendroid_inspect : get_android_inspect
164
+ end
165
+
104
166
  # Android only. Intended for use with console.
105
167
  # Inspects and prints the current page.
106
168
  def page
@@ -57,6 +57,11 @@ module Appium::Common
57
57
  result
58
58
  end
59
59
 
60
+ # Find by id. Useful for selendroid
61
+ def id id
62
+ find_element :id, id
63
+ end
64
+
60
65
  # Presses the back button on Android.
61
66
  # @return [void]
62
67
  def back
@@ -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.3.7' unless defined? ::Appium::VERSION
5
- DATE = '2013-05-01' unless defined? ::Appium::DATE
4
+ VERSION = '0.3.8' unless defined? ::Appium::VERSION
5
+ DATE = '2013-05-06' unless defined? ::Appium::DATE
6
6
  end
@@ -36,7 +36,7 @@ module Appium
36
36
 
37
37
  attr_reader :app_path, :app_name, :app_package, :app_activity,
38
38
  :app_wait_activity, :sauce_username, :sauce_access_key,
39
- :port, :os, :ios_js
39
+ :port, :os, :ios_js, :debug
40
40
  def initialize options={}
41
41
  # quit last driver
42
42
  $driver.driver_quit if $driver
@@ -76,7 +76,6 @@ module Appium
76
76
 
77
77
  @os = :ios
78
78
  @os = :android if @app_path.end_with?('.apk') || @app_path.end_with?('.apk.zip')
79
- puts "OS is: #{@os}" if defined?(Pry)
80
79
 
81
80
  # load common methods
82
81
  extend Appium::Common
@@ -95,7 +94,12 @@ module Appium
95
94
  patch_webdriver_element
96
95
 
97
96
  # enable debug patch
98
- patch_webdriver_bridge if opts.fetch :debug, defined?(Pry)
97
+ @debug = opts.fetch :debug, defined?(Pry)
98
+
99
+ if @debug
100
+ puts "OS is: #{@os}"
101
+ patch_webdriver_bridge
102
+ end
99
103
 
100
104
  # Save global reference to last created Appium driver for top level methods.
101
105
  $driver = self
@@ -121,7 +125,7 @@ module Appium
121
125
  {
122
126
  browserName: 'Android',
123
127
  platform: 'LINUX',
124
- version: '4.1',
128
+ version: '4.2',
125
129
  device: @selendroid || 'Android',
126
130
  name: @app_name || 'Ruby Console Android Appium',
127
131
  app: absolute_app_path,
@@ -203,13 +207,16 @@ module Appium
203
207
 
204
208
  begin
205
209
  @driver = Selenium::WebDriver.for :remote, http_client: @client, desired_capabilities: capabilities, url: server_url
210
+ # Load touch methods. Required for Selendroid.
211
+ @driver.extend Selenium::WebDriver::DriverExtensions::HasTouchScreen
206
212
  rescue Errno::ECONNREFUSED
207
213
  raise 'ERROR: Unable to connect to Appium. Is the server running?'
208
214
  end
209
215
 
210
216
  # Set timeout to a large number so that Appium doesn't quit
211
217
  # when no commands are entered after 60 seconds.
212
- mobile :setCommandTimeout, timeout: 9999
218
+ # broken on selendroid: https://github.com/appium/appium/issues/513
219
+ mobile :setCommandTimeout, timeout: 9999 unless @selendroid
213
220
 
214
221
  # Set implicit wait by default unless we're using Pry.
215
222
  @driver.manage.timeouts.implicit_wait = @default_wait unless defined? Pry
@@ -55,8 +55,6 @@ module Appium::Ios
55
55
  t.concat(s)[0];
56
56
  )
57
57
 
58
- puts js if defined? Pry
59
-
60
58
  execute_script js
61
59
  end
62
60
 
@@ -71,8 +69,6 @@ module Appium::Ios
71
69
  t.concat(s)[0];
72
70
  )
73
71
 
74
- puts js if defined? Pry
75
-
76
72
  execute_script js
77
73
  end
78
74
 
@@ -1,3 +1,10 @@
1
+ #### v0.3.7 2013-05-01
2
+
3
+ - [edfd20a](https://github.com/appium/ruby_lib/commit/edfd20a6ffdef8484b9f7b5eddb9c21815241d42) Release 0.3.7
4
+ - [9f8511c](https://github.com/appium/ruby_lib/commit/9f8511c1416867df606dfb3d058f83ee277ce39a) Remove puts
5
+ - [366da1f](https://github.com/appium/ruby_lib/commit/366da1f6e3c0621d55920bce244fc5aedd678e7d) Update release notes
6
+
7
+
1
8
  #### v0.3.6 2013-05-01
2
9
 
3
10
  - [67e5c86](https://github.com/appium/ruby_lib/commit/67e5c867d38251687dc7ebd5de013db5712fcac3) Release 0.3.6
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.3.7
4
+ version: 0.3.8
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-05-01 00:00:00.000000000 Z
11
+ date: 2013-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver