calabash-cucumber 0.9.169.pre2 → 0.9.169.pre5

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +14 -1
  3. data/bin/calabash-ios-setup.rb +2 -4
  4. data/bin/calabash-ios-sim.rb +10 -40
  5. data/calabash-cucumber.gemspec +25 -22
  6. data/features-skeleton/support/01_launch.rb +1 -1
  7. data/lib/calabash-cucumber.rb +13 -1
  8. data/lib/calabash-cucumber/actions/instruments_actions.rb +0 -4
  9. data/lib/calabash-cucumber/actions/playback_actions.rb +0 -4
  10. data/lib/calabash-cucumber/core.rb +9 -16
  11. data/lib/calabash-cucumber/device.rb +11 -2
  12. data/lib/calabash-cucumber/environment_helpers.rb +4 -56
  13. data/lib/calabash-cucumber/ios7_operations.rb +4 -2
  14. data/lib/calabash-cucumber/keyboard_helpers.rb +6 -3
  15. data/lib/calabash-cucumber/launch/simulator_helper.rb +40 -386
  16. data/lib/calabash-cucumber/launch/simulator_launcher.rb +534 -0
  17. data/lib/calabash-cucumber/launcher.rb +172 -36
  18. data/lib/calabash-cucumber/operations.rb +3 -4
  19. data/lib/calabash-cucumber/playback_helpers.rb +15 -29
  20. data/lib/calabash-cucumber/rotation_helpers.rb +14 -10
  21. data/lib/calabash-cucumber/status_bar_helpers.rb +5 -1
  22. data/lib/calabash-cucumber/uia.rb +6 -12
  23. data/lib/calabash-cucumber/utils/logging.rb +97 -0
  24. data/lib/calabash-cucumber/utils/plist_buddy.rb +178 -0
  25. data/lib/calabash-cucumber/utils/simulator_accessibility.rb +250 -0
  26. data/lib/calabash-cucumber/utils/xctools.rb +95 -0
  27. data/lib/calabash-cucumber/version.rb +197 -2
  28. data/lib/calabash-cucumber/wait_helpers.rb +16 -20
  29. data/scripts/.irbrc +11 -6
  30. data/scripts/com.example.plist +0 -0
  31. data/scripts/launch.rb +1 -1
  32. data/spec/bin/calabash_ios_sim_spec.rb +24 -0
  33. data/spec/launcher_spec.rb +76 -0
  34. data/spec/logging_spec.rb +38 -0
  35. data/spec/plist_buddy_spec.rb +99 -0
  36. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/Default-568h@2x.png +0 -0
  37. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/Info.plist +0 -0
  38. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/LPSimpleExample-cal +0 -0
  39. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/PkgInfo +1 -0
  40. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/InfoPlist.strings +0 -0
  41. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFirstViewController.nib +0 -0
  42. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFirstViewController~ipad.nib +0 -0
  43. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFourthViewController.nib +0 -0
  44. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFourthViewController~ipad.nib +0 -0
  45. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPSecondViewController.nib +0 -0
  46. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPSecondViewController~ipad.nib +0 -0
  47. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPThirdViewController.nib +0 -0
  48. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPThirdViewController~ipad.nib +0 -0
  49. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/first.png +0 -0
  50. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/first@2x.png +0 -0
  51. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/second.png +0 -0
  52. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/second@2x.png +0 -0
  53. data/spec/resources/plist_buddy/com.example.plist +0 -0
  54. data/spec/resources/plist_buddy/com.testing.plist +18 -0
  55. data/spec/simulator_accessibility_spec.rb +144 -0
  56. data/spec/spec_helper.rb +31 -0
  57. data/spec/xctools_spec.rb +58 -0
  58. metadata +120 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c860c07a3b899e7aa1ee325f1dfc8bcd047ae2e6
4
- data.tar.gz: 564980de6ded2290c81e2b6c6348ce2f649e553c
3
+ metadata.gz: 5720c3a1025782b5d07f6b2283414c8b2e0986a0
4
+ data.tar.gz: 556933f7a91bcb3a05539d9048daf2360e550512
5
5
  SHA512:
6
- metadata.gz: b08713ae250a8b54b24e05f89a4b41f015f6483932289a2b4f0806260d90c6d0ada14773afe9acac2026beaf003d04f9246597efea055a771eb080cf48fa1b62
7
- data.tar.gz: 735c45b24c1bdd1dd67a89653f8a31397542426352b6fbde2b638ff59e457839f7ac55005b371a4d4fa449473b8cce19a9237126d74cde1439d656d4214fcc9d
6
+ metadata.gz: bd03a7ed163acfa246b53da1a8ee41a181e968f9e6f5d0594bbeba4480a1901be7939392b04f6088a69f3536ec7f4dc9ec12199339873eeeedd1eb207fbe2e99
7
+ data.tar.gz: 21367d4e5a072e303f70bb26b75c254906df900c80f4af75d8c76b08780d72e673f1983320ca6f6f98a571ce57311afe851e4d12547ff5ae6344c98606f922ec
data/Rakefile CHANGED
@@ -1,9 +1,22 @@
1
- require 'bundler'
2
1
  require 'fileutils'
3
2
 
3
+ require 'bundler'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
8
+ task :test => :spec
6
9
 
10
+ # REQUIRES that the calabash-ios-server source code is located
11
+ #
12
+ # ../../calabash-ios-server.
13
+ #
14
+ # if your server source code is in a different location, you can use:
15
+ #
16
+ # $ CALABASH_SERVER_PATH=/your/path rake build_server'
17
+ #
18
+ # to specify an alternative server location
19
+ desc 'build the calabash.framework and install it in ./staticlib/.'
7
20
  task :build_server do
8
21
 
9
22
  FRAMEWORK='calabash.framework'
@@ -154,9 +154,7 @@ def setup_project(project_name, project_path, path)
154
154
 
155
155
  end
156
156
 
157
-
158
-
159
- require 'calabash-cucumber/launch/simulator_helper'
157
+ require 'calabash-cucumber/launch/simulator_launcher'
160
158
  def validate_setup(args)
161
159
  if args.length > 0
162
160
  if args[0].end_with?(".ipa")
@@ -170,7 +168,7 @@ def validate_setup(args)
170
168
  exit 1
171
169
  end
172
170
  else
173
- dd_dir = Calabash::Cucumber::SimulatorHelper.derived_data_dir_for_project
171
+ dd_dir = Calabash::Cucumber::SimulatorLauncher.new().derived_data_dir_for_project
174
172
  if not dd_dir
175
173
  puts "Unable to find iOS XCode project."
176
174
  puts "You should run this command from an XCode project directory."
@@ -1,52 +1,22 @@
1
- require 'sim_launcher'
2
- require 'calabash-cucumber/launch/simulator_helper'
1
+ require 'calabash-cucumber/utils/simulator_accessibility'
2
+ require 'calabash-cucumber/utils/logging'
3
+
4
+ include Calabash::Cucumber::Logging
5
+ include Calabash::Cucumber::SimulatorAccessibility
3
6
 
4
7
  def quit_sim
5
- `echo 'application "iPhone Simulator" quit' | osascript`
8
+ _deprecated('0.9.169', 'use Calabash::Cucumber::SimulatorAccessibility.quit_simulator', :warn)
9
+ quit_simulator
6
10
  end
7
11
 
8
12
  def calabash_sim_reset
9
- reset_script = File.expand_path("#{@script_dir}/reset_simulator.scpt")
10
- app_path = File.expand_path("#{@script_dir}/EmptyAppHack.app")
11
- launcher = SimLauncher::Simulator.new
12
-
13
- sdks = ENV['SDK_VERSIONS']
14
- if sdks
15
- sdks = sdks.split(",")
16
- else
17
- sdks = SimLauncher::SdkDetector.new(launcher).available_sdk_versions
18
- end
19
-
20
-
21
- sdks.each do |sdk|
22
- launcher.launch_ios_app(app_path, sdk, ENV['DEVICE'] || 'iphone')
23
- puts `osascript #{reset_script}`
24
- end
25
-
26
-
13
+ reset_simulator_content_and_settings
27
14
  end
28
15
 
29
16
  def calabash_sim_accessibility
30
- Calabash::Cucumber::SimulatorHelper.stop
31
- old = ['5.*','6.*','7.0*'].map do |x|
32
- Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "7.0*", "Library", "Preferences"))
33
- end.flatten
34
-
35
- rest = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Preferences"))
36
- rest = rest - old
37
- (old+rest).each do |sim_pref_dir|
38
- fp = File.expand_path("#{@script_dir}/data/")
39
- if rest.include?(sim_pref_dir)
40
- tgt = 'com.apple.Accessibility-5.1.plist'
41
- else
42
- tgt = 'com.apple.Accessibility.plist'
43
- end
44
- FileUtils.cp("#{fp}/#{tgt}", File.join(sim_pref_dir, 'com.apple.Accessibility.plist'))
45
- end
46
-
17
+ enable_accessibility_on_simulators
47
18
  end
48
19
 
49
-
50
20
  def calabash_sim_location(args)
51
21
 
52
22
  if args.length == 0
@@ -136,7 +106,7 @@ end
136
106
 
137
107
 
138
108
  def calabash_sim_device(args)
139
- quit_sim
109
+ quit_simulator
140
110
  options = ["iPad", "iPad_Retina", "iPhone", "iPhone_Retina", "iPhone_Retina_4inch"]
141
111
  if args.length != 1 or not options.find { |x| x == args[0] }
142
112
  print_usage
@@ -1,33 +1,36 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "calabash-cucumber/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'calabash-cucumber/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "calabash-cucumber"
6
+ s.name = 'calabash-cucumber'
7
7
  s.version = Calabash::Cucumber::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Karl Krukow"]
10
- s.email = ["karl@lesspainful.com"]
11
- s.homepage = "http://calaba.sh"
9
+ s.authors = ['Karl Krukow']
10
+ s.email = ['karl@lesspainful.com']
11
+ s.homepage = 'http://calaba.sh'
12
12
  s.summary = %q{Client for calabash-ios-server for automated functional testing on iOS}
13
13
  s.description = %q{calabash-cucumber drives tests for native iOS apps. You must link your app with calabash-ios-server framework to execute tests.}
14
- s.files = `git ls-files`.split("\n").concat(["staticlib/calabash.framework.zip"])
14
+ s.files = `git ls-files`.split("\n").concat(['staticlib/calabash.framework.zip'])
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = "calabash-ios"
17
- s.require_paths = ["lib"]
16
+ s.executables = 'calabash-ios'
17
+ s.require_paths = ['lib']
18
18
 
19
- s.add_dependency( "cucumber", "~> 1.3.0" )
20
- s.add_dependency( "calabash-common", "~> 0.0.1" )
21
- s.add_dependency( "json" )
22
- s.add_dependency( 'edn')
23
- s.add_dependency( "CFPropertyList" )
24
- s.add_dependency( "sim_launcher", "~> 0.4.9")
25
- s.add_dependency( "slowhandcuke" )
26
- s.add_dependency( "geocoder", "~>1.1.8")
27
- s.add_dependency( "httpclient","~> 2.3.3")
28
- s.add_dependency( "bundler", "~> 1.1")
29
- s.add_dependency( "run_loop", "~> 0.2.0" )
30
- s.add_dependency( "awesome_print")
31
- s.add_dependency( "xamarin-test-cloud", "~> 0.9.27")
19
+ s.add_dependency('cucumber', '~> 1.3.0')
20
+ s.add_dependency('calabash-common', '~> 0.0.1')
21
+ s.add_dependency('json')
22
+ s.add_dependency('edn')
23
+ s.add_dependency('CFPropertyList')
24
+ s.add_dependency('sim_launcher', '~> 0.4.9')
25
+ s.add_dependency('slowhandcuke')
26
+ s.add_dependency('geocoder', '~>1.1.8')
27
+ s.add_dependency('httpclient', '~> 2.3.3')
28
+ s.add_dependency('bundler', '~> 1.1')
29
+ s.add_dependency('run_loop', '~> 0.2.1.pre1')
30
+ s.add_dependency('awesome_print')
31
+ s.add_dependency('xamarin-test-cloud', '~> 0.9.27')
32
+
33
+ s.add_development_dependency 'rake'
34
+ s.add_development_dependency 'rspec'
32
35
 
33
36
  end
@@ -43,6 +43,6 @@ end
43
43
  at_exit do
44
44
  launcher = Calabash::Cucumber::Launcher.new
45
45
  if launcher.simulator_target?
46
- Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
46
+ launcher.simulator_launcher.stop unless launcher.calabash_no_stop?
47
47
  end
48
48
  end
@@ -6,4 +6,16 @@ require 'calabash-cucumber/wait_helpers'
6
6
  require 'calabash-cucumber/operations'
7
7
  require 'calabash-cucumber/version'
8
8
  require 'calabash-cucumber/date_picker'
9
- require 'calabash-cucumber/ipad_1x_2x'
9
+ require 'calabash-cucumber/ipad_1x_2x'
10
+ require 'calabash-cucumber/utils/logging'
11
+
12
+ # stubs for documentation
13
+
14
+ # base module for Calabash iOS
15
+ module Calabash
16
+ # base sub module
17
+ # todo in 1.0 release consider changing Cucumber module to iOS module
18
+ module Cucumber
19
+
20
+ end
21
+ end
@@ -13,10 +13,6 @@ class Calabash::Cucumber::InstrumentsActions
13
13
  query_action(options, :uia_tap_offset)
14
14
  end
15
15
 
16
- def tap(options)
17
- uia_tap_server(options[:query], options)
18
- end
19
-
20
16
  def double_tap(options)
21
17
  query_action(options, :uia_double_tap_offset)
22
18
  end
@@ -13,10 +13,6 @@ class Calabash::Cucumber::PlaybackActions
13
13
  playback('touch', options)
14
14
  end
15
15
 
16
- def tap(options)
17
- touch(options)
18
- end
19
-
20
16
  def double_tap(options)
21
17
  playback('double_tap', options)
22
18
  end
@@ -5,17 +5,25 @@ require 'calabash-cucumber/uia'
5
5
  require 'calabash-cucumber/environment_helpers'
6
6
  require 'calabash-cucumber/connection'
7
7
  require 'calabash-cucumber/connection_helpers'
8
- require 'calabash-cucumber/launch/simulator_helper'
8
+ require 'calabash-cucumber/launch/simulator_launcher'
9
9
  require 'calabash-cucumber/query_helpers'
10
10
  require 'calabash-cucumber/playback_helpers'
11
11
  require 'calabash-cucumber/failure_helpers'
12
12
  require 'calabash-cucumber/status_bar_helpers'
13
13
  require 'calabash-cucumber/rotation_helpers'
14
14
  require 'calabash-cucumber/map'
15
+ require 'calabash-cucumber/utils/logging'
16
+
17
+
18
+ # legacy support - module was deprecated 0.9.169
19
+ # replaced with simulator-launcher
20
+ require 'calabash-cucumber/launch/simulator_helper'
15
21
 
16
22
  module Calabash
17
23
  module Cucumber
18
24
  module Core
25
+
26
+ include Calabash::Cucumber::Logging
19
27
  include Calabash::Cucumber::EnvironmentHelpers
20
28
  include Calabash::Cucumber::ConnectionHelpers
21
29
  include Calabash::Cucumber::QueryHelpers
@@ -26,7 +34,6 @@ module Calabash
26
34
  include Calabash::Cucumber::RotationHelpers
27
35
  include Calabash::Cucumber::PlaybackHelpers
28
36
 
29
-
30
37
  def macro(txt)
31
38
  if self.respond_to? :step
32
39
  step(txt)
@@ -39,10 +46,6 @@ module Calabash
39
46
  map(uiquery, :query, *args)
40
47
  end
41
48
 
42
- def q(uiquery, *args)
43
- query(uiquery, *args)
44
- end
45
-
46
49
  # causes all views matched by the +query+ to briefly change colors making
47
50
  # them visually identifiable.
48
51
  #
@@ -78,16 +81,6 @@ module Calabash
78
81
  query_action_with_options(:touch, uiquery, options)
79
82
  end
80
83
 
81
- def tap_q(uiquery, options={})
82
- _uiquery, options = extract_query_and_options(uiquery, options)
83
- launcher.actions.tap(options)
84
- end
85
-
86
- def t(uiquery, options={})
87
- tap_q(uiquery, options)
88
- end
89
-
90
-
91
84
  def double_tap(uiquery, options={})
92
85
  query_action_with_options(:double_tap, uiquery, options)
93
86
  end
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'calabash-cucumber/utils/logging'
2
3
 
3
4
  module Calabash
4
5
  module Cucumber
@@ -6,6 +7,8 @@ module Calabash
6
7
  # interacting with during a test.
7
8
  class Device
8
9
 
10
+ include Calabash::Cucumber::Logging
11
+
9
12
  GESTALT_IPHONE = 'iPhone'
10
13
  GESTALT_IPAD = 'iPad'
11
14
  GESTALT_IPHONE5 = '4-inch'
@@ -16,7 +19,7 @@ module Calabash
16
19
  attr_reader :device_family
17
20
  attr_reader :simulator_details, :ios_version
18
21
  attr_reader :system
19
- attr_reader :framework_version
22
+ attr_reader :server_version
20
23
  attr_reader :iphone_app_emulated_on_ipad
21
24
  attr_reader :iphone_4in
22
25
 
@@ -29,7 +32,7 @@ module Calabash
29
32
  @device_family = @system.eql?(GESTALT_SIM_SYS) ? simulator_device : @system.split(/[\d,.]/).first
30
33
  @simulator_details = version_data['simulator']
31
34
  @ios_version = version_data['iOS_version']
32
- @framework_version = version_data['version']
35
+ @server_version = version_data['version']
33
36
  @iphone_app_emulated_on_ipad = version_data['iphone_app_emulated_on_ipad']
34
37
  @iphone_4in = version_data['4inch']
35
38
  end
@@ -95,6 +98,12 @@ module Calabash
95
98
  def iphone_app_emulated_on_ipad?
96
99
  iphone_app_emulated_on_ipad
97
100
  end
101
+
102
+ def framework_version
103
+ _deprecated('0.9.169', "use 'server_version', instead", :warn)
104
+ @server_version
105
+ end
106
+
98
107
  end
99
108
  end
100
109
  end
@@ -1,10 +1,14 @@
1
1
  require 'calabash-cucumber/device'
2
2
  require 'calabash-cucumber/launcher'
3
+ require 'calabash-cucumber/utils/logging'
3
4
 
4
5
  module Calabash
5
6
  module Cucumber
7
+
8
+ # methods that describe the runtime environment
6
9
  module EnvironmentHelpers
7
10
 
11
+ include Calabash::Cucumber::Logging
8
12
 
9
13
  # returns +true+ if UIAutomation functions are available
10
14
  #
@@ -121,62 +125,6 @@ module Calabash
121
125
  _default_device_or_create().iphone_app_emulated_on_ipad?
122
126
  end
123
127
 
124
- # returns +true+ if the <tt>CALABASH_NO_DEPRECATION</tt> variable is set
125
- # to +1+
126
- def no_deprecation_warnings?
127
- ENV['CALABASH_NO_DEPRECATION'] == '1'
128
- end
129
-
130
- # returns +true+ if the <tt>CALABASH_FULL_CONSOLE_OUTPUT</tt> is set to
131
- # +1+
132
- def full_console_logging?
133
- ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1'
134
- end
135
-
136
- # returns +true+ if the <tt>DEBUG</tt> is set to +1+
137
- def debug_logging?
138
- ENV['DEBUG'] == '1'
139
- end
140
-
141
-
142
- # prints a deprecated message that includes the line number
143
- # +version+ string indicating when the feature was deprecated
144
- # +msg+ deprecation message (possibly suggesting alternatives)
145
- # +type+ <tt>{ :warn | :pending }</tt> - <tt>:pending</tt> will raise a
146
- # cucumber pending exception
147
- #
148
- # if ENV['CALABASH_NO_DEPRECATION'] == '1' then this method is a nop
149
- def _deprecated(version, msg, type)
150
- allowed = [:pending, :warn]
151
- unless allowed.include?(type)
152
- screenshot_and_raise "type '#{type}' must be on of '#{allowed}'"
153
- end
154
-
155
- unless no_deprecation_warnings?
156
-
157
-
158
- if RUBY_VERSION < '2.0'
159
- stack = Kernel.caller()[1..6].join("\n")
160
- else
161
- stack = Kernel.caller(0, 6)[1..-1].join("\n")
162
- end
163
-
164
- msg = "deprecated '#{version}' - '#{msg}'\n#{stack}"
165
-
166
- if type.eql?(:pending)
167
- pending(msg)
168
- else
169
- # todo deprecated function does not output on a new line when called within cucumber
170
- # todo should the _deprecated function be colored?
171
- begin
172
- warn "\033[34m\nWARN: #{msg}\033[0m"
173
- rescue
174
- warn "\nWARN: #{msg}"
175
- end
176
- end
177
- end
178
- end
179
-
180
128
  private
181
129
  # returns the device that is currently being tested against
182
130
  #
@@ -4,15 +4,17 @@ require 'calabash-cucumber/actions/instruments_actions'
4
4
  require 'calabash-cucumber/actions/playback_actions'
5
5
  require 'calabash-cucumber/environment_helpers'
6
6
 
7
+ # todo deprecate the Calabash::Cucumber::IOS7Operations
7
8
 
8
-
9
+ # WARNING: this entire module is deprecated
10
+ # references functions that do not exist
11
+ # should be removed
9
12
  module Calabash
10
13
  module Cucumber
11
14
  module IOS7Operations
12
15
  include Calabash::Cucumber::UIA
13
16
  include Calabash::Cucumber::EnvironmentHelpers
14
17
 
15
- # todo deprecate the Calabash::Cucumber::IOS7Operations
16
18
 
17
19
  # <b>DEPRECATED</b>
18
20
  #