appium_lib 0.12.0 → 0.13.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.
@@ -91,15 +91,38 @@ the first element that matches.
91
91
  mobile :find, [ [ [7, name] ] ]
92
92
  end
93
93
 
94
+ # Return the first element exactly matching name.
95
+ # on Android name is content description
96
+ # on iOS name is the accessibility label or the text.
97
+ # @param name [String] the name to search for
98
+ # @return [Element] the first matching element
99
+ def name_exact name
100
+ # exact description
101
+ result = mobile :find, [ [ [5, name] ] ]
102
+
103
+ return result if result.kind_of? Selenium::WebDriver::Element
104
+
105
+ if result.length > 0
106
+ result.first
107
+ else
108
+ Appium::Common.raise_no_element_error
109
+ end
110
+ end
111
+
94
112
  # Return all elements matching name.
95
113
  # on Android name is content description
96
114
  # on iOS name is the accessibility label or the text.
97
115
  # @param name [String] the name to search for
98
116
  # @return [Array<Element>] all matching elements
99
- def names name
100
- args = 'all',
101
- [ [7, name] ]
102
- mobile :find, args
117
+ def names name=''
118
+ if name.nil? || name.empty?
119
+ args = 'all', [ [7, ''], [100] ]
120
+ mobile :find, args
121
+ else
122
+ args = 'all',
123
+ [ [7, name] ]
124
+ mobile :find, args
125
+ end
103
126
  end
104
127
 
105
128
  # Scroll to an element containing target text or description.
@@ -114,4 +137,17 @@ the first element that matches.
114
137
 
115
138
  mobile :find, args
116
139
  end
140
+
141
+ # Scroll to an element with the exact target text or description.
142
+ # @param text [String] the text to search for in the text value and content description
143
+ # @return [Element] the element scrolled to
144
+ def scroll_to_exact text
145
+ args = 'scroll',
146
+ # text(text)
147
+ [ [1, text] ],
148
+ # description(text)
149
+ [ [5, text] ]
150
+
151
+ mobile :find, args
152
+ end
117
153
  end # module Appium::Android
@@ -227,6 +227,14 @@ module Appium::Common
227
227
  find_element :tag_name, tag_name
228
228
  end
229
229
 
230
+ # Returns all elements matching tag_name
231
+ #
232
+ # @param tag_name [String] the tag_name to search for
233
+ # @return [Element]
234
+ def tags tag_name
235
+ find_elements :tag_name, tag_name
236
+ end
237
+
230
238
  # Converts pixel values to window relative values
231
239
  #
232
240
  # ```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.12.0' unless defined? ::Appium::VERSION
5
- DATE = '2013-11-07' unless defined? ::Appium::DATE
4
+ VERSION = '0.13.0' unless defined? ::Appium::VERSION
5
+ DATE = '2013-11-22' unless defined? ::Appium::DATE
6
6
  end
@@ -375,7 +375,8 @@ module Appium
375
375
  name: @app_name || 'Ruby Console Android Appium',
376
376
  :'app-package' => @app_package,
377
377
  :'app-activity' => @app_activity,
378
- :'app-wait-activity' => @app_wait_activity || @app_activity
378
+ :'app-wait-activity' => @app_wait_activity || @app_activity,
379
+ fastClear: false # use adb uninstall/pm install not pm clear
379
380
  }
380
381
  end
381
382
 
@@ -118,6 +118,19 @@ module Appium::Ios
118
118
  mobile :findElementNameContains, name: name
119
119
  end
120
120
 
121
+ def name_exact name
122
+ js = all_ele_js "name == '#{name}'"
123
+ result = execute_script js
124
+
125
+ return result if result.kind_of? Selenium::WebDriver::Element
126
+
127
+ if result.length > 0
128
+ result.first
129
+ else
130
+ Appium::Common.raise_no_element_error
131
+ end
132
+ end
133
+
121
134
  # Return all elements matching name.
122
135
  # on Android name is content description
123
136
  # on iOS name is the accessibility label or the text.
@@ -64,4 +64,14 @@ module Appium::Ios
64
64
  def textfield_exact text
65
65
  xpath "textfield[@text='#{text}']"
66
66
  end
67
+
68
+ # Get the first textfield that exactly matches name
69
+ # @return [Element]
70
+ def textfield_named target_name
71
+ wait do
72
+ target = e_textfields.detect { |e| e.name == target_name }
73
+ raise "Textfield named #{target_name} not found" unless target
74
+ target
75
+ end
76
+ end
67
77
  end # module Appium::Ios
@@ -47,7 +47,7 @@ module Appium::Ios
47
47
  # Password character returned from value of UIASecureTextField
48
48
  # @param length [Integer] the length of the password to generate
49
49
  # @return [String] the returned string is of size length
50
- def password length=1
50
+ def ios_password length=1
51
51
  '•' * length
52
52
  end
53
53
 
@@ -192,4 +192,11 @@ module Appium::Ios
192
192
  raise "Invalid id `#{id}`" unless @strings_xml[id]
193
193
  find_element :id, id
194
194
  end
195
+
196
+ # Return the iOS version as an array of integers
197
+ # @return [Array<Integer>]
198
+ def ios_version
199
+ ios_version = execute_script 'UIATarget.localTarget().systemVersion()'
200
+ ios_version.split('.').map { |e| e.to_i }
201
+ end
195
202
  end # module Appium::Ios
@@ -1,3 +1,27 @@
1
+ #### v0.13.0 2013-11-22
2
+
3
+ - [647cb94](https://github.com/appium/ruby_lib/commit/647cb942f344c635e067f2ae563f4fae12685148) Release 0.13.0
4
+ - [a235a2c](https://github.com/appium/ruby_lib/commit/a235a2c70d2c7dc1934c9fb403fb95cc3ae56e04) Update name_exact
5
+ - [f1d2701](https://github.com/appium/ruby_lib/commit/f1d270120ae248beb6746a0149ebcbe4e34ebcca) names on Android will return the text values when no arg is passed
6
+ - [7ac38c9](https://github.com/appium/ruby_lib/commit/7ac38c97b99178f6ae0bf8f7b5474a0cd3379e87) Fix return value of name_exact
7
+ - [e6da4aa](https://github.com/appium/ruby_lib/commit/e6da4aa4937bfdc6f094f7895ecf172f8b96f32a) Add textfield_named for iOS
8
+ - [789fc52](https://github.com/appium/ruby_lib/commit/789fc5276ad000dafd5a400f3d9aa8cfcd37e17d) Add ios_version method
9
+ - [5447f4c](https://github.com/appium/ruby_lib/commit/5447f4cf3645459ddb4335b4a242b7639fc860f8) Rename password to ios_password
10
+ - [a5b85de](https://github.com/appium/ruby_lib/commit/a5b85de11e413e301f94d41689658b01342bb1c8) Add scroll_to_exact for Android & more
11
+ - [cc7e778](https://github.com/appium/ruby_lib/commit/cc7e778fd1532e5e15ea9933a300189ce8dc9e8a) Default to fastClear: false
12
+ - [f54f145](https://github.com/appium/ruby_lib/commit/f54f14551e04517c71d9177fc0bd72797cd77781) Add link to minitest expectations
13
+
14
+
15
+ #### v0.12.0 2013-11-07
16
+
17
+ - [c92bd37](https://github.com/appium/ruby_lib/commit/c92bd3710be09731aa8ba4547a3e19af9eeaceab) Release 0.12.0
18
+ - [f1b7633](https://github.com/appium/ruby_lib/commit/f1b7633e5dcfcd6d0d21f003ce0d98de1d093a13) Add s_texts_names. Fix alert_dismiss_text and alert_accept_text for iOS 7
19
+ - [6f2d698](https://github.com/appium/ruby_lib/commit/6f2d6981b1f12443c4079dba455b16d1f331f903) Fix page on iOS 7
20
+ - [70dbac3](https://github.com/appium/ruby_lib/commit/70dbac321688dfbec1d5f0a8efe6a7282678b88b) set_wait and no_wait now update @default_wait
21
+ - [1f31754](https://github.com/appium/ruby_lib/commit/1f31754386dfd282e1143e3386ba18b1c656bb9d) Restore readme
22
+ - [1e7a4c3](https://github.com/appium/ruby_lib/commit/1e7a4c36d1ea0df0ed87a2decbf8793406673774) Update Android page to always output resource-ids
23
+
24
+
1
25
  #### v0.11.1 2013-09-24
2
26
 
3
27
  - [0551d9a](https://github.com/appium/ruby_lib/commit/0551d9a4de2cb3d62efe63a87b01c15526202336) Release 0.11.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.12.0
4
+ version: 0.13.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-11-07 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.1.9
141
+ rubygems_version: 2.1.11
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Ruby library for Appium