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 +8 -8
- data/lib/appium_lib/android/helper.rb +63 -1
- data/lib/appium_lib/common/helper.rb +5 -0
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/driver.rb +12 -5
- data/lib/appium_lib/ios/element/textfield.rb +0 -4
- data/release_notes.md +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTZiYzE1YTUyN2Y0Nzg0YjZhZjhiOWJlYzlmYWZlY2UwMGE2MzlhZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWYxYTgxZTNjZWQ4YzQ3ZmY1ODA4OTY1YjMxMzQ0ZjI4MmU5NjdhZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTMyZjliODBmNDk2MjZmNGY3MGU5NGVkODRjYTAwNzMwMzZmZWZiMTc4ZmFj
|
10
|
+
ZGY4YzA3YmU4MzZlN2ViZWY3OGM3NGM2NmM0NWEwMGQ1Yjc0MzYxNGU2OWU4
|
11
|
+
ZWU1YjJjYjlkYmRlZmMyMWIwZTliMWVhZTUwMDQzMzg3NTM2Njc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
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
|
@@ -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.
|
5
|
-
DATE = '2013-05-
|
4
|
+
VERSION = '0.3.8' unless defined? ::Appium::VERSION
|
5
|
+
DATE = '2013-05-06' unless defined? ::Appium::DATE
|
6
6
|
end
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -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
|
-
|
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.
|
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
|
-
|
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
|
data/release_notes.md
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|