calabash-cucumber 0.18.2 → 0.19.0.pre1

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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/bin/calabash-ios +0 -16
  3. data/bin/calabash-ios-build.rb +0 -86
  4. data/bin/calabash-ios-helpers.rb +0 -65
  5. data/bin/calabash-ios-setup.rb +5 -119
  6. data/bin/calabash-ios-sim.rb +0 -37
  7. data/bin/frank-calabash +0 -1
  8. data/doc/calabash-ios-help.txt +0 -8
  9. data/dylibs/libCalabashDyn.dylib +0 -0
  10. data/dylibs/libCalabashDynSim.dylib +0 -0
  11. data/features-skeleton/support/01_launch.rb +3 -4
  12. data/features/step_definitions/calabash_steps.rb +1 -7
  13. data/lib/calabash-cucumber.rb +1 -2
  14. data/lib/calabash-cucumber/actions/instruments_actions.rb +2 -3
  15. data/lib/calabash-cucumber/core.rb +97 -101
  16. data/lib/calabash-cucumber/device.rb +5 -118
  17. data/lib/calabash-cucumber/environment.rb +109 -5
  18. data/lib/calabash-cucumber/environment_helpers.rb +4 -66
  19. data/lib/calabash-cucumber/http/http.rb +114 -0
  20. data/lib/calabash-cucumber/http_helpers.rb +3 -1
  21. data/lib/calabash-cucumber/ipad_1x_2x.rb +5 -7
  22. data/lib/calabash-cucumber/keyboard_helpers.rb +0 -44
  23. data/lib/calabash-cucumber/launcher.rb +425 -808
  24. data/lib/calabash-cucumber/logging.rb +2 -74
  25. data/lib/calabash-cucumber/operations.rb +0 -2
  26. data/lib/calabash-cucumber/rotation_helpers.rb +2 -82
  27. data/lib/calabash-cucumber/status_bar_helpers.rb +2 -8
  28. data/lib/calabash-cucumber/store/preferences.rb +2 -1
  29. data/lib/calabash-cucumber/uia.rb +4 -9
  30. data/lib/calabash-cucumber/version.rb +2 -2
  31. data/lib/calabash-cucumber/wait_helpers.rb +0 -2
  32. data/staticlib/calabash.framework.zip +0 -0
  33. data/staticlib/libFrankCalabash.a +0 -0
  34. metadata +13 -143
  35. data/lib/calabash-cucumber/actions/playback_actions.rb +0 -109
  36. data/lib/calabash-cucumber/deprecated.rb +0 -34
  37. data/lib/calabash-cucumber/launch/simulator_helper.rb +0 -62
  38. data/lib/calabash-cucumber/launch/simulator_launcher.rb +0 -617
  39. data/lib/calabash-cucumber/playback_helpers.rb +0 -225
  40. data/lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64 +0 -51
  41. data/lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64 +0 -51
  42. data/lib/calabash-cucumber/resources/cell_swipe_ios5_ipad.base64 +0 -74
  43. data/lib/calabash-cucumber/resources/cell_swipe_ios5_iphone.base64 +0 -74
  44. data/lib/calabash-cucumber/resources/double_tap_ios5_ipad.base64 +0 -15
  45. data/lib/calabash-cucumber/resources/double_tap_ios5_iphone.base64 +0 -15
  46. data/lib/calabash-cucumber/resources/double_tap_ios6_ipad.base64 +0 -22
  47. data/lib/calabash-cucumber/resources/double_tap_ios6_iphone.base64 +0 -22
  48. data/lib/calabash-cucumber/resources/pan_ios5_ipad.base64 +0 -199
  49. data/lib/calabash-cucumber/resources/pan_ios5_iphone.base64 +0 -199
  50. data/lib/calabash-cucumber/resources/pan_ios6_ipad.base64 +0 -206
  51. data/lib/calabash-cucumber/resources/pan_ios6_iphone.base64 +0 -206
  52. data/lib/calabash-cucumber/resources/pinch_in_ios4_ipad.base64 +0 -104
  53. data/lib/calabash-cucumber/resources/pinch_in_ios4_iphone.base64 +0 -104
  54. data/lib/calabash-cucumber/resources/pinch_in_ios5_ipad.base64 +0 -144
  55. data/lib/calabash-cucumber/resources/pinch_in_ios5_iphone.base64 +0 -144
  56. data/lib/calabash-cucumber/resources/pinch_in_ios6_ipad.base64 +0 -70
  57. data/lib/calabash-cucumber/resources/pinch_in_ios6_iphone.base64 +0 -70
  58. data/lib/calabash-cucumber/resources/pinch_out_ios5_ipad.base64 +0 -207
  59. data/lib/calabash-cucumber/resources/pinch_out_ios5_iphone.base64 +0 -207
  60. data/lib/calabash-cucumber/resources/pinch_out_ios6_ipad.base64 +0 -96
  61. data/lib/calabash-cucumber/resources/pinch_out_ios6_iphone.base64 +0 -96
  62. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_ipad.base64 +0 -2
  63. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_iphone.base64 +0 -2
  64. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_ipad.base64 +0 -2
  65. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_iphone.base64 +0 -2
  66. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_ipad.base64 +0 -2
  67. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_iphone.base64 +0 -2
  68. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_ipad.base64 +0 -2
  69. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_iphone.base64 +0 -2
  70. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_ipad.base64 +0 -2
  71. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_iphone.base64 +0 -2
  72. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_ipad.base64 +0 -2
  73. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_iphone.base64 +0 -2
  74. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_ipad.base64 +0 -2
  75. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_iphone.base64 +0 -2
  76. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_ipad.base64 +0 -2
  77. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_iphone.base64 +0 -2
  78. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_ipad.base64 +0 -2
  79. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_iphone.base64 +0 -2
  80. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_ipad.base64 +0 -2
  81. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_iphone.base64 +0 -2
  82. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_ipad.base64 +0 -2
  83. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_iphone.base64 +0 -2
  84. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_ipad.base64 +0 -2
  85. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_iphone.base64 +0 -2
  86. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_ipad.base64 +0 -2
  87. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_iphone.base64 +0 -2
  88. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_ipad.base64 +0 -2
  89. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_iphone.base64 +0 -2
  90. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_ipad.base64 +0 -2
  91. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_iphone.base64 +0 -2
  92. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_ipad.base64 +0 -2
  93. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_iphone.base64 +0 -2
  94. data/lib/calabash-cucumber/resources/swipe_down_ios5_ipad.base64 +0 -18
  95. data/lib/calabash-cucumber/resources/swipe_down_ios5_iphone.base64 +0 -31
  96. data/lib/calabash-cucumber/resources/swipe_down_ios6_ipad.base64 +0 -25
  97. data/lib/calabash-cucumber/resources/swipe_down_ios6_iphone.base64 +0 -25
  98. data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_ipad.base64 +0 -15
  99. data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_iphone.base64 +0 -15
  100. data/lib/calabash-cucumber/resources/swipe_left_ios4_ipad.base64 +0 -18
  101. data/lib/calabash-cucumber/resources/swipe_left_ios4_iphone.base64 +0 -18
  102. data/lib/calabash-cucumber/resources/swipe_left_ios5_ipad.base64 +0 -17
  103. data/lib/calabash-cucumber/resources/swipe_left_ios5_iphone.base64 +0 -34
  104. data/lib/calabash-cucumber/resources/swipe_left_ios6_ipad.base64 +0 -28
  105. data/lib/calabash-cucumber/resources/swipe_left_ios6_iphone.base64 +0 -28
  106. data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_ipad.base64 +0 -17
  107. data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_iphone.base64 +0 -17
  108. data/lib/calabash-cucumber/resources/swipe_right_ios4_ipad.base64 +0 -13
  109. data/lib/calabash-cucumber/resources/swipe_right_ios4_iphone.base64 +0 -13
  110. data/lib/calabash-cucumber/resources/swipe_right_ios5_ipad.base64 +0 -17
  111. data/lib/calabash-cucumber/resources/swipe_right_ios5_iphone.base64 +0 -17
  112. data/lib/calabash-cucumber/resources/swipe_right_ios6_ipad.base64 +0 -25
  113. data/lib/calabash-cucumber/resources/swipe_right_ios6_iphone.base64 +0 -25
  114. data/lib/calabash-cucumber/resources/swipe_up_ios5_ipad.base64 +0 -34
  115. data/lib/calabash-cucumber/resources/swipe_up_ios5_iphone.base64 +0 -28
  116. data/lib/calabash-cucumber/resources/swipe_up_ios6_ipad.base64 +0 -25
  117. data/lib/calabash-cucumber/resources/swipe_up_ios6_iphone.base64 +0 -25
  118. data/lib/calabash-cucumber/resources/touch_done_ios4_ipad.base64 +0 -7
  119. data/lib/calabash-cucumber/resources/touch_done_ios4_iphone.base64 +0 -9
  120. data/lib/calabash-cucumber/resources/touch_done_ios5_ipad.base64 +0 -7
  121. data/lib/calabash-cucumber/resources/touch_done_ios5_iphone.base64 +0 -9
  122. data/lib/calabash-cucumber/resources/touch_hold_ios5_ipad.base64 +0 -9
  123. data/lib/calabash-cucumber/resources/touch_hold_ios5_iphone.base64 +0 -9
  124. data/lib/calabash-cucumber/resources/touch_hold_ios6_ipad.base64 +0 -9
  125. data/lib/calabash-cucumber/resources/touch_hold_ios6_iphone.base64 +0 -9
  126. data/lib/calabash-cucumber/resources/touch_ios4_ipad.base64 +0 -9
  127. data/lib/calabash-cucumber/resources/touch_ios4_iphone.base64 +0 -9
  128. data/lib/calabash-cucumber/resources/touch_ios5_ipad.base64 +0 -9
  129. data/lib/calabash-cucumber/resources/touch_ios5_iphone.base64 +0 -9
  130. data/lib/calabash-cucumber/resources/touch_ios7_ipad.base64 +0 -9
  131. data/lib/calabash-cucumber/resources/touch_ios7_iphone.base64 +0 -9
  132. data/lib/calabash-cucumber/resources/wheel_down_ios4_ipad.base64 +0 -159
  133. data/lib/calabash-cucumber/resources/wheel_down_ios4_iphone.base64 +0 -159
  134. data/lib/calabash-cucumber/resources/wheel_down_ios5_ipad.base64 +0 -156
  135. data/lib/calabash-cucumber/resources/wheel_down_ios5_iphone.base64 +0 -156
  136. data/lib/calabash-cucumber/resources/wheel_up_ios4_ipad.base64 +0 -166
  137. data/lib/calabash-cucumber/resources/wheel_up_ios4_iphone.base64 +0 -166
  138. data/lib/calabash-cucumber/resources/wheel_up_ios5_ipad.base64 +0 -156
  139. data/lib/calabash-cucumber/resources/wheel_up_ios5_iphone.base64 +0 -156
  140. data/lib/calabash-cucumber/utils/logging.rb +0 -111
  141. data/lib/calabash-cucumber/utils/plist_buddy.rb +0 -45
  142. data/lib/calabash-cucumber/utils/simulator_accessibility.rb +0 -334
  143. data/lib/calabash-cucumber/utils/xctools.rb +0 -101
  144. data/scripts/.irbrc +0 -64
  145. data/scripts/launch.rb +0 -48
@@ -1,111 +0,0 @@
1
-
2
- module Calabash
3
- module Cucumber
4
-
5
- # Internal logging methods for the calabash-ios gem.
6
- module Logging
7
-
8
- # @!visibility private
9
- # Has full console logging been enabled?
10
- #
11
- # The return value is controlled by the `CALABASH_FULL_CONSOLE_OUTPUT`
12
- # environment variable.
13
- #
14
- # This is considered one level above debug logging - maybe we should call
15
- # the info log level.
16
- #
17
- # @return [Boolean] Returns `true` if full logging has been enabled.
18
- def full_console_logging?
19
- ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1'
20
- end
21
-
22
- # @!visibility private
23
- # Has debug logging been enabled?
24
- #
25
- # The return value is controlled by the `DEBUG` environment variable.
26
- #
27
- # @return [Boolean] Returns `true` if debug logging has been enabled.
28
- def debug_logging?
29
- ENV['DEBUG'] == '1'
30
- end
31
-
32
- # Prints a blue warning message.
33
- # @param [String] msg the message to print
34
- # @return [void]
35
- def calabash_warn(msg)
36
- begin
37
- warn "\033[34m\nWARN: #{msg}\033[0m"
38
- rescue
39
- warn "\nWARN: #{msg}"
40
- end
41
- end
42
-
43
- # Prints a green info message.
44
- # @param [String] msg the message to print
45
- # @return [void]
46
- def calabash_info(msg)
47
- begin
48
- puts "\033[32m\nINFO: #{msg}\033[0m"
49
- rescue
50
- puts "\nINFO: #{msg}"
51
- end
52
- end
53
-
54
- # @!visibility private
55
- # Controls printing of deprecation warnings.
56
- #
57
- # To inhibit deprecation message set this to '1'
58
- #
59
- # Inhibiting deprecation messages is not recommend.
60
- CALABASH_NO_DEPRECATION = ENV['CALABASH_NO_DEPRECATION'] || '0'
61
-
62
- # @!visibility private
63
- # Have deprecation warnings been turned off?
64
- #
65
- # The return value is controlled but the `CALABASH_NO_DEPRECATION`
66
- # environment variable.
67
- def no_deprecation_warnings?
68
- ENV['CALABASH_NO_DEPRECATION'] == '1'
69
- end
70
-
71
- # @!visibility private
72
- # Prints a deprecated message that includes the line number.
73
- #
74
- # If deprecation warns have been turned off this method does nothing.
75
- #
76
- # @param [String] version indicates when the feature was deprecated
77
- # @param [String] msg deprecation message (possibly suggesting alternatives)
78
- # @param [Symbol] type { :warn | :pending } - :pending will raise a
79
- # cucumber pending error
80
- # @return [void]
81
- def _deprecated(version, msg, type)
82
- allowed = [:pending, :warn]
83
- unless allowed.include?(type)
84
- raise "type '#{type}' must be on of '#{allowed}'"
85
- end
86
-
87
- unless no_deprecation_warnings?
88
-
89
- if RUBY_VERSION < '2.0'
90
- stack = Kernel.caller()[1..6].join("\n")
91
- else
92
- stack = Kernel.caller(0, 6)[1..-1].join("\n")
93
- end
94
-
95
- msg = "deprecated '#{version}' - #{msg}\n#{stack}"
96
-
97
- if type.eql?(:pending)
98
- pending(msg)
99
- else
100
- begin
101
- warn "\033[34m\nWARN: #{msg}\033[0m"
102
- rescue
103
- warn "\nWARN: #{msg}"
104
- end
105
- end
106
- end
107
- end
108
-
109
- end
110
- end
111
- end
@@ -1,45 +0,0 @@
1
- require 'run_loop'
2
-
3
- module Calabash
4
- module Cucumber
5
- # @!visibility private
6
- # A module for reading and writing property list values.
7
- module PlistBuddy
8
-
9
- # Reads key from file and returns the result.
10
- # @param [String] key the key to inspect (may not be nil or empty)
11
- # @param [String] file the plist to read
12
- # @param [Hash] opts options for controlling execution
13
- # @option opts [Boolean] :verbose (false) controls log level
14
- # @return [String] the value of the key
15
- # @raise [ArgumentError] if nil or empty key
16
- def plist_read(key, file, opts={})
17
- RunLoop::PlistBuddy.new.plist_read(key, file, opts)
18
- end
19
-
20
- # Checks if the key exists in plist.
21
- # @param [String] key the key to inspect (may not be nil or empty)
22
- # @param [String] file the plist to read
23
- # @param [Hash] opts options for controlling execution
24
- # @option opts [Boolean] :verbose (false) controls log level
25
- # @return [Boolean] true if the key exists in plist file
26
- def plist_key_exists?(key, file, opts={})
27
- plist_read(key, file, opts) != nil
28
- end
29
-
30
- # Replaces or creates the value of key in the file.
31
- #
32
- # @param [String] key the key to set (may not be nil or empty)
33
- # @param [String] type the plist type (used only when adding a value)
34
- # @param [String] value the new value
35
- # @param [String] file the plist to read
36
- # @param [Hash] opts options for controlling execution
37
- # @option opts [Boolean] :verbose (false) controls log level
38
- # @return [Boolean] true if the operation was successful
39
- # @raise [ArgumentError] if nil or empty key
40
- def plist_set(key, type, value, file, opts={})
41
- RunLoop::PlistBuddy.new.plist_set(key, type, value, file, opts)
42
- end
43
- end
44
- end
45
- end
@@ -1,334 +0,0 @@
1
- require 'calabash-cucumber/utils/xctools'
2
- require 'calabash-cucumber/utils/plist_buddy'
3
- require 'calabash-cucumber/utils/logging'
4
- require 'sim_launcher'
5
- require 'cfpropertylist'
6
- require 'run_loop'
7
-
8
- module Calabash
9
- module Cucumber
10
-
11
- # @deprecated 0.10.0 Replaced with RunLoop::SimControl
12
- # Public methods for common simulator tasks and private methods for
13
- # enabling accessibility on the simulator.
14
- module SimulatorAccessibility
15
-
16
- include Calabash::Cucumber::XcodeTools
17
- include Calabash::Cucumber::PlistBuddy
18
-
19
- # Quits the iOS Simulator.
20
- #
21
- # ATM there can only be only simulator open at a time, so simply doing
22
- # what the sim_launcher gem does:
23
- #
24
- # ```
25
- # def quit_simulator
26
- # `echo 'application "iPhone Simulator" quit' | osascript`
27
- # end
28
- # ```
29
- #
30
- # works. I am not sure if we will ever be able to launch more than one
31
- # simulator, but in case we can, this method will quit the simulator
32
- # that is indicated by `xcode-select` or `DEVELOPER_DIR`.
33
- def quit_simulator
34
- RunLoop::SimControl.new.quit_sim
35
- end
36
-
37
- # Launches the iOS Simulator indicated by `xcode-select` or `DEVELOPER_DIR`.
38
- def launch_simulator
39
- RunLoop::SimControl.new.launch_sim
40
- end
41
-
42
- # Resets the simulator content and settings. It is analogous to touching
43
- # the menu item.
44
- #
45
- # It works by deleting the following directories:
46
- #
47
- # * ~/Library/Application Support/iPhone Simulator/Library
48
- # * ~/Library/Application Support/iPhone Simulator/Library/<sdk>[-64]
49
- #
50
- # and relaunching the iOS Simulator which will recreate the Library
51
- # directory and the latest SDK directory.
52
- def reset_simulator_content_and_settings
53
- quit_simulator
54
- sim_lib_path = File.join(simulator_app_support_dir(), 'Library')
55
- FileUtils.rm_rf(sim_lib_path)
56
- existing_simulator_support_sdk_dirs.each do |dir|
57
- FileUtils.rm_rf(dir)
58
- end
59
-
60
- launch_simulator
61
-
62
- # this is tricky because we need to wait for the simulator to recreate
63
- # the directories. specifically, we need the Accessibility plist to be
64
- # exist so subsequent calabash launches will be able to enable
65
- # accessibility.
66
- #
67
- # the directories take ~3.0 - ~5.0 to create.
68
- counter = 0
69
- loop do
70
- break if counter == 80
71
- dirs = existing_simulator_support_sdk_dirs
72
- if dirs.count == 0
73
- sleep(0.2)
74
- else
75
- break if dirs.all? { |dir|
76
- plist = File.expand_path("#{dir}/Library/Preferences/com.apple.Accessibility.plist")
77
- File.exists?(plist)
78
- }
79
- sleep(0.2)
80
- end
81
- counter = counter + 1
82
- end
83
- end
84
-
85
- # @deprecated 0.10.0 replaced with RunLoop::SimControl#enable_accessibility_on_simulators
86
- # @!visibility private
87
- # Enables accessibility on any existing iOS Simulator by adjusting the
88
- # simulator's Library/Preferences/com.apple.Accessibility.plist contents.
89
- #
90
- # A simulator 'exists' if has an Application Support directory. for
91
- # example, the 6.1, 7.0.3-64, and 7.1 simulators exist if the following
92
- # directories are present:
93
- #
94
- # ~/Library/Application Support/iPhone Simulator/Library/6.1
95
- # ~/Library/Application Support/iPhone Simulator/Library/7.0.3-64
96
- # ~/Library/Application Support/iPhone Simulator/Library/7.1
97
- #
98
- # A simulator is 'possible' if the SDK is available in the Xcode version.
99
- #
100
- # This method merges (uniquely) the possible and existing SDKs.
101
- #
102
- # This method also hides the AXInspector.
103
- #
104
- # @param [Hash] opts controls the behavior of the method
105
- # @option opts [Boolean] :verbose controls logging output
106
- # @return [Boolean] true if enabling accessibility worked on all sdk
107
- # directories
108
- def enable_accessibility_on_simulators(opts={})
109
- _deprecated('0.10.0', 'replaced with RunLoop::SimControl#enable_accessibility_on_simulators', :warn)
110
- possible = possible_simulator_support_sdk_dirs
111
- existing = existing_simulator_support_sdk_dirs
112
- dirs = (possible + existing).uniq
113
- results = dirs.map do |dir|
114
- enable_accessibility_in_sdk_dir(dir, opts)
115
- end
116
- results.all? { |elm| elm }
117
- end
118
-
119
- @private
120
-
121
- # @deprecated 0.10.0 no replacement
122
- # @!visibility private
123
- # Enables accessibility on the simulator indicated by `sim_app_support_sdk_dir.`
124
- #
125
- # @note This will quit the simulator.
126
- #
127
- # @example
128
- # path = '/6.1'
129
- # enable_accessibility_in_sdk_dir(path)
130
- #
131
- # This method also hides the AXInspector.
132
- #
133
- # If the Library/Preferences/com.apple.Accessibility.plist does not exist
134
- # this method will create a Library/Preferences/com.apple.Accessibility.plist
135
- # that (oddly) the Simulator will _not_ overwrite.
136
- #
137
- # @see enable_accessibility_on_simulators for the public API.
138
- #
139
- # @param [String] sim_app_support_sdk_dir the directory where the
140
- # Library/Preferences/com.apple.Accessibility.plist can be found.
141
- #
142
- # @param [Hash] opts controls the behavior of the method
143
- # @option opts [Boolean] :verbose controls logging output
144
- # @return [Boolean] if the plist exists and the plist was successfully
145
- # updated.
146
- def enable_accessibility_in_sdk_dir(sim_app_support_sdk_dir, opts={})
147
- _deprecated('0.10.0', 'no replacement', :warn)
148
- default_opts = {:verbose => false}
149
- merged = default_opts.merge(opts)
150
-
151
- quit_simulator
152
-
153
- verbose = merged[:verbose]
154
- sdk = File.basename(sim_app_support_sdk_dir)
155
- msgs = ["cannot enable accessibility for #{sdk} SDK"]
156
-
157
- plist_path = File.expand_path("#{sim_app_support_sdk_dir}/Library/Preferences/com.apple.Accessibility.plist")
158
-
159
- hash = accessibility_properties_hash()
160
-
161
- if File.exist?(plist_path)
162
- res = hash.map do |hash_key, settings|
163
- success = plist_set(settings[:key], settings[:type], settings[:value], plist_path)
164
- unless success
165
- if verbose
166
- if settings[:type] == 'bool'
167
- value = settings[:value] ? 'YES' : 'NO'
168
- else
169
- value = settings[:value]
170
- end
171
- msgs << "could not set #{hash_key} => '#{settings[:key]}' to #{value}"
172
- calabash_warn(msgs.join("\n"))
173
- end
174
- end
175
- success
176
- end
177
- res.all? { |elm| elm }
178
- else
179
- FileUtils.mkdir_p("#{sim_app_support_sdk_dir}/Library/Preferences")
180
- plist = CFPropertyList::List.new
181
- data = {}
182
- # CFPropertyList gem is super wonky
183
- # it matches Boolean to a string type with 'true/false' values
184
- # - stick with PlistBuddy
185
- # hash.each do |_, settings|
186
- # data[settings[:key]] = settings[:value]
187
- # end
188
- plist.value = CFPropertyList.guess(data)
189
- plist.save(plist_path, CFPropertyList::List::FORMAT_BINARY)
190
- enable_accessibility_in_sdk_dir(sim_app_support_sdk_dir)
191
- end
192
- end
193
-
194
-
195
- # @deprecated 0.10.0 no replacement
196
- # @!visibility private
197
- # A hash table of the accessibility properties that control whether or not
198
- # accessibility is enabled and whether the AXInspector is visible.
199
- # @return [Hash] table of accessibility properties found in the
200
- # Library/Preferences/com.apple.Accessibility.plist
201
- def accessibility_properties_hash
202
- _deprecated('0.10.0', 'no replacement', :warn)
203
- {
204
- # this is required
205
- :access_enabled => {:key => 'AccessibilityEnabled',
206
- :value => 'true',
207
- :type => 'bool'},
208
- # i _think_ this is legacy
209
- :app_access_enabled => {:key => 'ApplicationAccessibilityEnabled',
210
- :value => 'true',
211
- :type => 'bool'},
212
-
213
- # i don't know what this does
214
- :automation_enabled => {:key => 'AutomationEnabled',
215
- :value => 'true',
216
- :type => 'bool'},
217
-
218
- # determines if the Accessibility Inspector is showing
219
- :inspector_showing => {:key => 'AXInspectorEnabled',
220
- :value => 'false',
221
- :type => 'bool'},
222
-
223
- # controls if the Accessibility Inspector is expanded or not expanded
224
- :inspector_full_size => {:key => 'AXInspector.enabled',
225
- :value => 'false',
226
- :type => 'bool'},
227
-
228
- # controls the frame of the Accessibility Inspector
229
- # this is a 'string' => {{0, 0}, {276, 166}}
230
- :inspector_frame => {:key => 'AXInspector.frame',
231
- :value => '{{270, -13}, {276, 166}}',
232
- :type => 'string'}
233
- }
234
- end
235
-
236
- # @deprecated 0.10.0 no replacement
237
- # @!visibility private
238
- # The absolute path to the iPhone Simulator Application Support directory.
239
- # @return [String] absolute path
240
- # @todo add deprecation message - ATM {Calabash::Cucumber::Launcher.reset_app_sandbox} is using this
241
- def simulator_app_support_dir
242
- File.expand_path('~/Library/Application Support/iPhone Simulator')
243
- end
244
-
245
- # @deprecated 0.10.0 no replacement
246
- # @!visibility private
247
- # The absolute path to the SDK's com.apple.Accessibility.plist file.
248
- # @param [String] sdk_dir base path the SDK directory
249
- # @return [String] an absolute path
250
- def plist_path_with_sdk_dir(sdk_dir)
251
- _deprecated('0.10.0', 'no replacement', :warn)
252
- File.expand_path("#{sdk_dir}/Library/Preferences/com.apple.Accessibility.plist")
253
- end
254
-
255
- # @deprecated 0.10.0 no replacement
256
- # @!visibility private
257
- # Returns a list of absolute paths the existing simulator directories.
258
- #
259
- # A simulator 'exists' if has an Application Support directory. for
260
- # example, the 6.1, 7.0.3-64, and 7.1 simulators exist if the following
261
- # directories are present:
262
- #
263
- # ~/Library/Application Support/iPhone Simulator/Library/6.1
264
- # ~/Library/Application Support/iPhone Simulator/Library/7.0.3-64
265
- # ~/Library/Application Support/iPhone Simulator/Library/7.1
266
- #
267
- # @return[Array<String>] a list of absolute paths to simulator directories
268
- # @todo add deprecation message - ATM ::reset_content_and_settings is using this
269
- def existing_simulator_support_sdk_dirs
270
- sim_app_support_path = simulator_app_support_dir()
271
- Dir.glob("#{sim_app_support_path}/*").select { |path|
272
- path =~ /(\d)\.(\d)\.?(\d)?(-64)?/
273
- }
274
- end
275
-
276
- # @deprecated 0.10 no replacement
277
- # @!visibility private
278
- # Returns a list of possible SDKs per Xcode version.
279
- #
280
- # It is not enough to ask for the available sdks because of the new 64-bit
281
- # variants that started to appear Xcode 5 and the potential for patch level
282
- # versions.
283
- #
284
- # Unfortunately, this method will need be maintained per Xcode version.
285
- #
286
- # @return [Array<String>] ex. ['6.1', '7.1', '7.0.3', '7.0.3-64']
287
- def possible_simulator_sdks
288
- _deprecated('0.10.0', 'no replacement', :warn)
289
- sdk_detector = SimLauncher::SdkDetector.new
290
- available = sdk_detector.available_sdk_versions
291
- instruments_version = instruments(:version)
292
-
293
- # in Xcode 5.1* SDK 7.0 ==> 7.0.3
294
- if (instruments_version == '5.1' or instruments_version == '5.1.1') and available.include?('7.0')
295
- available << '7.0.3'
296
- available << '7.0.3-64'
297
- end
298
-
299
- if instruments_version == '5.1.1' and available.include?('7.1')
300
- available << '7.1'
301
- available << '7.1-64'
302
- end
303
-
304
- gem_compat_xcode_versions = ['5.1', '5.1.1']
305
- unless gem_compat_xcode_versions.include?(instruments_version)
306
- msg = ["expected Xcode instruments version to be '5.1' or '5.1.1'",
307
- "but found version '#{instruments_version}'",
308
- "Gem needs a manual update for Xcode #{instruments_version}!"].join("\n")
309
- calabash_warn(msg)
310
- end
311
-
312
- # in Xcode 5.1* SDK 7.0 ==> 7.0.3 so we should not include '7.0'
313
- # if the user's support directory already contains a 7.0 and 7.0-64 dir
314
- # we will detect it by reading from disk.
315
- (available - ['7.0']).uniq.sort
316
- end
317
-
318
- # @deprecated 0.10.0 no replacement
319
- # @!visibility private
320
- # Return absolute paths to possible simulator support sdk dirs.
321
- #
322
- # these directories may or may not exist
323
- # @return [Array<String>] an array of absolute paths
324
- def possible_simulator_support_sdk_dirs
325
- _deprecated('0.10.0', 'no replacement', :warn)
326
- base_dir = simulator_app_support_dir
327
- possible_simulator_sdks.map { |sdk|
328
- "#{base_dir}/#{sdk}"
329
- }
330
- end
331
-
332
- end
333
- end
334
- end