calabash 2.0.0.pre10 → 2.0.0.pre11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -17
  3. data/bin/calabash +3 -4
  4. data/lib/calabash.rb +53 -10
  5. data/lib/calabash/android.rb +89 -28
  6. data/lib/calabash/android/adb.rb +32 -20
  7. data/lib/calabash/android/application.rb +1 -1
  8. data/lib/calabash/android/build/builder.rb +1 -1
  9. data/lib/calabash/android/build/java_keystore.rb +1 -1
  10. data/lib/calabash/android/build/resigner.rb +1 -1
  11. data/lib/calabash/android/device.rb +22 -66
  12. data/lib/calabash/android/device/helper_application.rb +95 -0
  13. data/lib/calabash/android/environment.rb +14 -1
  14. data/lib/calabash/android/gestures.rb +6 -22
  15. data/lib/calabash/android/interactions.rb +14 -17
  16. data/lib/calabash/android/lib/.irbrc +9 -1
  17. data/lib/calabash/android/lib/AndroidManifest.xml +23 -2
  18. data/lib/calabash/android/lib/HelperApplication.apk +0 -0
  19. data/lib/calabash/android/lib/HelperApplicationTestServer.apk +0 -0
  20. data/lib/calabash/android/lib/TestServer.apk +0 -0
  21. data/lib/calabash/android/life_cycle.rb +3 -3
  22. data/lib/calabash/android/orientation.rb +8 -8
  23. data/lib/calabash/android/physical_buttons.rb +19 -16
  24. data/lib/calabash/android/server.rb +1 -1
  25. data/lib/calabash/android/text.rb +12 -12
  26. data/lib/calabash/android/web.rb +12 -0
  27. data/lib/calabash/application.rb +3 -0
  28. data/lib/calabash/cli/generate.rb +8 -18
  29. data/lib/calabash/cli/helpers.rb +4 -9
  30. data/lib/calabash/cli/run.rb +1 -1
  31. data/lib/calabash/console_helpers.rb +179 -11
  32. data/lib/calabash/device.rb +4 -19
  33. data/lib/calabash/gestures.rb +292 -198
  34. data/lib/calabash/interactions.rb +3 -40
  35. data/lib/calabash/internal.rb +48 -0
  36. data/lib/calabash/ios.rb +76 -16
  37. data/lib/calabash/ios/automator.rb +9 -0
  38. data/lib/calabash/ios/automator/automator.rb +217 -0
  39. data/lib/calabash/ios/automator/coordinates.rb +37 -0
  40. data/lib/calabash/ios/automator/device_agent.rb +379 -0
  41. data/lib/calabash/ios/conditions.rb +1 -1
  42. data/lib/calabash/ios/console_helpers.rb +2 -2
  43. data/lib/calabash/ios/date_picker.rb +10 -8
  44. data/lib/calabash/ios/device.rb +0 -1
  45. data/lib/calabash/ios/device/device_implementation.rb +9 -21
  46. data/lib/calabash/ios/device/gestures_mixin.rb +53 -55
  47. data/lib/calabash/ios/device/keyboard_mixin.rb +21 -0
  48. data/lib/calabash/ios/device/rotation_mixin.rb +3 -65
  49. data/lib/calabash/ios/gestures.rb +24 -90
  50. data/lib/calabash/ios/interactions.rb +1 -6
  51. data/lib/calabash/ios/lib/.irbrc +9 -2
  52. data/lib/calabash/ios/orientation.rb +8 -8
  53. data/lib/calabash/ios/runtime.rb +14 -14
  54. data/lib/calabash/ios/scroll.rb +25 -17
  55. data/lib/calabash/ios/slider.rb +11 -18
  56. data/lib/calabash/ios/text.rb +20 -74
  57. data/lib/calabash/ios/uia.rb +1 -1
  58. data/lib/calabash/ios/web.rb +10 -0
  59. data/lib/calabash/lib/skeleton/{Gemfile → Gemfile.skeleton} +0 -0
  60. data/lib/calabash/lib/skeleton/config/{cucumber.yml → cucumber.yml.skeleton} +0 -0
  61. data/lib/calabash/lib/skeleton/features/{sample.feature → sample.feature.skeleton} +0 -0
  62. data/lib/calabash/lib/skeleton/features/step_definitions/{calabash_steps.rb → sample_steps.rb.skeleton} +8 -8
  63. data/lib/calabash/lib/skeleton/features/support/{dry_run.rb → dry_run.rb.skeleton} +2 -5
  64. data/lib/calabash/lib/skeleton/features/support/{env.rb → env.rb.skeleton} +2 -8
  65. data/lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton +34 -0
  66. data/lib/calabash/life_cycle.rb +16 -8
  67. data/lib/calabash/location.rb +14 -15
  68. data/lib/calabash/orientation.rb +8 -8
  69. data/lib/calabash/page.rb +1 -4
  70. data/lib/calabash/retry.rb +33 -0
  71. data/lib/calabash/screenshot.rb +3 -3
  72. data/lib/calabash/stubs.rb +21 -0
  73. data/lib/calabash/text.rb +31 -19
  74. data/lib/calabash/utility.rb +41 -8
  75. data/lib/calabash/version.rb +1 -1
  76. data/lib/calabash/wait.rb +177 -192
  77. data/lib/calabash/web.rb +44 -0
  78. metadata +39 -32
  79. data/lib/calabash/ios/device/text_mixin.rb +0 -21
  80. data/lib/calabash/lib/skeleton/features/support/hooks.rb +0 -83
@@ -17,7 +17,7 @@ module Calabash
17
17
  # uia("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Delete']")
18
18
  # uia("UIATarget.localTarget().frontMostApp().mainWindow().elements()")
19
19
  def uia(script)
20
- Device.default.evaluate_uia(script)
20
+ Calabash::Internal.with_default_device(required_os: :ios) {|device| device.evaluate_uia(script)}
21
21
  end
22
22
 
23
23
  # Evaluates `script` after prefixing with "UIATarget.localTarget()"
@@ -0,0 +1,10 @@
1
+ module Calabash
2
+ module IOS
3
+ module Web
4
+ # @!visibility private
5
+ define_method(:_evaluate_javascript_in) do |query, javascript|
6
+ query(query, calabashStringByEvaluatingJavaScript: javascript)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
1
  Given(/^I have done a specific thing$/) do
2
2
  # Sample step definition
3
3
  # Example: (Given I am logged in)
4
- # enter_text("* marked:'username'", USERNAME)
5
- # enter_text("* marked:'password'", PASSWORD)
6
- # touch("* marked:'login'")
7
- # wait_for_view("* text:'Welcome #{USERNAME}'")
4
+ # cal.enter_text({marked: 'username'}, USERNAME)
5
+ # cal.enter_text({marked: 'password'}, PASSWORD)
6
+ # cal.tap({marked: 'login'}")
7
+ # cal.wait_for_view("* text:'Welcome #{USERNAME}'")
8
8
 
9
9
  # Remember: any Ruby is allowed in your step definitions
10
10
  did_something = true
@@ -17,13 +17,13 @@ end
17
17
  When(/^I do something$/) do
18
18
  # Sample step definition
19
19
  # Example: When I create a new entry
20
- # touch("* marked:'new_entry'")
21
- # enter_text("* marked:'entry_title'", 'My Entry')
22
- # touch("* marked:'submit'")
20
+ # cal.tap({marked:'new_entry'})
21
+ # cal.enter_text({marked: 'entry_title'}, 'My Entry')
22
+ # cal.tap({marked: 'submit'})
23
23
  end
24
24
 
25
25
  Then(/^something should happen$/) do
26
26
  # Sample step definition
27
27
  # Example: Then I should see the entry on my home page
28
- # wait_for_view("* text:'My Entry'")
28
+ # cal.wait_for_view({text: 'My Entry'})
29
29
  end
@@ -1,8 +1,5 @@
1
1
  # Cucumber does not load env.rb when running a dry-run. As the pages inherit
2
2
  # from Calabash::Page and assert that the scopes IOS and Android are defined,
3
- # we should require calabash.
3
+ # we should require calabash stubs, which are empty scopes.
4
4
 
5
- if ARGV.include?('--dry-run')
6
- require 'calabash/android'
7
- require 'calabash/ios'
8
- end
5
+ require 'calabash/stubs'
@@ -1,6 +1,4 @@
1
1
  require 'calabash'
2
- require 'calabash/android/application'
3
- require 'calabash/ios/application'
4
2
 
5
3
  platform = ENV['PLATFORM']
6
4
 
@@ -12,7 +10,7 @@ unless platform
12
10
  elsif application.ios_application?
13
11
  platform = 'ios'
14
12
  else
15
- raise "Application '#{application}' is neither an Android app or an iOS app"
13
+ raise "Application '#{application}' is neither an Android app nor an iOS app"
16
14
  end
17
15
  end
18
16
 
@@ -20,14 +18,10 @@ case platform
20
18
  when 'android'
21
19
  require 'calabash/android'
22
20
 
23
- World(Calabash::Android)
24
-
25
21
  Calabash::Android.setup_defaults!
26
22
  when 'ios'
27
23
  require 'calabash/ios'
28
24
 
29
- World(Calabash::IOS)
30
-
31
25
  Calabash::IOS.setup_defaults!
32
26
  else
33
27
  message = if platform.nil? || platform.empty?
@@ -40,7 +34,7 @@ case platform
40
34
  [
41
35
  'ERROR! Unable to start the cucumber test:',
42
36
  message,
43
- "Run cucumber with the ENV variable 'CAL_APP', or run cucumber using $ calabash run"
37
+ "Run cucumber with the ENV variable 'CAL_APP' set to the path of the application under test, or specify 'PLATFORM'"
44
38
  ]
45
39
 
46
40
  Calabash::Logger.error(failure_messages.join("\n"))
@@ -0,0 +1,34 @@
1
+ require 'calabash'
2
+
3
+ Before do |scenario|
4
+ if scenario.respond_to?(:scenario_outline)
5
+ scenario = scenario.scenario_outline
6
+ end
7
+
8
+ reset_between_scenarios(scenario) do
9
+ cal.reset_device_changes # Resets changes Calabash has made to the device
10
+ cal.ensure_app_installed # Installs the app unless it is already installed
11
+ cal.clear_app_data # Clears the application data
12
+ cal.start_app # Starts the application
13
+ end
14
+ end
15
+
16
+ After do |scenario|
17
+ if scenario.failed?
18
+ cal.screenshot_embed
19
+ end
20
+
21
+ cal.stop_app
22
+ end
23
+
24
+ def reset_between_scenarios(scenario, &block)
25
+ block.call
26
+ end
27
+
28
+ def reset_between_features(scenario, &block)
29
+ if scenario.feature != @last_feature
30
+ block.call
31
+ end
32
+
33
+ @last_feature = scenario.feature
34
+ end
@@ -38,13 +38,13 @@ module Calabash
38
38
  raise 'No application given, and Calabash.default_application is not set'
39
39
  end
40
40
 
41
- Device.default.start_app(path_or_application, options.dup)
41
+ Calabash::Internal.with_default_device {|device| device.start_app(path_or_application, options.dup)}
42
42
  end
43
43
 
44
44
  # Stop the app running on
45
45
  # {Calabash::Defaults#default_server Calabash.default_server}
46
46
  def stop_app
47
- Device.default.stop_app
47
+ Calabash::Internal.with_default_device {|device| device.stop_app}
48
48
  end
49
49
 
50
50
  # Installs the given application. If the application is already installed,
@@ -67,7 +67,7 @@ module Calabash
67
67
  raise 'No application given, and Calabash.default_application is not set'
68
68
  end
69
69
 
70
- Device.default.install_app(path_or_application)
70
+ Calabash::Internal.with_default_device {|device| device.install_app(path_or_application)}
71
71
  end
72
72
 
73
73
  # Installs the given application *if it is not already installed*. If no
@@ -90,7 +90,7 @@ module Calabash
90
90
  raise 'No application given, and Calabash.default_application is not set'
91
91
  end
92
92
 
93
- Device.default.ensure_app_installed(path_or_application)
93
+ Calabash::Internal.with_default_device {|device| device.ensure_app_installed(path_or_application)}
94
94
  end
95
95
 
96
96
  # Uninstalls the given application. Does nothing if the application is
@@ -108,7 +108,7 @@ module Calabash
108
108
  raise 'No application given, and Calabash.default_application is not set'
109
109
  end
110
110
 
111
- Device.default.uninstall_app(path_or_application)
111
+ Calabash::Internal.with_default_device {|device| device.uninstall_app(path_or_application)}
112
112
  end
113
113
 
114
114
  # Clears the contents of the given application. This is roughly equivalent to
@@ -126,7 +126,7 @@ module Calabash
126
126
  raise 'No application given, and Calabash.default_application is not set'
127
127
  end
128
128
 
129
- Device.default.clear_app_data(path_or_application)
129
+ Calabash::Internal.with_default_device {|device| device.clear_app_data(path_or_application)}
130
130
  end
131
131
 
132
132
  # Sends the current app to the background and resumes it after
@@ -150,9 +150,17 @@ module Calabash
150
150
  true
151
151
  end
152
152
 
153
+ # Attempts to reset the changes Calabash has made to the device.
154
+ #
155
+ # This method does nothing at the moment, but will be required to reset the
156
+ # device changes in the future.
157
+ def reset_device_changes
158
+ true
159
+ end
160
+
153
161
  # @!visibility private
154
- def _send_current_app_to_background(for_seconds)
155
- abstract_method!
162
+ define_method(:_send_current_app_to_background) do |for_seconds|
163
+ abstract_method!(:_send_current_app_to_background)
156
164
  end
157
165
  end
158
166
  end
@@ -5,40 +5,39 @@ module Calabash
5
5
  # An API for setting the location of your app.
6
6
  module Location
7
7
  # Simulates gps location of the device/simulator.
8
- # @note Seems UIAutomation is broken here on physical devices on iOS 7.1
9
8
  #
10
9
  # @example
11
- # set_location({latitude: 48.8567, longitude: 2.3508})
10
+ # cal.set_location(latitude: 48.8567, longitude: 2.3508)
12
11
  #
13
12
  # @example
14
- # set_location(coordinates_for_place('The little mermaid, Copenhagen'))
13
+ # cal.set_location(coordinates_for_place('The little mermaid, Copenhagen'))
15
14
  #
16
- # @param [Hash] location The location to simulate.
17
- # @raise [ArgumentError] If location is not a hash and does not contain a
18
- # latitude and longitude key.
19
- def set_location(location)
20
- unless location.is_a?(Hash)
21
- raise ArgumentError, "Expected location to be a Hash, not '#{location.class}'"
15
+ # @param [Number] latitude The latitude of the location to simulate.
16
+ # @param [Number] longitude The longitude of the location to simulate.
17
+ # @raise [ArgumentError] If not given a latitude or longitude key.
18
+ def set_location(latitude: nil, longitude: nil)
19
+ unless latitude
20
+ raise ArgumentError, "Expected latitude to be a number, not '#{latitude.class}'"
22
21
  end
23
22
 
24
- unless location[:latitude] || location[:longitude]
25
- raise ArgumentError, 'You must supply :latitude and :longitude'
23
+ unless longitude
24
+ raise ArgumentError, "Expected longitude to be a number, not '#{longitude.class}'"
26
25
  end
27
26
 
28
- Device.default.set_location(location)
27
+ Calabash::Internal.with_default_device {|device| device.set_location(latitude: latitude, longitude: longitude)}
29
28
  end
30
29
 
31
30
  # Get the latitude and longitude for a certain place, resolved via Google
32
31
  # maps api. This hash can be used in `set_location`.
33
32
  #
34
33
  # @example
35
- # coordinates_for_place('The little mermaid, Copenhagen')
34
+ # cal.coordinates_for_place('The little mermaid, Copenhagen')
36
35
  # # => {:latitude => 55.6760968, :longitude => 12.5683371}
37
36
  #
38
37
  # @return [Hash] Latitude and longitude for the given place
39
38
  # @raise [RuntimeError] If the place cannot be found
40
- def coordinates_for_place(place)
41
- result = Geocoder.search(place)
39
+ def coordinates_for_place(place_name)
40
+ result = Geocoder.search(place_name)
42
41
 
43
42
  if result.empty?
44
43
  raise "No result found for '#{place}'"
@@ -62,23 +62,23 @@ module Calabash
62
62
  end
63
63
 
64
64
  # @!visibility private
65
- def _portrait?
66
- abstract_method!
65
+ define_method(:_portrait?) do
66
+ abstract_method!(:_portrait?)
67
67
  end
68
68
 
69
69
  # @!visibility private
70
- def _landscape?
71
- abstract_method!
70
+ define_method(:_landscape?) do
71
+ abstract_method!(:_landscape?)
72
72
  end
73
73
 
74
74
  # @!visibility private
75
- def _set_orientation_portrait
76
- abstract_method!
75
+ define_method(:_set_orientation_portrait) do
76
+ abstract_method!(:_set_orientation_portrait)
77
77
  end
78
78
 
79
79
  # @!visibility private
80
- def _set_orientation_landscape
81
- abstract_method!
80
+ define_method(:_set_orientation_landscape) do
81
+ abstract_method!(:_set_orientation_landscape)
82
82
  end
83
83
  end
84
84
  end
@@ -8,9 +8,6 @@ module Calabash
8
8
  # * https://github.com/calabash/calabash/tree/develop/samples/wordpress
9
9
  # * https://github.com/calabash/calabash/tree/develop/samples/shared-page-logic
10
10
  class Page
11
- # For auto-completion
12
- include Calabash
13
-
14
11
  # @!visibility private
15
12
  def self.inherited(subclass)
16
13
  # Define the page into global scope
@@ -71,7 +68,7 @@ module Calabash
71
68
 
72
69
  # Waits for the page trait to appear.
73
70
  def await(options={})
74
- wait_for_view(trait, options)
71
+ cal.wait_for_view(trait, options)
75
72
  end
76
73
 
77
74
  # @!visibility private
@@ -0,0 +1,33 @@
1
+ module Calabash
2
+ module Retry
3
+ DEFAULT_INTERVAL = 0.5
4
+
5
+ def self.retry(retries: nil, interval: DEFAULT_INTERVAL, timeout: nil, on_errors: [StandardError], &block)
6
+ if retries.nil?
7
+ raise ArgumentError, "Must supply retries"
8
+ end
9
+
10
+ if retries < 1
11
+ raise ArgumentError, "'retries' must be greater or equal to 1, it is #{retries}"
12
+ end
13
+
14
+ last_error = nil
15
+ start_time = Time.now
16
+
17
+ retries.times do
18
+ begin
19
+ return block.call
20
+ rescue *on_errors => e
21
+ last_error = e
22
+ sleep interval
23
+
24
+ if timeout && Time.now - start_time > timeout
25
+ break
26
+ end
27
+ end
28
+ end
29
+
30
+ raise last_error
31
+ end
32
+ end
33
+ end
@@ -38,7 +38,7 @@ module Calabash
38
38
  # If the name given is an absolute path, then Calabash will save the
39
39
  # screenshot to the absolute directory given.
40
40
  #
41
- # If the name given starts with ./ (e.g. `screenshot('./foo.png')`) then
41
+ # If the name given starts with ./ (e.g. `cal.screenshot('./foo.png')`) then
42
42
  # the filename will be saved relative to the current working directory.
43
43
  #
44
44
  # If the file specified by `name` has no extension then the filename will
@@ -49,11 +49,11 @@ module Calabash
49
49
  # @param [String] name Name of the screenshot.
50
50
  # @return [String] Path to the screenshot
51
51
  def screenshot(name=nil)
52
- Device.default.screenshot(name)
52
+ Calabash::Internal.with_default_device {|device| device.screenshot(name)}
53
53
  end
54
54
 
55
55
  # Takes a screenshot and embeds it in the test report. This method is only
56
- # available/useful when running in the context of cucumber.
56
+ # available/useful when running in the context of Cucumber.
57
57
  # @see Screenshot#screenshot
58
58
  def screenshot_embed(name=nil)
59
59
  path = screenshot(name)
@@ -0,0 +1,21 @@
1
+ # Stubs for Calabash. Used for example when running Cucumber's dry-run
2
+
3
+ # Page class
4
+ unless Object.const_defined?(:Calabash)
5
+ Object.const_set(:Calabash, Module.new)
6
+ end
7
+
8
+ unless Calabash.const_defined?(:Page)
9
+ Calabash.const_set(:Page, Class.new)
10
+ end
11
+
12
+ # Android module (used for pages)
13
+ unless Object.const_defined?(:Android)
14
+ Object.const_set(:Android, Module.new)
15
+ end
16
+
17
+ # IOS module (used for pages)
18
+ unless Object.const_defined?(:IOS)
19
+ Object.const_set(:IOS, Module.new)
20
+ end
21
+
@@ -4,13 +4,19 @@ module Calabash
4
4
  module Text
5
5
  # Enter `text` into the currently focused view.
6
6
  #
7
+ # @see Calabash::Text#enter_text_in
8
+ #
7
9
  # @param [String] text The text to type.
8
10
  # @raise [RuntimeError] if the text cannot be typed.
9
11
  def enter_text(text)
10
12
  _enter_text(text.to_s)
11
13
  end
12
14
 
13
- # Enter `text` into `query`.
15
+ # Enter `text` into the first view matched by `query`.
16
+ #
17
+ # @example
18
+ # cal.enter_text_in({id: 'edit'}, "Hello World")
19
+ #
14
20
  # @see Calabash::Text#enter_text
15
21
  #
16
22
  # @param [String] text The text to type.
@@ -21,11 +27,18 @@ module Calabash
21
27
  end
22
28
 
23
29
  # Clears the text of the currently focused view.
30
+ #
31
+ # @see Calabash::Text#clear_text_in
32
+ #
24
33
  def clear_text
25
34
  _clear_text
26
35
  end
27
36
 
28
- # Clears the text `view`
37
+ # Clears the text in the first view matched by `query`
38
+ #
39
+ # @example
40
+ # cal.clear_text_in({id: 'edit'})
41
+ #
29
42
  # @see Calabash::Text#clear_text
30
43
  #
31
44
  # @param [String, Hash, Calabash::Query] query A query describing the view
@@ -56,10 +69,10 @@ module Calabash
56
69
  # See http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html
57
70
  #
58
71
  # @example
59
- # tap_keyboard_action_key(:search)
60
- # tap_keyboard_action_key(:send)
61
- # tap_keyboard_action_key(:next)
62
- # tap_keyboard_action_key(:previous)
72
+ # cal.tap_keyboard_action_key(:search)
73
+ # cal.tap_keyboard_action_key(:send)
74
+ # cal.tap_keyboard_action_key(:next)
75
+ # cal.tap_keyboard_action_key(:previous)
63
76
  #
64
77
  # Notice that, for Android, Calabash does not ensure that this particular action key is
65
78
  # actually available on the current keyboard.
@@ -79,13 +92,13 @@ module Calabash
79
92
  # Escapes single quotes in `string`.
80
93
  #
81
94
  # @example
82
- # escape_single_quotes("Let's get this done.")
95
+ # cal.escape_single_quotes("Let's get this done.")
83
96
  # => "Let\\'s get this done."
84
97
  #
85
98
  # @example
86
- # query("* text:'#{escape_single_quotes("Let's go")}'")
99
+ # cal.query("* text:'#{escape_single_quotes("Let's go")}'")
87
100
  # # Equivalent to
88
- # query("* text:'Let\\'s go'")
101
+ # cal.query("* text:'Let\\'s go'")
89
102
  #
90
103
  # @param [String] string The string to escape.
91
104
  # @return [String] A string with its single quotes properly escaped.
@@ -109,7 +122,7 @@ module Calabash
109
122
  # @param [Number] timeout How long to wait for the keyboard.
110
123
  # @raise [Calabash::Wait::TimeoutError] Raises error if no keyboard
111
124
  # appears.
112
- def wait_for_keyboard(timeout=nil)
125
+ def wait_for_keyboard(timeout: nil)
113
126
  keyboard_timeout = keyboard_wait_timeout(timeout)
114
127
  message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to appear"
115
128
  wait_for(message, timeout: keyboard_timeout) do
@@ -124,7 +137,7 @@ module Calabash
124
137
  # @param [Number] timeout How log to wait for the keyboard to disappear.
125
138
  # @raise [Calabash::Wait::TimeoutError] Raises error if any keyboard is
126
139
  # visible after the `timeout`.
127
- def wait_for_no_keyboard(timeout=nil)
140
+ def wait_for_no_keyboard(timeout: nil)
128
141
  keyboard_timeout = keyboard_wait_timeout(timeout)
129
142
  message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear"
130
143
  wait_for(message, timeout: keyboard_timeout) do
@@ -132,33 +145,32 @@ module Calabash
132
145
  end
133
146
  end
134
147
 
135
- # @!visibility private
136
- def _enter_text(text)
148
+ define_method(:_enter_text) do |text|
137
149
  abstract_method!
138
150
  end
139
151
 
140
152
  # @!visibility private
141
- def _enter_text_in(view, text)
153
+ define_method(:_enter_text_in) do |view, text|
142
154
  abstract_method!
143
155
  end
144
156
 
145
157
  # @!visibility private
146
- def _clear_text
158
+ define_method(:_clear_text) do
147
159
  abstract_method!
148
160
  end
149
161
 
150
162
  # @!visibility private
151
- def _clear_text_in(view)
163
+ define_method(:_clear_text_in) do |view|
152
164
  abstract_method!
153
165
  end
154
166
 
155
167
  # @!visibility private
156
- def _tap_keyboard_action_key(action_key)
168
+ define_method(:_tap_keyboard_action_key) do |action_key|
157
169
  abstract_method!
158
170
  end
159
171
 
160
172
  # @!visibility private
161
- def _keyboard_visible?
173
+ define_method(:_keyboard_visible?) do
162
174
  abstract_method!
163
175
  end
164
176
 
@@ -168,7 +180,7 @@ module Calabash
168
180
  end
169
181
 
170
182
  # @!visibility private
171
- def keyboard_wait_timeout(timeout)
183
+ define_method(:keyboard_wait_timeout) do |timeout|
172
184
  if timeout.nil?
173
185
  Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT
174
186
  else