appium_lib 9.1.1 → 9.1.2

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.
@@ -1,3 +1,4 @@
1
+ # rake ios[common/element/window]
1
2
  describe 'common/element/window' do
2
3
  def before_first
3
4
  screen.must_equal catalog
@@ -7,6 +8,7 @@ describe 'common/element/window' do
7
8
  before_first
8
9
  end
9
10
 
11
+ # rubocop:disable Lint/UnifiedInteger
10
12
  t 'window_size' do
11
13
  size = window_size
12
14
  size.width.class.must_equal Fixnum
@@ -159,6 +159,12 @@ describe 'driver' do
159
159
  end
160
160
  end
161
161
 
162
+ t 'client_version' do
163
+ client_version = appium_client_version
164
+ expected = { version: ::Appium::VERSION }
165
+ client_version.must_equal expected
166
+ end
167
+
162
168
  t 'restart' do
163
169
  restart
164
170
  text 'buttons'
@@ -30,6 +30,8 @@ describe 'ios/element/generic' do
30
30
  end
31
31
 
32
32
  t 'finds_exact' do
33
- verify finds_exact uibutton_text
33
+ elements = finds_exact uibutton_text
34
+ elements.is_a?(Array).must_equal true
35
+ verify elements
34
36
  end
35
37
  end
@@ -83,8 +83,8 @@ describe 'ios/element/textfield' do
83
83
  end
84
84
  end
85
85
 
86
- def must_raise_no_element(&block)
87
- proc { block.call }.must_raise Selenium::WebDriver::Error::NoSuchElementError
86
+ def must_raise_no_element
87
+ proc { yield }.must_raise Selenium::WebDriver::Error::NoSuchElementError
88
88
  end
89
89
 
90
90
  t 'hide_keyboard' do
@@ -124,6 +124,22 @@ describe 'ios/element/textfield' do
124
124
  textfields_exact('does not exist').length.must_equal 0
125
125
  end
126
126
 
127
+ t 'set_immediate_value' do
128
+ go_to_textfields
129
+
130
+ message = 'hello'
131
+
132
+ element = textfield(1)
133
+ element.click
134
+ element.clear
135
+
136
+ set_immediate_value(element, message)
137
+ element.text.must_equal message
138
+
139
+ set_wait 10
140
+ leave_textfields
141
+ end
142
+
127
143
  t 'after_last' do
128
144
  after_last
129
145
  end
@@ -20,9 +20,9 @@ module Appium
20
20
  #
21
21
  # find_element :text doesn't work so use XPath to find by text.
22
22
 
23
- # Return block.call and ignore any exceptions.
24
- def ignore(&block)
25
- block.call
23
+ # Return yield and ignore any exceptions.
24
+ def ignore
25
+ yield
26
26
  rescue Exception # rubocop:disable Lint/HandleExceptions, Lint/RescueException
27
27
  end
28
28
 
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '9.1.1'.freeze unless defined? ::Appium::VERSION
4
- DATE = '2016-12-19'.freeze unless defined? ::Appium::DATE
3
+ VERSION = '9.1.2'.freeze unless defined? ::Appium::VERSION
4
+ DATE = '2016-12-25'.freeze unless defined? ::Appium::DATE
5
5
  end
@@ -6,7 +6,7 @@ module Appium
6
6
 
7
7
  # Wait code from the selenium Ruby gem
8
8
  # https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb
9
- def _generic_wait(opts = {}, &block)
9
+ def _generic_wait(opts = {})
10
10
  valid_keys = [:timeout, :interval, :message, :ignore, :return_if_true]
11
11
  invalid_keys = []
12
12
  opts.keys.each { |key| invalid_keys << key unless valid_keys.include?(key) }
@@ -24,9 +24,9 @@ module Appium
24
24
 
25
25
  until Time.now > end_time
26
26
  begin
27
- return block.call unless return_if_true
27
+ return yield unless return_if_true
28
28
 
29
- result = block.call
29
+ result = yield
30
30
  return result if result
31
31
  rescue ::Errno::ECONNREFUSED => e
32
32
  raise e
@@ -51,7 +51,7 @@ module Appium
51
51
  opts
52
52
  end
53
53
 
54
- # Check every interval seconds to see if block.call returns a truthy value.
54
+ # Check every interval seconds to see if yield returns a truthy value.
55
55
  # Note this isn't a strict boolean true, any truthy value is accepted.
56
56
  # false and nil are considered failures.
57
57
  # Give up after timeout seconds.
@@ -71,7 +71,7 @@ module Appium
71
71
  _generic_wait opts, &block
72
72
  end
73
73
 
74
- # Check every interval seconds to see if block.call doesn't raise an exception.
74
+ # Check every interval seconds to see if yield doesn't raise an exception.
75
75
  # Give up after timeout seconds.
76
76
  #
77
77
  # Wait code from the selenium Ruby gem
@@ -220,10 +220,18 @@ module Appium
220
220
  end
221
221
  end
222
222
 
223
- # TODO: TEST ME
223
+ # @!method set_immediate_value
224
+ # Set the value to element directly
225
+ # for iOS; setValue is called in XCUITest instead because XCUITest doesn't provide set value directly.
226
+ # https://github.com/appium/appium-xcuitest-driver/blob/793cdc7d5e84bd553e375076e1c6dc7e242c9cde/lib/commands/element.js#L123
227
+ #
228
+ # ```ruby
229
+ # set_immediate_value element, 'hello'
230
+ # ```
224
231
  add_endpoint_method(:set_immediate_value) do
225
- def set_immediate_value(element, value)
226
- execute :set_immediate_value, { id: element.ref }, value: value
232
+ def set_immediate_value(element, *value)
233
+ keys = ::Selenium::WebDriver::Keys.encode(value)
234
+ execute :set_immediate_value, { id: element.ref }, value: Array(keys)
227
235
  end
228
236
  end
229
237
 
@@ -147,13 +147,12 @@ module Appium
147
147
  if ele # pinch/zoom for XCUITest
148
148
  press x: start_x, y: start_y, element: ele
149
149
  move_to x: start_x + delta_x, y: start_y + delta_y, element: ele
150
- release
151
150
  else
152
151
  press x: start_x, y: start_y
153
152
  wait(duration) if duration
154
153
  move_to x: start_x + delta_x, y: start_y + delta_y
155
- release
156
154
  end
155
+ release
157
156
 
158
157
  self
159
158
  end
@@ -453,6 +453,19 @@ module Appium
453
453
  driver.remote_status
454
454
  end
455
455
 
456
+ # Returns the client's version info
457
+ #
458
+ # ```ruby
459
+ # {
460
+ # "version" => "9.1.1"
461
+ # }
462
+ # ```
463
+ #
464
+ # @return [Hash]
465
+ def appium_client_version
466
+ { version: ::Appium::VERSION }
467
+ end
468
+
456
469
  # Converts app_path to an absolute path.
457
470
  #
458
471
  # opts is the full options hash (caps and appium_lib). If server_url is set
@@ -616,7 +629,7 @@ module Appium
616
629
  # wait to after checking existance
617
630
  # @param search_block [Block] the block to call
618
631
  # @return [Boolean]
619
- def exists(pre_check = 0, post_check = @default_wait, &search_block)
632
+ def exists(pre_check = 0, post_check = @default_wait)
620
633
  # do not uset set_wait here.
621
634
  # it will cause problems with other methods reading the default_wait of 0
622
635
  # which then gets converted to a 1 second wait.
@@ -625,7 +638,7 @@ module Appium
625
638
  exists = true
626
639
 
627
640
  begin
628
- search_block.call # search for element
641
+ yield # search for element
629
642
  rescue
630
643
  exists = false # error means it's not there
631
644
  end
@@ -16,24 +16,21 @@ module Appium
16
16
  if name == label && name == value
17
17
  puts type.to_s if name || label || value || hint
18
18
  puts " name, label, value: #{name}" if name
19
- puts " hint: #{hint}" if hint
20
19
  elsif name == label
21
20
  puts type.to_s if name || label || value || hint
22
21
  puts " name, label: #{name}" if name
23
22
  puts " value: #{value}" if value
24
- puts " hint: #{hint}" if hint
25
23
  elsif name == value
26
24
  puts type.to_s if name || label || value || hint
27
25
  puts " name, value: #{name}" if name
28
26
  puts " label: #{label}" if label
29
- puts " hint: #{hint}" if hint
30
27
  else
31
28
  puts type.to_s if name || label || value || hint
32
29
  puts " name: #{name}" if name
33
30
  puts " label: #{label}" if label
34
31
  puts " value: #{value}" if value
35
- puts " hint: #{hint}" if hint
36
32
  end
33
+ puts " hint: #{hint}" if hint
37
34
  end
38
35
  end
39
36
  # iOS only. On Android uiautomator always returns an empty string for EditText password.
@@ -87,34 +84,11 @@ module Appium
87
84
  visible = fix_space element['visible']
88
85
  type = fix_space element['type']
89
86
 
90
- # TODO: Rubocop warning cleanup
91
- # rubocop:disable Metrics/BlockNesting
92
-
93
87
  # if class_name is set, mark non-matches as invisible
94
88
  visible = (type.downcase.include? class_namet).to_s if class_name
95
89
  if visible && visible == 'true'
96
- if name == label && name == value
97
- puts type.to_s if name || label || value || hint
98
- puts " name, label, value: #{name}" if name
99
- puts " hint: #{hint}" if hint
100
- elsif name == label
101
- puts type.to_s if name || label || value || hint
102
- puts " name, label: #{name}" if name
103
- puts " value: #{value}" if value
104
- puts " hint: #{hint}" if hint
105
- elsif name == value
106
- puts type.to_s if name || label || value || hint
107
- puts " name, value: #{name}" if name
108
- puts " label: #{label}" if label
109
- puts " hint: #{hint}" if hint
110
- else
111
- puts type.to_s if name || label || value || hint
112
- puts " name: #{name}" if name
113
- puts " label: #{label}" if label
114
- puts " value: #{value}" if value
115
- puts " hint: #{hint}" if hint
116
- end
117
- # rubocop:enable Metrics/BlockNesting
90
+
91
+ _print_attr(type, name, label, value, hint)
118
92
 
119
93
  # there may be many ids with the same value.
120
94
  # output all exact matches.
@@ -1,3 +1,24 @@
1
+ #### v9.1.2 2016-12-25
2
+
3
+ - [22401b0](https://github.com/appium/ruby_lib/commit/22401b065f2317e82d37b5188ad9c18c701b0a41) Release 9.1.2
4
+ - [ab3ba8e](https://github.com/appium/ruby_lib/commit/ab3ba8e0fd9e6867b63c5cd0a3f929aca8fc236b) Fix set immediate value (#432)
5
+ - [75acc43](https://github.com/appium/ruby_lib/commit/75acc4313fffca87c3c9c54214175a9981c0d540) disable lint unified integer (#431)
6
+ - [baf5f3c](https://github.com/appium/ruby_lib/commit/baf5f3c7bc3cf51b5f38878f40d88563546dfc10) update tests for finds_exact (#429)
7
+ - [42df79b](https://github.com/appium/ruby_lib/commit/42df79b4cd0b5a36f52628f0acdeb688c5170c0c) fix identicalConditionalBranches (#428)
8
+ - [2a91a6d](https://github.com/appium/ruby_lib/commit/2a91a6dcd50097101e212b1ed9fc64a470dd95da) add appium_client_version (#421)
9
+ - [7c39087](https://github.com/appium/ruby_lib/commit/7c39087676071a4cf27d97fc309e13e968dfb21c) fix rubocop associated with block call (#422)
10
+ - [1979cd8](https://github.com/appium/ruby_lib/commit/1979cd824947d1182fb99ff0f00dbfff165c0aab) Release 9 1 1 (#427)
11
+ - [c016ba3](https://github.com/appium/ruby_lib/commit/c016ba3f9d265ca8b851ec8ed85670ee50b4215b) Release 9.1.1
12
+
13
+
14
+ #### v9.1.1 2016-12-19
15
+
16
+ - [c016ba3](https://github.com/appium/ruby_lib/commit/c016ba3f9d265ca8b851ec8ed85670ee50b4215b) Release 9.1.1
17
+ - [125f144](https://github.com/appium/ruby_lib/commit/125f144481f0b01ab7014ca83968924e7bf827ba) bugfix for finding an array of exact elements in ios (#424)
18
+ - [586205a](https://github.com/appium/ruby_lib/commit/586205ab9d6ce0c286a6036616a7755b74f6a1ba) Release 9 1 0 (#419)
19
+ - [ba9ec64](https://github.com/appium/ruby_lib/commit/ba9ec64031f242b3065674b1e4f8b236b391f9fa) Release 9.1.0
20
+
21
+
1
22
  #### v9.1.0 2016-12-18
2
23
 
3
24
  - [ba9ec64](https://github.com/appium/ruby_lib/commit/ba9ec64031f242b3065674b1e4f8b236b391f9fa) Release 9.1.0
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: 9.1.1
4
+ version: 9.1.2
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: 2016-12-19 00:00:00.000000000 Z
11
+ date: 2016-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver