calabash 1.9.9.pre1 → 1.9.9.pre2

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: 994996bafe7d310ab1068d4784c48fce9541c1c7
4
- data.tar.gz: 7d3918c947af930be40caea37dee45320d76a817
3
+ metadata.gz: 145d0607c951c97fed6b885c1c492cbd86a79da4
4
+ data.tar.gz: 561bec553b18f3f8b98346548dc7e21812470740
5
5
  SHA512:
6
- metadata.gz: 0041eda36898e5eca293981ff2fd6c6ee3ad609b9a1a55efe5b552c3e74857de1b8101acf7a6fedd3777d150f533c15b99782686ee042f63877250132c5b7dde
7
- data.tar.gz: db96e189f2cf24bc6543f85cd3e52856d09edf10ec3c1be8e5181df63dc9a2251e695bdaa58bc992c6897e565756a4b71d7092dc6ac91653a9e3833eeca007f5
6
+ metadata.gz: e51ffc4e81c0e7ad3b0fa6e1855b1d584003313d64fd0b91bab00ed429d2371a01712baa488b48ccdcfacc6fcbaa876dcd7bfe5bf8d001f09fc48268e869da53
7
+ data.tar.gz: 4563da016a43db69eac0ef6c5316121abe87c872488d82c1aab508c49567ec75ad43704faff5e3552a0e1fe52e0d7580f4b4691f08e1edfb538b7d7e83745b98
data/README.md CHANGED
@@ -28,10 +28,30 @@ $ be rake spec # All tests. Launches iOS Simulators, etc.
28
28
  $ be guard # Run unit tests as you develop.
29
29
  ```
30
30
 
31
- ### cucumber
31
+ ### Cucumber iOS
32
32
 
33
33
  ```
34
34
  $ cd cucumber/ios
35
35
  $ bundle update
36
+ $ rake ensure_app # Optional. See note below.
36
37
  $ be cucumber
37
38
  ```
39
+
40
+ The rake task `ensure_app` checks the `cucumber/ios` directory for
41
+ CalSmoke-cal.app. If it exists, it will do nothing. If it does not exist,
42
+ it will pull the latest sources from the CalSmoke repo, build the
43
+ CalSmoke-cal.app from the master branch, and install it in the
44
+ `cucumber/ios` directory.
45
+
46
+ If you want to use a different CalSmoke-cal.app, drop it into `cucumber/ios`
47
+ or call cucumber with `CAL\_APP` set.
48
+
49
+ ```
50
+ $ CAL_APP=/path/to/your/CalSmoke-cal.app be cucumber
51
+ ```
52
+
53
+ The rake task `ensure_ipa` does the same thing, but for the CalSmoke-cal.ipa.
54
+
55
+ Testing against physical devices requires that you have ideviceinstaller
56
+ installed in /usr/local/bin/ideviceinstaller.
57
+
data/bin/calabash CHANGED
@@ -68,7 +68,7 @@ module Calabash
68
68
  parse_resign_arguments!
69
69
  when 'console'
70
70
  parse_console_arguments!
71
- when 'gen'
71
+ when 'generate'
72
72
  parse_generate_arguments!
73
73
  when 'run'
74
74
  parse_run_arguments!
@@ -80,12 +80,16 @@ module Calabash
80
80
  if argument.nil?
81
81
  print_usage
82
82
  else
83
- print_usage_for(key_for_command(argument))
83
+ if key_for_command(argument)
84
+ print_usage_for(key_for_command(argument))
85
+ else
86
+ fail("No such command '#{argument}'")
87
+ end
84
88
  end
85
89
  when nil
86
90
  print_usage
87
91
  else
88
- fail("Invalid argument #{argument}.\n For help use 'calabash help'")
92
+ fail("Invalid command #{argument}.\n For help use 'calabash help'")
89
93
  end
90
94
  end
91
95
  end
data/lib/calabash.rb CHANGED
@@ -65,13 +65,13 @@ module Calabash
65
65
  # @param [Class] The page to instantiate
66
66
  # @return [Calabash::Page] An instance of the page class
67
67
  def page(page_class)
68
- platform_module = if Device.default.is_a?(Android::Device)
69
- Object.const_get(:Android)
70
- elsif Device.default.is_a?(IOS::Device)
71
- Object.const_get(:IOS)
72
- else
73
- raise 'Cannot detect running platform'
74
- end
68
+ if android?
69
+ platform_module = Object.const_get(:Android)
70
+ elsif ios?
71
+ platform_module = Object.const_get(:IOS)
72
+ else
73
+ raise 'Cannot detect running platform'
74
+ end
75
75
 
76
76
  unless page_class.is_a?(Class)
77
77
  raise ArgumentError, "Expected a 'Class', got '#{page_class.class}'"
@@ -98,6 +98,14 @@ module Calabash
98
98
  end
99
99
  end
100
100
 
101
+ def android?
102
+ Android.const_defined?(:Device) && Device.default.is_a?(Android::Device)
103
+ end
104
+
105
+ def ios?
106
+ IOS.const_defined?(:Device) && Device.default.is_a?(IOS::Device)
107
+ end
108
+
101
109
  def self.new_embed_method!(method)
102
110
  EmbeddingContext.new_embed_method(method)
103
111
  end
@@ -18,8 +18,10 @@ module Calabash
18
18
  Calabash.send(:included, base)
19
19
  end
20
20
 
21
- require 'calabash/android/environment'
21
+ require 'calabash/android/defaults'
22
+ extend Calabash::Android::Defaults
22
23
 
24
+ require 'calabash/android/environment'
23
25
  require 'calabash/android/application'
24
26
  require 'calabash/android/build'
25
27
  require 'calabash/android/device'
@@ -38,7 +38,8 @@ module Calabash
38
38
  end
39
39
 
40
40
  def self.visible?(data)
41
- data['visible'] || data['children'].map{|child| visible?(child)}.any?
41
+ (data['type'] != '[object Exception]' && data['visible']) ||
42
+ data['children'].map{|child| visible?(child)}.any?
42
43
  end
43
44
  end
44
45
  end
@@ -0,0 +1,21 @@
1
+ module Calabash
2
+ module Android
3
+ def self.setup_defaults!
4
+ setup_default_application!
5
+ setup_default_device!
6
+ end
7
+
8
+ def self.setup_default_application!
9
+ # Setup the default application
10
+ Calabash.default_application = Application.default_from_environment
11
+ end
12
+
13
+ def self.setup_default_device!
14
+ # Setup the default device
15
+ identifier = Device.default_serial
16
+ server = Server.default
17
+
18
+ Calabash.default_device = Device.new(identifier, server)
19
+ end
20
+ end
21
+ end
@@ -397,7 +397,13 @@ module Calabash
397
397
  end
398
398
 
399
399
  def self.read_attribute_from_monodroid_config(element, attribute)
400
- REXML::Document.new(IO.read(monodroid_config_file)).elements["//#{element}"].attributes[attribute]
400
+ element = REXML::Document.new(IO.read(monodroid_config_file)).elements["//#{element}"]
401
+
402
+ if element
403
+ element.attributes[attribute]
404
+ else
405
+ nil
406
+ end
401
407
  end
402
408
 
403
409
  def self.find_executable_on_path(executable)
@@ -38,12 +38,7 @@ begin
38
38
  extend Calabash::Android
39
39
  extend Calabash::ConsoleHelpers
40
40
 
41
- identifier = Calabash::Android::Device.default_serial
42
- server = Calabash::Android::Server.default
43
-
44
- Calabash::Android::Device.default = Calabash::Android::Device.new(identifier, server)
45
-
46
- Calabash::Application.default = Calabash::Android::Application.default_from_environment
41
+ Calabash::Android.setup_defaults!
47
42
 
48
43
  Calabash.new_embed_method!(lambda {|*_| Calabash::Logger.info 'Embed is not available in the console.'})
49
44
  Calabash::Screenshot.screenshot_directory_prefix = 'console_'
@@ -32,12 +32,18 @@ module Calabash
32
32
  Device.default.perform_action('clear_text')
33
33
  end
34
34
 
35
+ # @!visibility private
35
36
  def _clear_text_in(view)
36
37
  tap(view)
37
38
  sleep 0.5
38
39
  clear_text
39
40
  end
40
41
 
42
+ # @!visibility private
43
+ def _enter_text(text)
44
+ Device.default.enter_text(text)
45
+ end
46
+
41
47
  # @!visibility private
42
48
  def _enter_text_in(view, text)
43
49
  tap(view)
@@ -6,91 +6,57 @@ module Calabash
6
6
  # @!visibility private
7
7
  module Generate
8
8
  def parse_generate_arguments!
9
- type = @arguments.shift
10
-
11
- if type.nil?
12
- msg("Question") do
13
- puts "Calabash is about to create a subdirectory called features and config,"
14
- puts "features will contain all your calabash tests."
15
- puts "Please hit return to confirm that's what you want."
16
- end
17
-
18
- unless STDIN.gets.chomp == ''
19
- exit 2
20
- end
21
-
22
- if File.exist?('features')
23
- puts "A features directory already exists. Please remove this to continue."
24
- exit 1
25
- end
26
-
27
- if File.exist?('config')
28
- puts "A config directory already exists. Please remove this to continue."
29
- exit 1
30
- end
31
-
32
- reset_between = nil
33
- reset_method = nil
34
-
35
- puts "Do you want to reset the app by default? ((n)ever/between (s)cenarios/between (f)eatures) "
36
- input = STDIN.gets.chomp.downcase
37
-
38
- case input
39
- when 'n'
40
- reset_between = :never
41
- when 's'
42
- reset_between = :scenarios
43
- when 'f'
44
- reset_between = :features
45
- else
46
- puts "Invalid input '#{input}'"
47
- exit(3)
48
- end
49
-
50
- unless reset_between == :never
51
- puts "How would you like to reset the app by default? ((c)learing/(r)einstalling) "
52
- input = STDIN.gets.chomp.downcase
53
-
54
- case input
55
- when 'c'
56
- reset_method = :clear
57
- when 'r'
58
- reset_method = :reinstall
59
- else
60
- puts "Invalid input '#{input}'"
61
- exit(4)
62
- end
63
- end
64
-
65
- cucumber_config = File.read(file(File.join('config', 'cucumber.yml')))
66
-
67
- env = File.read(file(File.join('features', 'support', 'env.rb')))
68
- sample_feature = File.read(file(File.join('features', 'sample.feature')))
69
- calabash_steps = File.read(file(File.join('features', 'step_definitions', 'calabash_steps.rb')))
70
-
71
- hooks = File.read(file(File.join('features', 'support', 'hooks.rb')))
72
- hooks.sub!("#!DEFAULT_RESET_BETWEEN#!", ":#{reset_between}")
73
-
74
- if reset_method.nil?
75
- hooks.sub!("#!DEFAULT_RESET_METHOD#!", 'nil')
76
- else
77
- hooks.sub!("#!DEFAULT_RESET_METHOD#!", ":#{reset_method}")
78
- end
79
-
80
- FileUtils.mkdir('config')
81
-
82
- File.open(File.join('config', 'cucumber.yml'), 'w') {|file| file.write(cucumber_config) }
83
-
84
- FileUtils.mkdir('features')
85
- FileUtils.mkdir('features/step_definitions')
86
- FileUtils.mkdir('features/support')
87
-
88
- File.open(File.join('features', 'sample.feature'), 'w') {|file| file.write(sample_feature) }
89
- File.open(File.join('features', 'step_definitions', 'calabash_steps.rb'), 'w') {|file| file.write(calabash_steps) }
90
- File.open(File.join('features', 'support', 'hooks.rb'), 'w') {|file| file.write(hooks) }
91
- File.open(File.join('features', 'support', 'env.rb'), 'w') {|file| file.write(env) }
9
+ if File.exist?('features')
10
+ puts "A features directory already exists. Please remove this to continue."
11
+ exit 1
12
+ end
13
+
14
+ if File.exist?('config')
15
+ puts "A config directory already exists. Please remove this to continue."
16
+ exit 1
17
+ end
18
+
19
+ reset_between = :features
20
+ reset_method = :clear
21
+
22
+ cucumber_config = File.read(file(File.join('config', 'cucumber.yml')))
23
+
24
+ env = File.read(file(File.join('features', 'support', 'env.rb')))
25
+ sample_feature = File.read(file(File.join('features', 'sample.feature')))
26
+ calabash_steps = File.read(file(File.join('features', 'step_definitions', 'calabash_steps.rb')))
27
+
28
+ hooks = File.read(file(File.join('features', 'support', 'hooks.rb')))
29
+ hooks.sub!("#!DEFAULT_RESET_BETWEEN#!", ":#{reset_between}")
30
+
31
+ if reset_method.nil?
32
+ hooks.sub!("#!DEFAULT_RESET_METHOD#!", 'nil')
92
33
  else
93
- fail("Invalid argument #{type}", :gen)
34
+ hooks.sub!("#!DEFAULT_RESET_METHOD#!", ":#{reset_method}")
35
+ end
36
+
37
+ FileUtils.mkdir('config')
38
+
39
+ File.open(File.join('config', 'cucumber.yml'), 'w') {|file| file.write(cucumber_config) }
40
+
41
+ FileUtils.mkdir('features')
42
+ FileUtils.mkdir('features/step_definitions')
43
+ FileUtils.mkdir('features/support')
44
+
45
+ File.open(File.join('features', 'sample.feature'), 'w') {|file| file.write(sample_feature) }
46
+ File.open(File.join('features', 'step_definitions', 'calabash_steps.rb'), 'w') {|file| file.write(calabash_steps) }
47
+ File.open(File.join('features', 'support', 'hooks.rb'), 'w') {|file| file.write(hooks) }
48
+ File.open(File.join('features', 'support', 'env.rb'), 'w') {|file| file.write(env) }
49
+
50
+ gemfile = File.read(file(File.join('Gemfile')))
51
+
52
+ unless File.exist?('Gemfile')
53
+ File.open('Gemfile', 'w') {|file| file.write(gemfile) }
54
+ end
55
+
56
+ gitignore = File.read(file(File.join('.gitignore')))
57
+
58
+ unless File.exist?('.gitignore')
59
+ File.open('.gitignore', 'w') {|file| file.write(gitignore) }
94
60
  end
95
61
  end
96
62
 
@@ -5,7 +5,7 @@ module Calabash
5
5
  module Helpers
6
6
  HELP = {
7
7
  help: 'help',
8
- gen: 'gen',
8
+ generate: 'generate',
9
9
  run: 'run [application] [cucumber options]',
10
10
  console: 'console [application]',
11
11
  version: 'version',
@@ -27,7 +27,7 @@ module Calabash
27
27
  def print_usage_for(key, output=STDOUT)
28
28
  if key.nil? || HELP[key].nil?
29
29
  output.write <<EOF
30
- No such command '#{command}'
30
+ No such command '#{key}'
31
31
  EOF
32
32
  else
33
33
  output.write <<EOF
@@ -44,8 +44,8 @@ EOF
44
44
  #{HELP[:help]} [command]
45
45
  print help information.
46
46
 
47
- #{HELP[:gen]}
48
- generate a features folder structure.
47
+ #{HELP[:generate]}
48
+ generate a Cucumber project folder structure.
49
49
 
50
50
  #{HELP[:run]}
51
51
  runs Cucumber in the current folder with the environment needed.
@@ -33,12 +33,27 @@ module Calabash
33
33
  true
34
34
  end
35
35
 
36
+ def clear
37
+ ConsoleHelpers.clear
38
+ true
39
+ end
40
+
36
41
  def self.copy
37
42
  commands = filter_commands(current_console_history)
38
43
  string = commands.join($INPUT_RECORD_SEPARATOR)
39
44
  Clipboard.copy(string)
40
45
  end
41
46
 
47
+ def self.clear
48
+ if Gem.win_platform?
49
+ system('cls')
50
+ else
51
+ system('clear')
52
+ end
53
+
54
+ @@start_readline_history = readline_history
55
+ end
56
+
42
57
  def self.current_console_history
43
58
  length = readline_history.length - @@start_readline_history.length
44
59
 
data/lib/calabash/ios.rb CHANGED
@@ -14,6 +14,9 @@ module Calabash
14
14
  Calabash.send(:included, base)
15
15
  end
16
16
 
17
+ require 'calabash/ios/defaults'
18
+ extend Calabash::IOS::Defaults
19
+
17
20
  require 'calabash/ios/environment'
18
21
  require 'calabash/ios/application'
19
22
  require 'calabash/ios/device'
@@ -25,6 +28,7 @@ module Calabash
25
28
  require 'calabash/ios/console_helpers'
26
29
  require 'calabash/ios/uia'
27
30
  require 'calabash/ios/scroll'
31
+ require 'calabash/ios/runtime'
28
32
 
29
33
  include Calabash::IOS::Conditions
30
34
  include Calabash::IOS::Orientation
@@ -32,6 +36,7 @@ module Calabash
32
36
  include Calabash::IOS::Text
33
37
  include Calabash::IOS::UIA
34
38
  include Calabash::IOS::Scroll
39
+ include Calabash::IOS::Runtime
35
40
 
36
41
  end
37
42
  end
@@ -0,0 +1,27 @@
1
+ module Calabash
2
+ module IOS
3
+ def self.setup_defaults!
4
+ setup_default_application!
5
+ setup_default_device!
6
+ end
7
+
8
+ def self.setup_default_device!
9
+ if Calabash.default_application.nil?
10
+ raise 'Cannot setup default device for iOS, as no default Application has been set'
11
+ end
12
+
13
+ # Setup the default device
14
+ identifier =
15
+ Device.default_identifier_for_application(Calabash.default_application)
16
+
17
+ server = Server.default
18
+
19
+ Calabash.default_device = Device.new(identifier, server)
20
+ end
21
+
22
+ def self.setup_default_application!
23
+ # Setup the default application
24
+ Calabash.default_application = Application.default_from_environment
25
+ end
26
+ end
27
+ end
@@ -84,14 +84,6 @@ module Calabash
84
84
  # `Device.default.simulator? && !Device.ios6?`, but I haven't checked on
85
85
  # iOS 9 yet, so I will leave the condition out.
86
86
  def _pan(query, from, to, options={})
87
- if Device.default.simulator?
88
- message = [
89
- "Apple's UIAutomation `dragInsideWithOptions` API is broken for iOS > 7",
90
- 'If you are trying to scroll on a UITableView or UICollectionView, try using the scroll_* methods'
91
- ].join("\n")
92
-
93
- raise message
94
- end
95
87
 
96
88
  begin
97
89
  _expect_valid_duration(options)
@@ -99,7 +91,33 @@ module Calabash
99
91
  raise ArgumentError e
100
92
  end
101
93
 
102
- view_to_pan = _gesture_waiter.wait_for_view(query, options)
94
+ gesture_waiter = _gesture_waiter
95
+ view_to_pan = gesture_waiter.wait_for_view(query, options)
96
+
97
+ if Device.default.simulator?
98
+
99
+ should_raise = false
100
+
101
+ content_offset = gesture_waiter.query(query, :contentOffset).first
102
+
103
+ if content_offset != '*****'
104
+ # Panning on anything with a content offset is broken.
105
+ should_raise = true
106
+ else
107
+ # TODO: Identify other conditions
108
+ # TODO: Can we detect UITableViewCells?
109
+ # The gist is that if the view is a UIScrollView or in a UIScrollView
110
+ # dragInsideWithOptions does not work
111
+ end
112
+
113
+ if should_raise
114
+ message = [
115
+ "Apple's public UIAutomation API `dragInsideWithOptions` is broken for iOS Simulators >= 7",
116
+ 'Try using the scroll_* methods or test on a device.'
117
+ ].join("\n")
118
+ raise message
119
+ end
120
+ end
103
121
 
104
122
  rect = view_to_pan['rect']
105
123
 
@@ -38,12 +38,7 @@ begin
38
38
  extend Calabash::IOS
39
39
  extend Calabash::ConsoleHelpers
40
40
 
41
- Calabash::Application.default = Calabash::IOS::Application.default_from_environment
42
-
43
- identifier = Calabash::IOS::Device.default_identifier_for_application(Calabash::Application.default)
44
- server = Calabash::IOS::Server.default
45
-
46
- Calabash::Device.default = Calabash::IOS::Device.new(identifier, server)
41
+ Calabash::IOS.setup_defaults!
47
42
 
48
43
  Calabash.new_embed_method!(lambda {|*_| Calabash::Logger.info 'Embed is not available in the console.'})
49
44
  Calabash::Screenshot.screenshot_directory_prefix = 'console_'
@@ -0,0 +1,15 @@
1
+ module Calabash
2
+ module IOS
3
+ module Runtime
4
+
5
+ # @todo Complete and document the Runtime API
6
+ def simulator?
7
+ Calabash::IOS::Device.default.simulator?
8
+ end
9
+
10
+ def physical_device?
11
+ Calabash::IOS::Device.default.physical_device?
12
+ end
13
+ end
14
+ end
15
+ end
@@ -77,6 +77,8 @@ module Calabash
77
77
  fail("Expected '#{query}' to match a UIScrollView or a subclass")
78
78
  end
79
79
 
80
+ wait_for_animations_in(query)
81
+
80
82
  Calabash::QueryResult.create([view_to_scroll], query)
81
83
  end
82
84
 
@@ -163,6 +165,8 @@ module Calabash
163
165
  fail(message)
164
166
  end
165
167
 
168
+ wait_for_animations_in(query)
169
+
166
170
  Calabash::QueryResult.create([view_to_scroll], query)
167
171
  end
168
172
 
@@ -248,6 +252,8 @@ module Calabash
248
252
  fail(message)
249
253
  end
250
254
 
255
+ wait_for_animations_in(query)
256
+
251
257
  Calabash::QueryResult.create([view_to_scroll], query)
252
258
  end
253
259
 
@@ -340,6 +346,8 @@ module Calabash
340
346
  fail(message)
341
347
  end
342
348
 
349
+ wait_for_animations_in(query)
350
+
343
351
  Calabash::QueryResult.create([view_to_scroll], query)
344
352
  end
345
353
 
@@ -432,6 +440,8 @@ module Calabash
432
440
  fail(message)
433
441
  end
434
442
 
443
+ wait_for_animations_in(query)
444
+
435
445
  Calabash::QueryResult.create([view_to_scroll], query)
436
446
  end
437
447
 
@@ -2,7 +2,7 @@ module Calabash
2
2
  module IOS
3
3
  module Text
4
4
  # @!visibility private
5
- def enter_text(text)
5
+ def _enter_text(text)
6
6
  wait_for_keyboard
7
7
  existing_text = text_from_keyboard_first_responder
8
8
  options = { existing_text: existing_text }
@@ -2,5 +2,5 @@
2
2
  ##YAML Template
3
3
  ---
4
4
  # Platform
5
- android: PLATFORM=android -r features/support -r features/android -r features/step_definitions
6
- ios: PLATFORM=ios -r features/support -r features/ios -r features/step_definitions
5
+ android: PLATFORM=android -r features
6
+ ios: PLATFORM=ios -r features
@@ -1,6 +1,6 @@
1
1
  require 'calabash'
2
2
 
3
- platform = Calabash::Environment.variable('PLATFORM')
3
+ platform = ENV['PLATFORM']
4
4
 
5
5
  case platform
6
6
  when 'android'
@@ -8,33 +8,13 @@ case platform
8
8
 
9
9
  World(Calabash::Android)
10
10
 
11
- # Setup the default application
12
- Calabash::Application.default =
13
- Calabash::Android::Application.default_from_environment
14
-
15
- identifier = Calabash::Android::Device.default_serial
16
- server = Calabash::Android::Server.default
17
-
18
- # Setup the default device
19
- Calabash::Device.default =
20
- Calabash::Android::Device.new(identifier, server)
11
+ Calabash::Android.setup_defaults!
21
12
  when 'ios'
22
13
  require 'calabash/ios'
23
14
 
24
15
  World(Calabash::IOS)
25
16
 
26
- # Setup the default application
27
- Calabash::Application.default =
28
- Calabash::IOS::Application.default_from_environment
29
-
30
- identifier =
31
- Calabash::IOS::Device.default_identifier_for_application(Calabash::Application.default)
32
-
33
- server = Calabash::IOS::Server.default
34
-
35
- # Setup the default device
36
- Calabash::Device.default =
37
- Calabash::IOS::Device.new(identifier, server)
17
+ Calabash::IOS.setup_defaults!
38
18
  else
39
19
  message = if platform.nil? || platform.empty?
40
20
  'No platform given'
@@ -23,8 +23,8 @@ module AppLifeCycle
23
23
  include Calabash
24
24
  end
25
25
 
26
- DEFAULT_RESET_BETWEEN = #!DEFAULT_RESET_BETWEEN#! # Filled in by calabash gen
27
- DEFAULT_RESET_METHOD = #!DEFAULT_RESET_METHOD#! # Filled in by calabash gen
26
+ DEFAULT_RESET_BETWEEN = #!DEFAULT_RESET_BETWEEN#! # Filled in by calabash generate
27
+ DEFAULT_RESET_METHOD = #!DEFAULT_RESET_METHOD#! # Filled in by calabash generate
28
28
 
29
29
  RESET_BETWEEN = if Calabash::Environment.variable('RESET_BETWEEN')
30
30
  Calabash::Environment.variable('RESET_BETWEEN').downcase.to_sym
data/lib/calabash/page.rb CHANGED
@@ -24,8 +24,8 @@ module Calabash
24
24
  raise 'Implement your own trait'
25
25
  end
26
26
 
27
- def await(timeout = nil)
28
- wait_for_view(trait, timeout: timeout)
27
+ def await(options={})
28
+ wait_for_view(trait, options)
29
29
  end
30
30
 
31
31
  class StubPage
@@ -76,6 +76,13 @@ module Calabash
76
76
  raise 'Cannot use both marked and id/text'
77
77
  end
78
78
 
79
+ unknown = hash.keys - [:class, :marked, :id, :text, :index, :css, :xpath]
80
+
81
+ if unknown.length > 0
82
+ raise ArgumentError,
83
+ "Unknown query keys: #{unknown.join(', ')}"
84
+ end
85
+
79
86
  if hash[:marked]
80
87
  result = "#{result} marked:'#{Text.escape_single_quotes(hash[:marked])}'"
81
88
  end
@@ -156,5 +163,16 @@ module Calabash
156
163
  raise ArgumentError, "invalid query '#{query}' (#{query.class})"
157
164
  end
158
165
  end
166
+
167
+ private
168
+
169
+ # @!visibility private
170
+ def formatted_as_string
171
+ if @query.is_a?(Query)
172
+ @query.send(:formatted_as_string)
173
+ else
174
+ @query.to_s
175
+ end
176
+ end
159
177
  end
160
178
  end
data/lib/calabash/text.rb CHANGED
@@ -7,7 +7,7 @@ module Calabash
7
7
  # @param [String] text The text to type.
8
8
  # @raise [RuntimeError] if the text cannot be typed.
9
9
  def enter_text(text)
10
- Device.default.enter_text(text)
10
+ _enter_text(text.to_s)
11
11
  end
12
12
 
13
13
  # Enter `text` into `query`.
@@ -48,6 +48,11 @@ module Calabash
48
48
  Text.escape_single_quotes(string)
49
49
  end
50
50
 
51
+ # @!visibility private
52
+ def _enter_text(text)
53
+ abstract_method!
54
+ end
55
+
51
56
  # @!visibility private
52
57
  def _enter_text_in(view, text)
53
58
  abstract_method!
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
 
3
3
  # @!visibility private
4
- VERSION = '1.9.9.pre1'
4
+ VERSION = '1.9.9.pre2'
5
5
  end
data/lib/calabash/wait.rb CHANGED
@@ -440,8 +440,11 @@ module Calabash
440
440
 
441
441
  # @!visibility private
442
442
  def parse_query_list(queries)
443
- queries = [queries] unless queries.is_a?(Array)
444
- queries_dup = queries.map{|query| "\"#{query}\""}
443
+ unless queries.is_a?(Array)
444
+ queries = [queries]
445
+ end
446
+
447
+ queries_dup = queries.map{|query| "\"#{Query.new(query).send(:formatted_as_string)}\""}
445
448
 
446
449
  if queries_dup.length == 0
447
450
  ''
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.9.pre1
4
+ version: 1.9.9.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-07-29 00:00:00.000000000 Z
14
+ date: 2015-07-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: edn
@@ -380,6 +380,7 @@ files:
380
380
  - lib/calabash/android/build.rb
381
381
  - lib/calabash/android/console_helpers.rb
382
382
  - lib/calabash/android/cucumber.rb
383
+ - lib/calabash/android/defaults.rb
383
384
  - lib/calabash/android/device.rb
384
385
  - lib/calabash/android/environment.rb
385
386
  - lib/calabash/android/gestures.rb
@@ -415,6 +416,7 @@ files:
415
416
  - lib/calabash/ios/application.rb
416
417
  - lib/calabash/ios/conditions.rb
417
418
  - lib/calabash/ios/console_helpers.rb
419
+ - lib/calabash/ios/defaults.rb
418
420
  - lib/calabash/ios/device/device_implementation.rb
419
421
  - lib/calabash/ios/device/gestures_mixin.rb
420
422
  - lib/calabash/ios/device/keyboard_mixin.rb
@@ -437,6 +439,7 @@ files:
437
439
  - lib/calabash/ios/environment.rb
438
440
  - lib/calabash/ios/interactions.rb
439
441
  - lib/calabash/ios/orientation.rb
442
+ - lib/calabash/ios/runtime.rb
440
443
  - lib/calabash/ios/scroll.rb
441
444
  - lib/calabash/ios/server.rb
442
445
  - lib/calabash/ios/text.rb