honeydew 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/examples/cucumber/Gemfile +2 -0
- data/examples/cucumber/features/example.feature +4 -8
- data/examples/cucumber/features/step_definitions/calculator_steps.rb +19 -0
- data/examples/rspec/Gemfile +6 -0
- data/examples/rspec/Rakefile +9 -0
- data/lib/honeydew/device.rb +6 -9
- data/lib/honeydew/device_actions.rb +4 -0
- data/lib/honeydew/device_commands.rb +7 -5
- data/lib/honeydew/device_log_formatter.rb +10 -0
- data/lib/honeydew/honeydew.rb +7 -5
- data/lib/honeydew/version.rb +1 -1
- data/server/pom.xml +1 -1
- data/server/target/honeydew-server-0.16.0.jar +0 -0
- metadata +10 -5
- data/examples/cucumber/features/step_definitions/honeydew_steps.rb +0 -1
- data/server/target/honeydew-server-0.15.0.jar +0 -0
data/.gitignore
CHANGED
data/examples/cucumber/Gemfile
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
@honeydew
|
2
1
|
Feature: Example demonstrating honeydew
|
2
|
+
|
3
3
|
Scenario: Perform addition using calculator
|
4
|
-
When I launch app
|
5
|
-
Then I
|
6
|
-
Then I
|
7
|
-
Then I press the "2" button
|
8
|
-
Then I press the "5" button
|
9
|
-
And I press the "=" button
|
10
|
-
Then I wait up to 2 seconds for "25" to appear in edit text
|
4
|
+
When I launch app Calculator
|
5
|
+
Then I square root 625
|
6
|
+
Then I should see 25 as the result
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'honeydew'
|
2
|
+
|
3
|
+
When(/^I launch app (.+)$/) do |app|
|
4
|
+
Honeydew.current_device.launch_application app
|
5
|
+
end
|
6
|
+
|
7
|
+
Then(/^I square root (\d+)/) do |number|
|
8
|
+
Honeydew.current_device.long_click_element 'square root'
|
9
|
+
number.to_s.each_char {|n| Honeydew.current_device.click_button n }
|
10
|
+
Honeydew.current_device.click_button '='
|
11
|
+
end
|
12
|
+
|
13
|
+
When(/^I press the (.+) button$/) do |text|
|
14
|
+
Honeydew.current_device.click_button text
|
15
|
+
end
|
16
|
+
|
17
|
+
Then(/^I should see (\d+) as the result$/) do |result|
|
18
|
+
Honeydew.current_device.should have_edit_text(result)
|
19
|
+
end
|
data/lib/honeydew/device.rb
CHANGED
@@ -2,11 +2,13 @@ require 'net/http'
|
|
2
2
|
|
3
3
|
require 'honeydew/device_matchers'
|
4
4
|
require 'honeydew/device_actions'
|
5
|
+
require 'honeydew/device_log_formatter'
|
5
6
|
|
6
7
|
module Honeydew
|
7
8
|
class Device
|
8
9
|
include Honeydew::DeviceActions
|
9
10
|
include Honeydew::DeviceMatchers
|
11
|
+
include Honeydew::DeviceLogFormatter
|
10
12
|
|
11
13
|
ServerTimeoutError = Class.new(Timeout::Error)
|
12
14
|
ActionFailedError = Class.new(Timeout::Error)
|
@@ -40,7 +42,7 @@ module Honeydew
|
|
40
42
|
|
41
43
|
arguments[:timeout] = Honeydew.config.timeout.to_s
|
42
44
|
|
43
|
-
|
45
|
+
debug "performing assertion #{action} with arguments #{arguments}"
|
44
46
|
Timeout.timeout Honeydew.config.timeout.to_i, FinderTimeout do
|
45
47
|
begin
|
46
48
|
send_command action, arguments
|
@@ -56,7 +58,7 @@ module Honeydew
|
|
56
58
|
def perform_action action, arguments = {}, options = {}
|
57
59
|
ensure_device_ready
|
58
60
|
arguments[:timeout] = Honeydew.config.timeout.to_s
|
59
|
-
|
61
|
+
debug "performing action #{action} with arguments #{arguments}"
|
60
62
|
send_command action, arguments
|
61
63
|
end
|
62
64
|
|
@@ -81,11 +83,6 @@ module Honeydew
|
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
84
|
-
def log message
|
85
|
-
return unless Honeydew.config.debug
|
86
|
-
STDERR.puts "Device #{serial}: #{message}"
|
87
|
-
end
|
88
|
-
|
89
86
|
def ensure_device_ready
|
90
87
|
@device_ready ||= begin
|
91
88
|
wait_for_honeydew_server
|
@@ -98,11 +95,11 @@ module Honeydew
|
|
98
95
|
end
|
99
96
|
|
100
97
|
def wait_for_honeydew_server
|
101
|
-
|
98
|
+
info 'waiting for honeydew-server to respond'
|
102
99
|
timeout_server_operation do
|
103
100
|
sleep 0.1 until honeydew_server_alive?
|
104
101
|
end
|
105
|
-
|
102
|
+
info 'honeydew-server is alive and awaiting commands'
|
106
103
|
|
107
104
|
rescue ServerTimeoutError
|
108
105
|
raise 'timed out waiting for honeydew-server to respond'
|
@@ -60,6 +60,10 @@ module Honeydew
|
|
60
60
|
perform_action :long_click, :description => element_description
|
61
61
|
end
|
62
62
|
|
63
|
+
def long_click_text element_text
|
64
|
+
perform_action :long_click, :text =>element_text, :type => 'TextView'
|
65
|
+
end
|
66
|
+
|
63
67
|
def launch_settings_item item_name
|
64
68
|
perform_action :select_menu_in_settings, :menuName => item_name
|
65
69
|
end
|
@@ -35,7 +35,7 @@ module Honeydew
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def terminate_honeydew_server
|
38
|
-
|
38
|
+
info "terminating honeydew-server"
|
39
39
|
Net::HTTP.post_form device_endpoint('/terminate'), {}
|
40
40
|
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError
|
41
41
|
# Swallow
|
@@ -50,9 +50,9 @@ module Honeydew
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def start_automation_server
|
53
|
-
|
53
|
+
info "starting honeydew-server on the device"
|
54
|
+
adb "push #{honeydew_server_file} /data/local/tmp"
|
54
55
|
Thread.new do
|
55
|
-
adb "push #{honeydew_server_file} /data/local/tmp"
|
56
56
|
adb "shell uiautomator runtest #{honeydew_server_package} -c com.amplify.honeydew_server.TestRunner"
|
57
57
|
end
|
58
58
|
at_exit do
|
@@ -86,10 +86,12 @@ module Honeydew
|
|
86
86
|
|
87
87
|
def adb(command)
|
88
88
|
adb_command = "adb -s #{serial} #{command}"
|
89
|
-
|
89
|
+
info "executing '#{adb_command}'"
|
90
90
|
`#{adb_command} 2>/dev/null`.tap do
|
91
91
|
if $?.exitstatus != 0
|
92
|
-
|
92
|
+
message = "ADB command '#{command}' failed"
|
93
|
+
error message
|
94
|
+
raise message
|
93
95
|
end
|
94
96
|
end
|
95
97
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Honeydew
|
2
|
+
module DeviceLogFormatter
|
3
|
+
Logger::Severity.constants.each do |severity|
|
4
|
+
severity_sym = severity.to_s.downcase.to_sym
|
5
|
+
define_method severity_sym do |message|
|
6
|
+
Honeydew.config.logger.send(severity_sym, "Device #{serial}: #{message}")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/honeydew/honeydew.rb
CHANGED
@@ -5,16 +5,18 @@ require 'honeydew/device'
|
|
5
5
|
|
6
6
|
module Honeydew
|
7
7
|
class Configuration
|
8
|
-
attr_accessor :
|
8
|
+
attr_accessor :logger,
|
9
|
+
:port,
|
9
10
|
:server_timeout,
|
10
|
-
:timeout
|
11
|
-
:port
|
11
|
+
:timeout
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@port = 7120
|
15
|
-
@debug = true
|
16
15
|
@timeout = 5.seconds
|
17
|
-
@server_timeout =
|
16
|
+
@server_timeout = 60.seconds
|
17
|
+
|
18
|
+
@logger = Logger.new(STDERR)
|
19
|
+
@logger.level = Logger::INFO
|
18
20
|
end
|
19
21
|
|
20
22
|
def obtain_new_port
|
data/lib/honeydew/version.rb
CHANGED
data/server/pom.xml
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeydew
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -132,7 +132,9 @@ files:
|
|
132
132
|
- examples/cucumber/Gemfile
|
133
133
|
- examples/cucumber/Rakefile
|
134
134
|
- examples/cucumber/features/example.feature
|
135
|
-
- examples/cucumber/features/step_definitions/
|
135
|
+
- examples/cucumber/features/step_definitions/calculator_steps.rb
|
136
|
+
- examples/rspec/Gemfile
|
137
|
+
- examples/rspec/Rakefile
|
136
138
|
- examples/rspec/spec/browse_spec.rb
|
137
139
|
- examples/rspec/spec/spec_helper.rb
|
138
140
|
- honeydew.gemspec
|
@@ -142,6 +144,7 @@ files:
|
|
142
144
|
- lib/honeydew/device.rb
|
143
145
|
- lib/honeydew/device_actions.rb
|
144
146
|
- lib/honeydew/device_commands.rb
|
147
|
+
- lib/honeydew/device_log_formatter.rb
|
145
148
|
- lib/honeydew/device_matchers.rb
|
146
149
|
- lib/honeydew/dsl.rb
|
147
150
|
- lib/honeydew/honeydew.rb
|
@@ -198,7 +201,7 @@ files:
|
|
198
201
|
- spec/honeydew/device_matchers_spec.rb
|
199
202
|
- spec/honeydew/device_spec.rb
|
200
203
|
- spec/spec_helper.rb
|
201
|
-
- server/target/honeydew-server-0.
|
204
|
+
- server/target/honeydew-server-0.16.0.jar
|
202
205
|
homepage:
|
203
206
|
licenses: []
|
204
207
|
post_install_message:
|
@@ -219,12 +222,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
222
|
version: '0'
|
220
223
|
requirements: []
|
221
224
|
rubyforge_project:
|
222
|
-
rubygems_version: 1.8.
|
225
|
+
rubygems_version: 1.8.25
|
223
226
|
signing_key:
|
224
227
|
specification_version: 3
|
225
228
|
summary: Ruby DSL for controlling Android devices
|
226
229
|
test_files:
|
227
230
|
- .rspec
|
231
|
+
- examples/rspec/Gemfile
|
232
|
+
- examples/rspec/Rakefile
|
228
233
|
- examples/rspec/spec/browse_spec.rb
|
229
234
|
- examples/rspec/spec/spec_helper.rb
|
230
235
|
- honeydew.gemspec
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'honeydew/step_definitions'
|
Binary file
|