appium_lib 0.18.2 → 0.19.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.
@@ -63,7 +63,7 @@ module Appium::Android::Webview
63
63
  raise 'Must provide package' unless package
64
64
  port = opts.fetch :port, 9000
65
65
 
66
- unix_socket = pid_to_webview package_to_pid 'com.litl.Woven'
66
+ unix_socket = pid_to_webview package_to_pid package
67
67
  raise 'No webview found' unless unix_socket
68
68
  adb_cmd "adb forward tcp:#{port} localabstract:#{unix_socket}"
69
69
  end
@@ -102,4 +102,4 @@ module Appium::Android::Webview
102
102
  OpenStruct.new( client: client, location: document_location )
103
103
  end
104
104
  end
105
- end
105
+ end
@@ -40,13 +40,6 @@ module Appium::Common
40
40
  self.attribute :name
41
41
  end
42
42
 
43
- # Returns the type attribute
44
- #
45
- # Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
46
- def tag_name
47
- self.attribute :type
48
- end
49
-
50
43
  # For use with mobile tap.
51
44
  #
52
45
  # ```ruby
@@ -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.18.2' unless defined? ::Appium::VERSION
5
- DATE = '2014-01-28' unless defined? ::Appium::DATE
4
+ VERSION = '0.19.0' unless defined? ::Appium::VERSION
5
+ DATE = '2014-02-20' unless defined? ::Appium::DATE
6
6
  end
@@ -68,10 +68,6 @@ def load_appium_txt opts
68
68
  'APP_ACTIVITY', 'APP_WAIT_ACTIVITY',
69
69
  'DEVICE'
70
70
 
71
- # Ensure app path is absolute
72
- ENV['APP_PATH'] = File.expand_path ENV['APP_PATH'] if ENV['APP_PATH'] &&
73
- !ENV['APP_PATH'].empty?
74
-
75
71
  # device is not case sensitive
76
72
  ENV['DEVICE'] = ENV['DEVICE'].strip.downcase if !ENV['DEVICE'].nil?
77
73
  if ! %w(ios android selendroid).include? ENV['DEVICE']
@@ -429,7 +425,7 @@ module Appium
429
425
  # Sauce storage API. http://saucelabs.com/docs/rest#storage
430
426
  return @app_path if @app_path.start_with? 'sauce-storage:'
431
427
  return @app_path if @app_path.match(/^http/) # public URL for Sauce
432
- if @app_path.match(/^\//) # absolute file path
428
+ if @app_path.match(/^(\/|[a-zA-Z]:)/) # absolute file path
433
429
  raise "App doesn't exist. #{@app_path}" unless File.exist? @app_path
434
430
  return @app_path
435
431
  end
@@ -59,6 +59,7 @@ module Appium::Ios
59
59
  # @param text [String] the text to search for
60
60
  # @return [Element] the first matching element
61
61
  def find text
62
+ text = escape_single_quote text
62
63
  ele = nil
63
64
  # prefer value search. this may error with:
64
65
  # Can't use in/contains operator with collection 1
@@ -81,6 +82,7 @@ module Appium::Ios
81
82
  # @param text [String] the text to search for
82
83
  # @return [Array<Element>] all matching elements
83
84
  def finds text
85
+ text = escape_single_quote text
84
86
  eles = []
85
87
  # value contains may error
86
88
  js = all_ele_js "value contains[c] '#{text}'"
@@ -95,6 +97,7 @@ module Appium::Ios
95
97
  # @param text [String] the text to search for
96
98
  # @return [Element] the first matching element
97
99
  def text text
100
+ text = escape_single_quote text
98
101
  js = first_ele_js "value contains[c] '#{text}'"
99
102
  execute_script js
100
103
  end
@@ -103,6 +106,7 @@ module Appium::Ios
103
106
  # @param text [String] the text to search for
104
107
  # @return [Array<Element>] all matching elements
105
108
  def texts text
109
+ text = escape_single_quote text
106
110
  # XPath //* is not implemented on iOS
107
111
  # https://github.com/appium/appium/issues/430
108
112
  js = all_ele_js "value contains[c] '#{text}'"
@@ -112,13 +116,24 @@ module Appium::Ios
112
116
  # Return the first element matching name.
113
117
  # on Android name is content description
114
118
  # on iOS name is the accessibility label or the text.
119
+ #
120
+ # ```ruby
121
+ # # find element with name or label containing example and access the name attribute.
122
+ # name('example').name
123
+ #
124
+ # # find element with name or label containing example and access the label attribute.
125
+ # name('example').label
126
+ # ```
127
+ #
115
128
  # @param name [String] the name to search for
116
129
  # @return [Element] the first matching element
117
130
  def name name
131
+ name = escape_single_quote name
118
132
  mobile :findElementNameContains, name: name
119
133
  end
120
134
 
121
135
  def name_exact name
136
+ name = escape_single_quote name
122
137
  js = all_ele_js "name == '#{name}'"
123
138
  result = execute_script js
124
139
 
@@ -137,9 +152,14 @@ module Appium::Ios
137
152
  # @param name [String] the name to search for
138
153
  # @return [Array<Element>] all matching elements
139
154
  def names name
155
+ name = escape_single_quote name
140
156
  # :name is not consistent across iOS and Android so use custom JavaScript
141
157
  # https://github.com/appium/appium/issues/379
142
158
  js = all_ele_js "name contains[c] '#{name}' || label contains[c] '#{name}'"
143
159
  execute_script js
144
160
  end
145
- end # module Appium::Ios
161
+
162
+ def escape_single_quote text_to_escape
163
+ text_to_escape.gsub("'", '\\' * 4 + "'")
164
+ end
165
+ end # module Appium::Ios
data/readme.md CHANGED
@@ -40,7 +40,7 @@ Appium::Driver.new(app).start_driver
40
40
 
41
41
  # Start Android driver
42
42
  apk = {
43
- device: :android
43
+ device: :android,
44
44
  app_path: '/path/to/the.apk',
45
45
  app_package: 'com.example.pkg',
46
46
  app_activity: '.act.Start',
@@ -56,7 +56,7 @@ Appium.promote_appium_methods Object
56
56
  # Example of automating Settings preinstalled app on Android
57
57
  # Find these values using arc then type current_app
58
58
  apk = {
59
- device: :android
59
+ device: :android,
60
60
  app_path: '',
61
61
  app_package: 'com.android.settings',
62
62
  app_activity: '.Settings',
data/release_notes.md CHANGED
@@ -1,3 +1,9 @@
1
+ #### v0.18.2 2014-01-28
2
+
3
+ - [f7a2e26](https://github.com/appium/ruby_lib/commit/f7a2e26b623404b83b2bbd9065aa7b57ab0fd62d) Release 0.18.2
4
+ - [b123321](https://github.com/appium/ruby_lib/commit/b12332186befb84b7ef6107a27db035ca2b65400) Check ENV['DEVICE'] when :device isn't set.
5
+
6
+
1
7
  #### v0.18.1 2014-01-28
2
8
 
3
9
  - [d98aafc](https://github.com/appium/ruby_lib/commit/d98aafc1571c49d97f104ce5d275cf758f27e421) Release 0.18.1
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.18.2
4
+ version: 0.19.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-01-28 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver