calabash-cucumber 0.9.145.pre2 → 0.9.145.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,5 +42,7 @@ end
42
42
 
43
43
  at_exit do
44
44
  launcher = Calabash::Cucumber::Launcher.new
45
- Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
45
+ if launcher.simulator_target?
46
+ Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
47
+ end
46
48
  end
@@ -7,7 +7,10 @@ module Calabash
7
7
 
8
8
  DATA_PATH = File.expand_path(File.dirname(__FILE__))
9
9
  CAL_HTTP_RETRY_COUNT=3
10
- RETRYABLE_ERRORS = [Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ETIMEDOUT]
10
+ RETRYABLE_ERRORS = [HTTPClient::TimeoutError,
11
+ HTTPClient::KeepAliveDisconnected,
12
+ Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED,
13
+ Errno::ETIMEDOUT]
11
14
 
12
15
  def macro(txt)
13
16
  if self.respond_to? :step
@@ -466,10 +469,11 @@ EOF
466
469
 
467
470
  def calabash_exit
468
471
  # Exiting the app shuts down the HTTP connection and generates ECONNREFUSED,
472
+ # or HTTPClient::KeepAliveDisconnected
469
473
  # which needs to be suppressed.
470
474
  begin
471
- http({:method =>:post, :path => 'exit', :retryable_errors => RETRYABLE_ERRORS - [Errno::ECONNREFUSED]})
472
- rescue Errno::ECONNREFUSED
475
+ http({:method =>:post, :path => 'exit', :retryable_errors => RETRYABLE_ERRORS - [Errno::ECONNREFUSED,HTTPClient::KeepAliveDisconnected]})
476
+ rescue Errno::ECONNREFUSED, HTTPClient::KeepAliveDisconnected
473
477
  []
474
478
  end
475
479
  end
@@ -548,6 +552,7 @@ EOF
548
552
  end
549
553
 
550
554
  def make_http_request(options)
555
+
551
556
  body = nil
552
557
  retryable_errors = options[:retryable_errors] || RETRYABLE_ERRORS
553
558
  CAL_HTTP_RETRY_COUNT.times do |count|
@@ -561,29 +566,20 @@ EOF
561
566
  body = @http.get(options[:uri], options[:body]).body
562
567
  end
563
568
  break
564
- rescue HTTPClient::TimeoutError, HTTPClient::KeepAliveDisconnected => e
565
- if count < CAL_HTTP_RETRY_COUNT-1
566
- @http.reset_all
567
- @http=nil
568
- STDOUT.write "Waiting 5 secs before retry...\n"
569
- sleep(5)
570
- STDOUT.write "Retrying.. #{e.class}: (#{e})\n"
571
- STDOUT.flush
569
+ rescue Exception => e
572
570
 
573
- else
574
- puts "Failing... #{e.class}"
575
- raise e
576
- end
571
+ if retryable_errors.include?(e) || retryable_errors.any?{|c| e.is_a?(c)}
577
572
 
578
- rescue Exception => e
579
- if retryable_errors.include?(e)
580
573
  if count < CAL_HTTP_RETRY_COUNT-1
581
- sleep(0.5)
574
+ if e.is_a?(HTTPClient::TimeoutError)
575
+ sleep(3)
576
+ else
577
+ sleep(0.5)
578
+ end
582
579
  @http.reset_all
583
580
  @http=nil
584
581
  STDOUT.write "Retrying.. #{e.class}: (#{e})\n"
585
582
  STDOUT.flush
586
-
587
583
  else
588
584
  puts "Failing... #{e.class}"
589
585
  raise e
@@ -25,7 +25,7 @@ class Calabash::Cucumber::Launcher
25
25
  end
26
26
 
27
27
  def device_target?
28
- ENV['DEVICE_TARGET'] == 'device'
28
+ (ENV['DEVICE_TARGET'] != nil) && (not simulator_target?)
29
29
  end
30
30
 
31
31
  def simulator_target?
@@ -68,6 +68,10 @@ class Calabash::Cucumber::Launcher
68
68
 
69
69
  if device_target?
70
70
  default_args = {:app => ENV['BUNDLE_ID']}
71
+ target = ENV['DEVICE_TARGET']
72
+ if target != 'DEVICE'
73
+ default_args[:udid] = target
74
+ end
71
75
  self.run_loop = RunLoop.run(default_args.merge(args))
72
76
  else
73
77
 
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = '0.9.145.pre2'
4
- FRAMEWORK_VERSION = '0.9.145.pre2'
3
+ VERSION = '0.9.145.pre3'
4
+ FRAMEWORK_VERSION = '0.9.145.pre3'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.145.pre2
4
+ version: 0.9.145.pre3
5
5
  prerelease: 8
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-05-07 00:00:00.000000000 Z
12
+ date: 2013-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber