calabash-cucumber 0.9.163.pre10 → 0.9.163.pre11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d077c3d3d772aa7ef94f355d79ff2f82235d7006
4
- data.tar.gz: 48f440454e8d31c85e1da8f2781025ad2b7e71fd
3
+ metadata.gz: a3a488993902bfbb00390bc250e3c1bd67863115
4
+ data.tar.gz: 838d8084acb6139715dbf5f8597cd6255f603f8e
5
5
  SHA512:
6
- metadata.gz: 61335091bedc4531d384ace379a34dfb834abaa30278bda089eb7bb0bff30bc478277a6c0e64901f07dbf05d916d1e89057b9a13dec0d8a78a68db94e4ef917b
7
- data.tar.gz: ffdeb716445fbd7f24246d928d4499383dac8650835377b4cfb190dfd596da572c9d3c41b1671db32e2d30eb1cb9682a4f30819a5b97d82224a34f40e8799425
6
+ metadata.gz: ca26a0000569e4729514796fa4273178096df47e647d2fcba6688bc429d3a8d1d21d4da144881a3431e38a2b59cf8f5d12ce91bd5e17fbfe2cb7242ed41d39a7
7
+ data.tar.gz: 39743981fa30de194e00ef53a538d561a0bba9025102fafc139253c8c64a4e47de539c457febe6481d95113b6420099d8e5747a2126c7e1c38e0a8b2ec70a899
@@ -1,13 +1,11 @@
1
1
  require 'calabash-cucumber/uia'
2
2
  require 'calabash-cucumber/connection_helpers'
3
- require 'calabash-cucumber/failure_helpers'
4
3
  require 'calabash-cucumber/query_helpers'
5
4
  require 'calabash-cucumber/map'
6
5
 
7
6
  class Calabash::Cucumber::InstrumentsActions
8
7
  include Calabash::Cucumber::UIA
9
8
  include Calabash::Cucumber::ConnectionHelpers
10
- include Calabash::Cucumber::FailureHelpers
11
9
  include Calabash::Cucumber::QueryHelpers
12
10
  include Calabash::Cucumber::Map
13
11
 
@@ -71,7 +69,9 @@ class Calabash::Cucumber::InstrumentsActions
71
69
  ui_query = options[:query]
72
70
  offset = options[:offset]
73
71
  if ui_query
74
- el = find_and_normalize_or_raise(ui_query)
72
+ res = find_and_normalize(ui_query)
73
+ return res if res.empty?
74
+ el = res.first
75
75
  final_offset = point_from(el, options)
76
76
  if block_given?
77
77
  yield final_offset
@@ -89,23 +89,17 @@ class Calabash::Cucumber::InstrumentsActions
89
89
  end
90
90
  end
91
91
 
92
- def find_and_normalize_or_raise(ui_query)
93
- raw_result = find_or_raise(ui_query)
92
+ def find_and_normalize(ui_query)
93
+ raw_result = raw_map(ui_query, :query)
94
94
  orientation = raw_result['status_bar_orientation']
95
- res = raw_result['results'].first
95
+ res = raw_result['results']
96
96
 
97
- normalize_rect_for_orientation!(orientation, res['rect']) if res['rect']
97
+ return res if res.empty?
98
98
 
99
- res
100
- end
99
+ first_res = res.first
100
+ normalize_rect_for_orientation!(orientation, first_res['rect']) if first_res['rect']
101
101
 
102
- def find_or_raise(ui_query)
103
- raw_result = raw_map(ui_query, :query)
104
- if raw_result['results'].empty?
105
- screenshot_and_raise "Unable to find element matching query #{ui_query}"
106
- else
107
- raw_result
108
- end
102
+ res
109
103
  end
110
104
 
111
105
  def normalize_rect_for_orientation!(orientation, rect)
@@ -1,14 +1,11 @@
1
- require 'calabash-cucumber/connection'
2
1
  require 'calabash-cucumber/playback_helpers'
3
2
  require 'calabash-cucumber/connection_helpers'
4
- require 'calabash-cucumber/failure_helpers'
5
3
  require 'calabash-cucumber/query_helpers'
6
4
 
7
5
 
8
6
  class Calabash::Cucumber::PlaybackActions
9
7
  include Calabash::Cucumber::PlaybackHelpers
10
8
  include Calabash::Cucumber::ConnectionHelpers
11
- include Calabash::Cucumber::FailureHelpers
12
9
  include Calabash::Cucumber::QueryHelpers
13
10
 
14
11
 
@@ -79,7 +79,7 @@ EOF
79
79
  candidates.each { |file| searched_for.concat(" * '#{file}'\n") }
80
80
  searched_in = " in directories =>\n"
81
81
  playback_file_directories(rec_dir).each { |dir| searched_in.concat(" * '#{dir}'\n") }
82
- screenshot_and_raise "Playback file not found for: '#{recording_name}'\n#{searched_for}#{searched_in}"
82
+ raise "Playback file not found for: '#{recording_name}'\n#{searched_for}#{searched_in}"
83
83
  end
84
84
 
85
85
  data
@@ -119,7 +119,7 @@ EOF
119
119
 
120
120
  res = JSON.parse(res)
121
121
  if res['outcome'] != 'SUCCESS'
122
- screenshot_and_raise "playback failed because: #{res['reason']}\n#{res['details']}"
122
+ raise "playback failed because: #{res['reason']}\n#{res['details']}"
123
123
  end
124
124
  res['results']
125
125
  end
@@ -138,7 +138,7 @@ EOF
138
138
 
139
139
  res = JSON.parse(res)
140
140
  if res['outcome'] != 'SUCCESS'
141
- screenshot_and_raise "interpolate failed because: #{res['reason']}\n#{res['details']}"
141
+ raise "interpolate failed because: #{res['reason']}\n#{res['details']}"
142
142
  end
143
143
  res['results']
144
144
  end
@@ -9,7 +9,7 @@ module Calabash
9
9
  res = http({:method => :post, :path => 'uia'}, {command:command}.merge(options))
10
10
  res = JSON.parse(res)
11
11
  if res['outcome'] != 'SUCCESS'
12
- screenshot_and_raise "uia action failed because: #{res['reason']}\n#{res['details']}"
12
+ raise "uia action failed because: #{res['reason']}\n#{res['details']}"
13
13
  end
14
14
  res['results'].first
15
15
  end
@@ -123,7 +123,7 @@ module Calabash
123
123
  status = res['status']
124
124
  if status.eql?('error')
125
125
  value = res['value']
126
- screenshot_and_raise "could not type '#{string}' - '#{value}'"
126
+ raise "could not type '#{string}' - '#{value}'"
127
127
  end
128
128
  end
129
129
 
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = '0.9.163.pre10'
3
+ VERSION = '0.9.163.pre11'
4
4
  FRAMEWORK_VERSION = '0.9.163.pre10'
5
5
  end
6
6
  end
@@ -23,7 +23,7 @@ module Calabash
23
23
  :screenshot_on_error => true}, &block)
24
24
  #note Hash is preferred, number acceptable for backwards compat
25
25
  default_timeout = 30
26
- timeout=options_or_timeout || default_timeout
26
+ timeout = options_or_timeout || default_timeout
27
27
  post_timeout=0
28
28
  retry_frequency=0.3
29
29
  timeout_message = nil
@@ -65,7 +65,7 @@ module Calabash
65
65
  FileUtils.rm_f(path)
66
66
  return res
67
67
  else
68
- embed(path)
68
+ embed(path, 'image/png', msg)
69
69
  raise wait_error(msg)
70
70
  end
71
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.163.pre10
4
+ version: 0.9.163.pre11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2014-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber