calabash-android 0.4.0.pre17 → 0.4.0.pre18

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,5 @@
1
1
  require 'calabash-android/management/adb'
2
2
  require 'calabash-android/operations'
3
- include Calabash::Android::Operations
4
3
 
5
4
  Before do |scenario|
6
5
  start_test_server_in_background
data/irbrc CHANGED
@@ -15,7 +15,7 @@ IRB.conf[:SAVE_HISTORY] = 50
15
15
  IRB.conf[:HISTORY_FILE] = ".irb-history"
16
16
 
17
17
  require 'calabash-android/operations'
18
- include Calabash::Android::Operations
18
+ extend Calabash::Android::Operations
19
19
 
20
20
  def embed(*args)
21
21
  puts "Embed is a Cucumber method and is not available in this console."
@@ -7,6 +7,7 @@ require 'socket'
7
7
  require 'timeout'
8
8
  require 'calabash-android/helpers'
9
9
  require 'calabash-android/wait_helpers'
10
+ require 'calabash-android/touch_helpers'
10
11
  require 'calabash-android/version'
11
12
  require 'retriable'
12
13
  require 'cucumber'
@@ -16,15 +17,12 @@ module Calabash module Android
16
17
 
17
18
  module Operations
18
19
  include Calabash::Android::WaitHelpers
20
+ include Calabash::Android::TouchHelpers
19
21
 
20
22
  def log(message)
21
23
  $stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}" if (ARGV.include? "-v" or ARGV.include? "--verbose")
22
24
  end
23
25
 
24
- def take_screenshot
25
- default_device.take_screenshot
26
- end
27
-
28
26
  def macro(txt)
29
27
  if self.respond_to?(:step)
30
28
  step(txt)
@@ -90,6 +88,10 @@ module Operations
90
88
  default_device.screenshot(options)
91
89
  end
92
90
 
91
+ def fail(msg="Error. Check log for details.", options={:prefix => nil, :name => nil, :label => nil})
92
+ screenshot_and_raise(msg, options)
93
+ end
94
+
93
95
  def set_gps_coordinates_from_location(location)
94
96
  default_device.set_gps_coordinates_from_location(location)
95
97
  end
@@ -98,20 +100,6 @@ module Operations
98
100
  default_device.set_gps_coordinates(latitude, longitude)
99
101
  end
100
102
 
101
- #def wait_for(timeout, &block)
102
- # value = nil
103
- # begin
104
- # Timeout::timeout(timeout) do
105
- # until (value = block.call)
106
- # sleep 0.3
107
- # end
108
- # end
109
- # rescue Exception => e
110
- # raise e
111
- # end
112
- # value
113
- #end
114
-
115
103
  def query(uiquery, *args)
116
104
  converted_args = []
117
105
  args.each do |arg|
@@ -253,25 +241,6 @@ module Operations
253
241
  end
254
242
  end
255
243
 
256
- def take_screenshot
257
- puts "take_screenshot is deprecated. Use screenshot_embed instead."
258
- path = ENV["SCREENSHOT_PATH_PREFIX"] || "results"
259
- FileUtils.mkdir_p path unless File.exist? path
260
- filename_prefix = FeatureNameMemory.feature_name.gsub(/\s+/, '_').downcase
261
- begin
262
- Timeout.timeout(30) do
263
- file_name = "#{path}/#{filename_prefix}_#{FeatureNameMemory.invocation}_#{StepCounter.step_line}.png"
264
- image = http("/screenshot")
265
- open(file_name ,"wb") { |file|
266
- file.write(image)
267
- }
268
- log "Screenshot stored in: #{file_name}!!!"
269
- end
270
- rescue Timeout::Error
271
- raise Exception, "take_screenshot timed out"
272
- end
273
- end
274
-
275
244
  def screenshot(options={:prefix => nil, :name => nil})
276
245
  prefix = options[:prefix] || ENV['SCREENSHOT_PATH'] || ""
277
246
  name = options[:name]
@@ -0,0 +1,9 @@
1
+ module Calabash
2
+ module Android
3
+ module TouchHelpers
4
+ def tap(mark, *args)
5
+ touch("* marked:'#{mark}'", *args)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.0.pre17"
3
+ VERSION = "0.4.0.pre18"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre17
4
+ version: 0.4.0.pre18
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -169,6 +169,7 @@ files:
169
169
  - lib/calabash-android/steps/search_steps.rb
170
170
  - lib/calabash-android/steps/spinner_steps.rb
171
171
  - lib/calabash-android/steps/time_picker_steps.rb
172
+ - lib/calabash-android/touch_helpers.rb
172
173
  - lib/calabash-android/version.rb
173
174
  - lib/calabash-android/wait_helpers.rb
174
175
  - test-server/AndroidManifest.xml
@@ -848,7 +849,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
848
849
  version: 1.3.1
849
850
  requirements: []
850
851
  rubyforge_project:
851
- rubygems_version: 1.8.24
852
+ rubygems_version: 1.8.23
852
853
  signing_key:
853
854
  specification_version: 3
854
855
  summary: Client for calabash-android for automated functional testing on Android