calabash-cucumber 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41d103959b49c4411bcc0583fe986cc3acd06542
4
- data.tar.gz: d7dd688264cf2a1d130b78f167bd97a95222988a
3
+ metadata.gz: 1bd0df04cec74d782b40e63d60e408db81c21cdb
4
+ data.tar.gz: 34502d517be61ca09306bafbeb04ed44f4de6004
5
5
  SHA512:
6
- metadata.gz: 9e7e0ad4833aa4d21c6845cdad2bfce13965e5176796246efd3b621d7e46e61640aafbceeebdf3ffbd31cb15720c2a4e61ee24ba1500c6bf9e8195713fa0574b
7
- data.tar.gz: ecb3d00cc9390fee76e2d55530cdc43014fe6ed5e07ac044edd3a72d8c6b395624044a1fdf4839cd5138297b3ecae06d2c870a86e31fcbf0571d7346379990b2
6
+ metadata.gz: bbf7c5b7f7fb04d0e961a6088986a93caccd0a6aab0f631ee7737d23b90e21faec764762d796ee00b90308d93b4e0bc841c7ae314fbac7184eaf4caa62720272
7
+ data.tar.gz: 26c232af033ce6c182e8c881b950e2e6fc01b24000a427ee3401feda745254d71c4c6501f47369c56ad4a05ddc62b83155cb8a207a3afb6e90db53ea8589673f
Binary file
Binary file
@@ -1081,11 +1081,16 @@ module Calabash
1081
1081
  #
1082
1082
  # to connect to the current launcher
1083
1083
  #
1084
+ # @param [Symbol] uia_strategy Optionally specify the uia strategy, which
1085
+ # can be one of :shared_element, :preferences, :host. If you don't
1086
+ # know which to choose, don't specify one and calabash will try deduce
1087
+ # the correct strategy to use based on the environment variables used
1088
+ # when starting the console.
1084
1089
  # @return [Calabash::Cucumber::Launcher,nil] the currently active
1085
1090
  # calabash launcher
1086
- def console_attach
1091
+ def console_attach(uia_strategy = nil)
1087
1092
  # setting the @calabash_launcher here for backward compatibility
1088
- @calabash_launcher = launcher.attach
1093
+ @calabash_launcher = launcher.attach({:uia_strategy => uia_strategy})
1089
1094
  end
1090
1095
 
1091
1096
  # @!visibility private
@@ -96,12 +96,33 @@ class Calabash::Cucumber::Launcher
96
96
  end
97
97
 
98
98
  # @see Calabash::Cucumber::Core#console_attach
99
- def attach(max_retry=1, timeout=10)
99
+ def attach(options={})
100
+ default_options = {:max_retry => 1,
101
+ :timeout => 10,
102
+ :uia_strategy => nil}
103
+ merged_options = default_options.merge(options)
104
+
100
105
  if calabash_no_launch?
101
106
  self.actions= Calabash::Cucumber::PlaybackActions.new
102
107
  return
103
108
  end
104
109
 
110
+ # :host is is a special case and requires reading information from a cache.
111
+ strategy_from_options = merged_options[:uia_strategy]
112
+ if strategy_from_options == :host
113
+ self.run_loop = RunLoop::HostCache.default.read
114
+ return self
115
+ end
116
+
117
+ # Sets the device attribute.
118
+ ensure_connectivity(merged_options[:max_retry], merged_options[:timeout])
119
+
120
+ # The default strategy for iOS 8 devices is :host.
121
+ if strategy_from_options.nil? && self.device.ios_major_version > '8'
122
+ self.run_loop = RunLoop::HostCache.default.read
123
+ return self
124
+ end
125
+
105
126
  pids_str = `ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`
106
127
  pids = pids_str.split(',').map { |pid| pid.to_i }
107
128
  pid = pids.first
@@ -113,17 +134,10 @@ class Calabash::Cucumber::Launcher
113
134
  self.actions= Calabash::Cucumber::PlaybackActions.new
114
135
  end
115
136
 
116
- # Sets the device attribute.
117
- ensure_connectivity(max_retry, timeout)
118
-
119
- if self.device.simulator?
120
- run_loop[:uia_strategy] = :preferences
137
+ if strategy_from_options
138
+ run_loop[:uia_strategy] = merged_options[:uia_strategy]
121
139
  else
122
- if self.device.ios_major_version < '8'
123
- run_loop[:uia_strategy] = :preferences
124
- else
125
- run_loop[:uia_strategy] = :host
126
- end
140
+ run_loop[:uia_strategy] = :preferences
127
141
  end
128
142
 
129
143
  self.run_loop = run_loop
@@ -131,8 +145,8 @@ class Calabash::Cucumber::Launcher
131
145
  if major.to_i >= 7 && self.actions.is_a?(Calabash::Cucumber::PlaybackActions)
132
146
  puts "\n\n WARNING \n\n"
133
147
  puts 'Warning Trying to connect to simulator that was not launched by Calabash/instruments.'
134
- puts 'To fix this you must let Calabash or instruments launch the app'
135
- puts 'Continuing... query et al will work.'
148
+ puts 'To fix this you must let Calabash or instruments launch the app.'
149
+ puts 'Query will work, but gestures will not.'
136
150
  puts "\n\n WARNING \n\n"
137
151
  puts 'Please read: https://github.com/calabash/calabash-ios/wiki/A0-UIAutomation---instruments-problems'
138
152
  end
@@ -649,6 +663,10 @@ class Calabash::Cucumber::Launcher
649
663
  break
650
664
  end
651
665
  end
666
+
667
+ # -1 for manipulating the launch_args in this method!
668
+ # This work should not be done here!
669
+ # @todo Do not modify launch_args in default_uia_strategy method
652
670
  if target_device.nil?
653
671
  target_device = devices_connected.first
654
672
  if target_device
@@ -15,7 +15,7 @@ module Calabash
15
15
  rotate_right_home_down rotate_right_home_left rotate_right_home_right rotate_right_home_up)
16
16
  end
17
17
 
18
- # Rotates the home button position to the position indicated by `dir`.
18
+ # Rotates the home button to a position relative to the status bar.
19
19
  #
20
20
  # @example portrait
21
21
  # rotate_home_button_to :down
@@ -47,10 +47,11 @@ module Calabash
47
47
  # @param [Symbol] dir The position of the home button after the rotation.
48
48
  # Can be one of `{:down | :left | :right | :up }`.
49
49
  #
50
- # @return [Symbol] The orientation of the button when all rotations have
51
- # been completed. If there is problem rotating, this method will return
52
- # `:down` regardless of the actual home button position.
50
+ # @note A rotation will only occur if your view controller and application
51
+ # support the target orientation.
53
52
  #
53
+ # @return [Symbol] The position of the home button relative to the status
54
+ # bar when all rotations have been completed.
54
55
  def rotate_home_button_to(dir)
55
56
  dir_sym = dir.to_sym
56
57
  if dir_sym.eql?(:top)
@@ -15,11 +15,7 @@ module Calabash
15
15
  # use `status_bar_orientation` whenever possible.
16
16
  #
17
17
  # @note Devices that are lying on a flat surface will report their
18
- # orientation as 'face up' or 'face down'. In order to translate
19
- # gestures based on orientation, Calabash must have left, right, up, or
20
- # down orientation. To that end, if a device is lying flat, this method
21
- # will ***force*** a down orientation. This will happen regardless of
22
- # the value of the `force_down` optional argument.
18
+ # orientation as 'face up' or 'face down'.
23
19
  #
24
20
  # @see #status_bar_orientation
25
21
  # @see Calabash::Cucumber::RotationHelpers#rotate_home_button_to
@@ -80,4 +76,4 @@ module Calabash
80
76
 
81
77
  end
82
78
  end
83
- end
79
+ end
@@ -66,16 +66,40 @@ module Calabash
66
66
  def uia_wait_tap(query, options={})
67
67
  launcher = Calabash::Cucumber::Launcher.launcher_if_used
68
68
  run_loop = launcher && launcher.active? && launcher.run_loop
69
- raise ArgumentError, 'the current launcher must be active and be attached to a run_loop' unless run_loop
70
- raise ArgumentError, 'please supply :command' unless command
69
+
70
+ unless run_loop
71
+ raise 'The current launcher must be active and be attached to a run_loop'
72
+ end
73
+
74
+ unless query
75
+ raise ArgumentError, "Expected a query argument but got '#{query}'"
76
+ end
71
77
 
72
78
  strategy = run_loop[:uia_strategy]
73
- path = (strategy == :preferences ? 'uia-tap' : 'uia-tap-shared')
79
+
80
+ case strategy
81
+ when :preferences
82
+ path = 'uia-tap'
83
+ when :shared_element
84
+ path = 'uia-tap-shared'
85
+ when :host
86
+ lines = ['wait_tap is not supported when using the :host strategy',
87
+ 'Please see:',
88
+ '',
89
+ 'https://github.com/calabash/calabash-ios/issues/675',
90
+ '',
91
+ 'for details and workarounds'
92
+ ]
93
+
94
+ raise lines.join("\n")
95
+ else
96
+ raise "Unknown UIA strategy '#{strategy}'; expected {:host | :preferences | :shared_element}"
97
+ end
74
98
 
75
99
  res = http({:method => :post, :path => path}, {:query => query}.merge(options))
76
100
  res = JSON.parse(res)
77
101
  if res['outcome'] != 'SUCCESS'
78
- raise "uia-tap action failed because: #{res['reason']}\n#{res['details']}"
102
+ raise "wait-uia-tap action failed because: #{res['reason']}\n#{res['details']}"
79
103
  end
80
104
  res['results']
81
105
  end
@@ -3,7 +3,7 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = '0.12.0'
6
+ VERSION = '0.12.1'
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the calabash.framework or, for Xamarin
Binary file
Binary file
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.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-07 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -126,16 +126,22 @@ dependencies:
126
126
  name: httpclient
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.3.2
132
+ - - "<"
130
133
  - !ruby/object:Gem::Version
131
- version: 2.3.3
134
+ version: '3.0'
132
135
  type: :runtime
133
136
  prerelease: false
134
137
  version_requirements: !ruby/object:Gem::Requirement
135
138
  requirements:
136
- - - "~>"
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 2.3.2
142
+ - - "<"
137
143
  - !ruby/object:Gem::Version
138
- version: 2.3.3
144
+ version: '3.0'
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: bundler
141
147
  requirement: !ruby/object:Gem::Requirement
@@ -156,28 +162,28 @@ dependencies:
156
162
  requirements:
157
163
  - - "~>"
158
164
  - !ruby/object:Gem::Version
159
- version: 1.2.0
165
+ version: '1.6'
160
166
  type: :runtime
161
167
  prerelease: false
162
168
  version_requirements: !ruby/object:Gem::Requirement
163
169
  requirements:
164
170
  - - "~>"
165
171
  - !ruby/object:Gem::Version
166
- version: 1.2.0
172
+ version: '1.6'
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: run_loop
169
175
  requirement: !ruby/object:Gem::Requirement
170
176
  requirements:
171
177
  - - "~>"
172
178
  - !ruby/object:Gem::Version
173
- version: 1.2.0
179
+ version: 1.2.3
174
180
  type: :runtime
175
181
  prerelease: false
176
182
  version_requirements: !ruby/object:Gem::Requirement
177
183
  requirements:
178
184
  - - "~>"
179
185
  - !ruby/object:Gem::Version
180
- version: 1.2.0
186
+ version: 1.2.3
181
187
  - !ruby/object:Gem::Dependency
182
188
  name: rake
183
189
  requirement: !ruby/object:Gem::Requirement