appium_lib 0.7.0 → 0.7.1

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.
@@ -307,10 +307,6 @@ module Appium::Android
307
307
  nil
308
308
  end
309
309
 
310
- def lazy_load_strings
311
- @strings_xml ||= mobile(:getStrings)
312
- end
313
-
314
310
  # Android only.
315
311
  # Returns a string containing interesting elements.
316
312
  # If an element has no content desc or text, then it's not returned by this method.
@@ -416,30 +412,6 @@ module Appium::Android
416
412
  0.20
417
413
  end
418
414
 
419
- # Search strings.xml's values for target.
420
- # @param target [String] the target to search for in strings.xml values
421
- # @return [Array]
422
- def xml_keys target
423
- lazy_load_strings
424
- @strings_xml.select { |key, value| key.downcase.include? target.downcase }
425
- end
426
-
427
- # Search strings.xml's keys for target.
428
- # @param target [String] the target to search for in strings.xml keys
429
- # @return [Array]
430
- def xml_values target
431
- lazy_load_strings
432
- @strings_xml.select { |key, value| value.downcase.include? target.downcase }
433
- end
434
-
435
- # Resolve id in strings.xml and return the value.
436
- # @param id [String] the id to resolve
437
- # @return [String]
438
- def resolve_id id
439
- lazy_load_strings
440
- @strings_xml[id]
441
- end
442
-
443
415
  # Lists package, activity, and adb shell am start -n value for current app.
444
416
  # Works on local host only (not remote).
445
417
  def current_app
@@ -232,4 +232,32 @@ module Appium::Common
232
232
  OpenStruct.new( x: x.to_f / w.width.to_f,
233
233
  y: y.to_f / w.height.to_f )
234
234
  end
235
+
236
+ def lazy_load_strings
237
+ @strings_xml ||= mobile(:getStrings)
238
+ end
239
+
240
+ # Search strings.xml's values for target.
241
+ # @param target [String] the target to search for in strings.xml values
242
+ # @return [Array]
243
+ def xml_keys target
244
+ lazy_load_strings
245
+ @strings_xml.select { |key, value| key.downcase.include? target.downcase }
246
+ end
247
+
248
+ # Search strings.xml's keys for target.
249
+ # @param target [String] the target to search for in strings.xml keys
250
+ # @return [Array]
251
+ def xml_values target
252
+ lazy_load_strings
253
+ @strings_xml.select { |key, value| value.downcase.include? target.downcase }
254
+ end
255
+
256
+ # Resolve id in strings.xml and return the value.
257
+ # @param id [String] the id to resolve
258
+ # @return [String]
259
+ def resolve_id id
260
+ lazy_load_strings
261
+ @strings_xml[id]
262
+ end
235
263
  end # module Appium::Common
@@ -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.7.0' unless defined? ::Appium::VERSION
5
- DATE = '2013-08-23' unless defined? ::Appium::DATE
4
+ VERSION = '0.7.1' unless defined? ::Appium::VERSION
5
+ DATE = '2013-09-09' unless defined? ::Appium::DATE
6
6
  end
@@ -194,7 +194,7 @@ module Appium
194
194
  attr_reader :default_wait, :app_path, :app_name, :device,
195
195
  :app_package, :app_activity, :app_wait_activity,
196
196
  :sauce_username, :sauce_access_key, :port, :debug,
197
- :export_session, :device_cap, :compress_xml
197
+ :export_session, :device_cap, :compress_xml, :custom_url
198
198
 
199
199
  # The amount to sleep in seconds before every webdriver http call.
200
200
  attr_accessor :global_webdriver_http_sleep
@@ -234,6 +234,8 @@ module Appium
234
234
  # convert to downcased symbols
235
235
  opts.each_pair { |k,v| opts[k.to_s.downcase.strip.intern] = v }
236
236
 
237
+ @custom_url = opts.fetch :server_url, false
238
+
237
239
  @compress_xml = opts[:compress_xml] ? true : false
238
240
 
239
241
  @export_session = opts.fetch :export_session, false
@@ -399,6 +401,7 @@ module Appium
399
401
  # Get the server url for sauce or local based on env vars.
400
402
  # @return [String] the server url
401
403
  def server_url
404
+ return @custom_url if @custom_url
402
405
  if !@sauce_username.nil? && !@sauce_access_key.nil?
403
406
  "http://#{@sauce_username}:#{@sauce_access_key}@ondemand.saucelabs.com:80/wd/hub"
404
407
  else
@@ -83,10 +83,6 @@ module Appium::Ios
83
83
  nil
84
84
  end
85
85
 
86
- def lazy_load_strings
87
- @strings_xml ||= mobile(:getStrings)
88
- end
89
-
90
86
  # Returns a string of interesting elements. iOS only.
91
87
  #
92
88
  # Defaults to inspecting the 1st windows source only.
@@ -19,20 +19,25 @@ Swiping inside the keyboard will not dismiss it.
19
19
  # type
20
20
  $driver.execute_script %(au.getElement('#{self.ref}').setValue('#{text}');)
21
21
 
22
- # wait for keyboard
23
- $driver.wait_true { $driver.execute_script %(au.mainApp.keyboard().type
24
- () !== 'UIAElementNil') }
22
+ $driver.ignore {
23
+ # wait 5 seconds for keyboard. if the textfield is disabled then
24
+ # setValue will work, however the keyboard will never display
25
+ # because users are normally not allowed to type into it.
26
+ $driver.wait_true(5) do
27
+ $driver.execute_script %(au.mainApp.keyboard().type() !== 'UIAElementNil')
28
+ end
25
29
 
26
- # dismiss keyboard
27
- js = <<-JS
28
- if (au.mainApp.keyboard().type() !== "UIAElementNil") {
29
- var startY = au.mainApp.keyboard().rect().origin.y - 10;
30
- var endY = au.mainWindow.rect().size.height - 10;
31
- au.flickApp(0, startY, 0, endY);
32
- }
33
- JS
30
+ # dismiss keyboard
31
+ js = <<-JS
32
+ if (au.mainApp.keyboard().type() !== "UIAElementNil") {
33
+ var startY = au.mainApp.keyboard().rect().origin.y - 10;
34
+ var endY = au.mainWindow.rect().size.height - 10;
35
+ au.flickApp(0, startY, 0, endY);
36
+ }
37
+ JS
34
38
 
35
- $driver.execute_script js
39
+ $driver.execute_script js
40
+ }
36
41
  end
37
42
  end
38
43
  end
data/readme.md CHANGED
@@ -1,7 +1,7 @@
1
1
  #### appium_lib [![Gem Version](https://badge.fury.io/rb/appium_lib.png)](http://rubygems.org/gems/appium_lib)[![Dependency Status](https://gemnasium.com/appium/ruby_lib.png)](https://gemnasium.com/appium/ruby_lib)
2
2
 
3
3
  - [appium_lib on RubyGems](https://rubygems.org/gems/appium_lib)
4
- - [Documentation for appium_lib](http://www.rubydoc.info/github/appium/ruby_lib/master/frames)
4
+ - [Documentation for appium_lib](https://github.com/appium/ruby_lib/tree/master/docs)
5
5
  - [Appium Ruby Console](https://github.com/appium/ruby_console)
6
6
 
7
7
  Helper methods for writing cross platform (iOS, Android) tests in Ruby using Appium. Note that user waits should not exceed 120 seconds if they're going to run on Sauce Labs.
@@ -1,3 +1,18 @@
1
+ #### v0.7.0 2013-09-05
2
+
3
+ - [c8f3041](https://github.com/appium/ruby_lib/commit/c8f3041049c2feb9ac85f67e85523118a6ce5a84) Release 0.7.0
4
+ - [f98534d](https://github.com/appium/ruby_lib/commit/f98534dc92aa04a0afe05b6ed0e60c4be1d9394c) iOS page supports ids and defaults to 1st window
5
+ - [ab6cb4f](https://github.com/appium/ruby_lib/commit/ab6cb4f66cb496a9c557b4c6246b8ecd7a3e06ed) strings.xml is now client side. compressed xml support
6
+ - [e976552](https://github.com/appium/ruby_lib/commit/e9765527a8858d4d72e9372afdccbf0a2297f5c5) Add Android API 18 resource id to page output
7
+ - [ddc5e36](https://github.com/appium/ruby_lib/commit/ddc5e3651e4920dab9198e33b77fcf570c7e5f8b) browserName is never used
8
+ - [c5211e5](https://github.com/appium/ruby_lib/commit/c5211e52c51170653d85b9f2a249e4a346c17f7a) Print all matching ids in page
9
+ - [8d19157](https://github.com/appium/ruby_lib/commit/8d1915732718864102cdfefcf4db0adb71377a74) Include strings.xml ids in page output on Android
10
+ - [b615628](https://github.com/appium/ruby_lib/commit/b61562808624e1324be0934237dbef26a608aebf) Update readme.md
11
+ - [adc4eba](https://github.com/appium/ruby_lib/commit/adc4ebaaade7778b975c166e1ab16f5c40cc2517) Add id example
12
+ - [42d2a86](https://github.com/appium/ruby_lib/commit/42d2a860f8989a0d8df08815be1a5be4bd895ef6) Add more code examples
13
+ - [fa45efd](https://github.com/appium/ruby_lib/commit/fa45efda445b7541f49f510ec08be9e99584ff72) Update docs.md
14
+
15
+
1
16
  #### v0.6.7 2013-08-23
2
17
 
3
18
  - [a1f5942](https://github.com/appium/ruby_lib/commit/a1f5942e907339f1c3968c5af03feb5bde6b1b7c) Release 0.6.7
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.7.0
4
+ version: 0.7.1
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-08-23 00:00:00.000000000 Z
11
+ date: 2013-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver