appium_lib 0.5.15 → 0.5.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.5.15' unless defined? ::Appium::VERSION
5
- DATE = '2013-07-03' unless defined? ::Appium::DATE
4
+ VERSION = '0.5.16' unless defined? ::Appium::VERSION
5
+ DATE = '2013-07-26' unless defined? ::Appium::DATE
6
6
  end
@@ -8,7 +8,7 @@ https://github.com/appium/appium/blob/c58eeb66f2d6fa3b9a89d188a2e657cca7cb300f/L
8
8
  # Load appium.txt (toml format) into system ENV
9
9
  # the basedir of this file + appium.txt is what's used
10
10
  # @param opts [Hash] file: '/path/to/appium.txt', verbose: true
11
- # @return [nil]
11
+ # @return [Array<String>] the require files. nil if require doesn't exist
12
12
  def load_appium_txt opts
13
13
  raise 'opts must be a hash' unless opts.kind_of? Hash
14
14
  opts.each_pair { |k,v| opts[k.to_s.downcase.strip.intern] = v }
@@ -17,7 +17,8 @@ def load_appium_txt opts
17
17
  raise 'Must pass file' unless file
18
18
  verbose = opts.fetch :verbose, false
19
19
  # Check for env vars in .txt
20
- toml = File.expand_path File.join File.dirname(file), 'appium.txt'
20
+ parent_dir = File.dirname file
21
+ toml = File.expand_path File.join parent_dir, 'appium.txt'
21
22
  puts "appium.txt path: #{toml}" if verbose
22
23
  # @private
23
24
  def update data, *args
@@ -29,6 +30,7 @@ def load_appium_txt opts
29
30
 
30
31
  toml_exists = File.exists? toml
31
32
  puts "Exists? #{toml_exists}" if verbose
33
+ data = nil
32
34
 
33
35
  if toml_exists
34
36
  require 'toml'
@@ -39,9 +41,14 @@ def load_appium_txt opts
39
41
  # toml requires A = "OK"
40
42
  #
41
43
  # A="OK" => A = "OK"
42
- data = File.read(toml).gsub /([^\s])\=(")/, "\\1 = \\2"
44
+ data = File.read toml
45
+
46
+ data = data.split("\n").map do |line|
47
+ line.sub /([^\s])\=/, "\\1 = "
48
+ end.join "\n"
49
+
43
50
  data = TOML::Parser.new(data).parsed
44
- ap data unless data.empty?
51
+ ap data unless data.empty? if verbose
45
52
 
46
53
  update data, 'APP_PATH', 'APP_APK', 'APP_PACKAGE',
47
54
  'APP_ACTIVITY', 'APP_WAIT_ACTIVITY',
@@ -50,7 +57,21 @@ def load_appium_txt opts
50
57
  # Ensure app path is absolute
51
58
  ENV['APP_PATH'] = File.expand_path ENV['APP_PATH'] if ENV['APP_PATH']
52
59
  end
53
- nil
60
+
61
+ # return list of require files as an array
62
+ # nil if require doesn't exist
63
+ if data && data['require']
64
+ r = data['require']
65
+ r = r.kind_of?(Array) ? r : [ r ]
66
+ # ensure files are absolute
67
+ r.map! do |file|
68
+ file = file.include?(File::Separator) ? file :
69
+ File.join(parent_dir, file)
70
+ file = File.expand_path file
71
+ File.exists?(file) ? file : nil
72
+ end
73
+ r.compact # remove nils
74
+ end
54
75
  end
55
76
 
56
77
  module Appium
@@ -209,6 +230,22 @@ module Appium
209
230
  end # def initialize
210
231
 
211
232
  # Returns the status payload
233
+ #
234
+ # ```ruby
235
+ # {"status"=>0,
236
+ # "value"=>
237
+ # {"build"=>
238
+ # {"version"=>"0.8.2",
239
+ # "revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
240
+ # "sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
241
+ # ```
242
+ #
243
+ # Discover the Appium rev running on the server.
244
+ #
245
+ # `status["value"]["build"]["revision"]`
246
+ # `f2a2bc3782e4b0370d97a097d7e04913cf008995`
247
+ #
248
+ # @return [JSON]
212
249
  def status
213
250
  driver.status.payload
214
251
  end
@@ -9,11 +9,29 @@ module Appium::Ios
9
9
  # Cross platform way of entering text into a textfield
10
10
  def type text
11
11
  # enter text then tap window to hide the keyboard.
12
+ =begin
13
+ Find the top left corner of the keyboard and move up 10 pixels (origin.y - 10)
14
+ now swipe down until the end of the window - 10 pixels.
15
+ -10 to ensure we're not going outside the window bounds.
16
+
17
+ Swiping inside the keyboard will not dismiss it.
18
+ =end
19
+ # type
20
+ execute_script %(au.getElement('#{self.ref}').setValue('#{text}');)
21
+
22
+ # wait for keyboard
23
+ wait_true { execute_script %(au.mainApp.keyboard().type() !== 'UIAElementNil') }
24
+
25
+ # dismiss keyboard
12
26
  js = <<-JS
13
- au.getElement('#{self.ref}').setValue('#{text}');
14
- au.lookup('window')[0].tap();
27
+ if (au.mainApp.keyboard().type() !== "UIAElementNil") {
28
+ var startY = au.mainApp.keyboard().rect().origin.y - 10;
29
+ var endY = au.mainWindow.rect().size.height - 10;
30
+ au.flickApp(0, startY, 0, endY);
31
+ }
15
32
  JS
16
- @driver.execute_script js
33
+
34
+ execute_script js
17
35
  end
18
36
  end
19
37
  end
data/readme.md CHANGED
@@ -4,13 +4,13 @@
4
4
  - [Documentation for appium_lib](http://www.rubydoc.info/github/appium/ruby_lib/master/frames)
5
5
  - [Appium Ruby Console](https://github.com/appium/ruby_console)
6
6
 
7
- Helper methods for writing cross platform (iPad, iPhone, Android) tests in Ruby using Appium.
7
+ Helper methods for writing cross platform (iPad, iPhone, Android) tests in Ruby using Appium. Note that user waits should not exceed 120 seconds if they're going to run on Sauce Labs.
8
8
 
9
9
  Make sure you're using Ruby 1.9.3+ with upgraded rubygems and bundler.
10
10
 
11
11
  #### Start appium server
12
12
 
13
- `node server.js -V --fast-reset --without-delay`
13
+ `node server.js`
14
14
 
15
15
  #### Install / Upgrade
16
16
 
@@ -41,8 +41,8 @@ Appium::Driver.new(app).start_driver
41
41
  # Start Android driver
42
42
  apk = { app_path: '/path/to/the.apk',
43
43
  app_package: 'com.example.pkg',
44
- app_activity: 'act.Start',
45
- app_wait_activity: 'act.Start'
44
+ app_activity: '.act.Start',
45
+ app_wait_activity: '.act.Start'
46
46
  }
47
47
  Appium::Driver.new(apk).start_driver
48
48
  ```
@@ -68,7 +68,7 @@ Appium::Driver.new(apk).start_driver
68
68
 
69
69
  1. Does `adb kill-server; adb devices` list an active Android device?
70
70
  2. Have you defined the proper env vars? `APP_PATH, APP_PACKAGE, APP_ACTIVITY, APP_WAIT_ACTIVITY`
71
- 3. Are you running appium from source? `node server.js -V --fast-reset`
71
+ 3. Are you running appium from source? `node server.js`
72
72
 
73
73
  #### Documentation
74
74
 
@@ -1,3 +1,10 @@
1
+ #### v0.5.15 2013-07-03
2
+
3
+ - [734fe68](https://github.com/appium/ruby_lib/commit/734fe6887f36aa1ad59ef7ce992ba2e2f4c8c7d3) Release 0.5.15
4
+ - [0e203d7](https://github.com/appium/ruby_lib/commit/0e203d76610abd519ba9d2fe9c14b50c94df5bbd) Fix driver methods overriding object methods
5
+ - [efc4602](https://github.com/appium/ruby_lib/commit/efc460278af5b6f2a24c290f704781be4e9b2d4b) Fix open struct
6
+
7
+
1
8
  #### v0.5.14 2013-07-03
2
9
 
3
10
  - [521f79b](https://github.com/appium/ruby_lib/commit/521f79b11497c0c963b7059347e02d81a08f665a) Release 0.5.14
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.15
5
- prerelease:
4
+ version: 0.5.16
6
5
  platform: ruby
7
6
  authors:
8
7
  - code@bootstraponline.com
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-03 00:00:00.000000000 Z
11
+ date: 2013-07-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: selenium-webdriver
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: awesome_print
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: json
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: toml
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -132,30 +121,26 @@ files:
132
121
  homepage: https://github.com/appium/ruby_lib
133
122
  licenses:
134
123
  - http://www.apache.org/licenses/LICENSE-2.0.txt
124
+ metadata: {}
135
125
  post_install_message:
136
126
  rdoc_options: []
137
127
  require_paths:
138
128
  - lib
139
129
  required_ruby_version: !ruby/object:Gem::Requirement
140
- none: false
141
130
  requirements:
142
- - - ! '>='
131
+ - - '>='
143
132
  - !ruby/object:Gem::Version
144
133
  version: 1.9.3
145
134
  required_rubygems_version: !ruby/object:Gem::Requirement
146
- none: false
147
135
  requirements:
148
- - - ! '>='
136
+ - - '>='
149
137
  - !ruby/object:Gem::Version
150
138
  version: '0'
151
- segments:
152
- - 0
153
- hash: 4217890362488520360
154
139
  requirements: []
155
140
  rubyforge_project:
156
- rubygems_version: 1.8.25
141
+ rubygems_version: 2.0.6
157
142
  signing_key:
158
- specification_version: 3
143
+ specification_version: 4
159
144
  summary: Ruby library for Appium
160
145
  test_files: []
161
146
  has_rdoc: