calabash-cucumber 0.10.0.pre1 → 0.10.0.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.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/features/step_definitions/calabash_steps.rb +1 -1
  3. data/lib/calabash-cucumber/actions/instruments_actions.rb +15 -4
  4. data/lib/calabash-cucumber/actions/playback_actions.rb +12 -3
  5. data/lib/calabash-cucumber/connection.rb +3 -0
  6. data/lib/calabash-cucumber/connection_helpers.rb +4 -0
  7. data/lib/calabash-cucumber/core.rb +637 -83
  8. data/lib/calabash-cucumber/date_picker.rb +148 -29
  9. data/lib/calabash-cucumber/device.rb +160 -3
  10. data/lib/calabash-cucumber/environment_helpers.rb +91 -46
  11. data/lib/calabash-cucumber/failure_helpers.rb +40 -0
  12. data/lib/calabash-cucumber/http_helpers.rb +9 -2
  13. data/lib/calabash-cucumber/ibase.rb +136 -17
  14. data/lib/calabash-cucumber/ios7_operations.rb +13 -9
  15. data/lib/calabash-cucumber/ipad_1x_2x.rb +103 -48
  16. data/lib/calabash-cucumber/keyboard_helpers.rb +253 -144
  17. data/lib/calabash-cucumber/keychain_helpers.rb +46 -32
  18. data/lib/calabash-cucumber/launch/simulator_helper.rb +13 -12
  19. data/lib/calabash-cucumber/launch/simulator_launcher.rb +111 -78
  20. data/lib/calabash-cucumber/launcher.rb +265 -25
  21. data/lib/calabash-cucumber/map.rb +24 -22
  22. data/lib/calabash-cucumber/operations.rb +4 -160
  23. data/lib/calabash-cucumber/playback_helpers.rb +26 -0
  24. data/lib/calabash-cucumber/query_helpers.rb +12 -0
  25. data/lib/calabash-cucumber/rotation_helpers.rb +64 -8
  26. data/lib/calabash-cucumber/status_bar_helpers.rb +40 -3
  27. data/lib/calabash-cucumber/tests_helpers.rb +43 -14
  28. data/lib/calabash-cucumber/uia.rb +93 -9
  29. data/lib/calabash-cucumber/utils/logging.rb +30 -16
  30. data/lib/calabash-cucumber/utils/plist_buddy.rb +18 -19
  31. data/lib/calabash-cucumber/utils/simulator_accessibility.rb +41 -30
  32. data/lib/calabash-cucumber/utils/xctools.rb +31 -21
  33. data/lib/calabash-cucumber/version.rb +98 -2
  34. data/lib/calabash-cucumber/wait_helpers.rb +257 -77
  35. data/staticlib/calabash.framework.zip +0 -0
  36. metadata +64 -231
  37. data/.gitignore +0 -17
  38. data/CHANGES.txt +0 -1
  39. data/Gemfile +0 -4
  40. data/Rakefile +0 -72
  41. data/calabash-cucumber.gemspec +0 -36
  42. data/epl-v10.html +0 -261
  43. data/lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64 +0 -51
  44. data/lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64 +0 -51
  45. data/lib/calabash-cucumber/resources/cell_swipe_ios5_ipad.base64 +0 -74
  46. data/lib/calabash-cucumber/resources/cell_swipe_ios5_iphone.base64 +0 -74
  47. data/lib/calabash-cucumber/resources/double_tap_ios5_ipad.base64 +0 -15
  48. data/lib/calabash-cucumber/resources/double_tap_ios5_iphone.base64 +0 -15
  49. data/lib/calabash-cucumber/resources/double_tap_ios6_ipad.base64 +0 -22
  50. data/lib/calabash-cucumber/resources/double_tap_ios6_iphone.base64 +0 -22
  51. data/lib/calabash-cucumber/resources/pan_ios5_ipad.base64 +0 -199
  52. data/lib/calabash-cucumber/resources/pan_ios5_iphone.base64 +0 -199
  53. data/lib/calabash-cucumber/resources/pan_ios6_ipad.base64 +0 -206
  54. data/lib/calabash-cucumber/resources/pan_ios6_iphone.base64 +0 -206
  55. data/lib/calabash-cucumber/resources/pinch_in_ios4_ipad.base64 +0 -104
  56. data/lib/calabash-cucumber/resources/pinch_in_ios4_iphone.base64 +0 -104
  57. data/lib/calabash-cucumber/resources/pinch_in_ios5_ipad.base64 +0 -144
  58. data/lib/calabash-cucumber/resources/pinch_in_ios5_iphone.base64 +0 -144
  59. data/lib/calabash-cucumber/resources/pinch_in_ios6_ipad.base64 +0 -70
  60. data/lib/calabash-cucumber/resources/pinch_in_ios6_iphone.base64 +0 -70
  61. data/lib/calabash-cucumber/resources/pinch_out_ios5_ipad.base64 +0 -207
  62. data/lib/calabash-cucumber/resources/pinch_out_ios5_iphone.base64 +0 -207
  63. data/lib/calabash-cucumber/resources/pinch_out_ios6_ipad.base64 +0 -96
  64. data/lib/calabash-cucumber/resources/pinch_out_ios6_iphone.base64 +0 -96
  65. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_ipad.base64 +0 -2
  66. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_iphone.base64 +0 -2
  67. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_ipad.base64 +0 -2
  68. data/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_iphone.base64 +0 -2
  69. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_ipad.base64 +0 -2
  70. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_iphone.base64 +0 -2
  71. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_ipad.base64 +0 -2
  72. data/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_iphone.base64 +0 -2
  73. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_ipad.base64 +0 -2
  74. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_iphone.base64 +0 -2
  75. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_ipad.base64 +0 -2
  76. data/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_iphone.base64 +0 -2
  77. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_ipad.base64 +0 -2
  78. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_iphone.base64 +0 -2
  79. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_ipad.base64 +0 -2
  80. data/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_iphone.base64 +0 -2
  81. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_ipad.base64 +0 -2
  82. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_iphone.base64 +0 -2
  83. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_ipad.base64 +0 -2
  84. data/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_iphone.base64 +0 -2
  85. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_ipad.base64 +0 -2
  86. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_iphone.base64 +0 -2
  87. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_ipad.base64 +0 -2
  88. data/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_iphone.base64 +0 -2
  89. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_ipad.base64 +0 -2
  90. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_iphone.base64 +0 -2
  91. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_ipad.base64 +0 -2
  92. data/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_iphone.base64 +0 -2
  93. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_ipad.base64 +0 -2
  94. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_iphone.base64 +0 -2
  95. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_ipad.base64 +0 -2
  96. data/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_iphone.base64 +0 -2
  97. data/lib/calabash-cucumber/resources/swipe_down_ios5_ipad.base64 +0 -18
  98. data/lib/calabash-cucumber/resources/swipe_down_ios5_iphone.base64 +0 -31
  99. data/lib/calabash-cucumber/resources/swipe_down_ios6_ipad.base64 +0 -25
  100. data/lib/calabash-cucumber/resources/swipe_down_ios6_iphone.base64 +0 -25
  101. data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_ipad.base64 +0 -15
  102. data/lib/calabash-cucumber/resources/swipe_left_hard_ios4_iphone.base64 +0 -15
  103. data/lib/calabash-cucumber/resources/swipe_left_ios4_ipad.base64 +0 -18
  104. data/lib/calabash-cucumber/resources/swipe_left_ios4_iphone.base64 +0 -18
  105. data/lib/calabash-cucumber/resources/swipe_left_ios5_ipad.base64 +0 -17
  106. data/lib/calabash-cucumber/resources/swipe_left_ios5_iphone.base64 +0 -34
  107. data/lib/calabash-cucumber/resources/swipe_left_ios6_ipad.base64 +0 -28
  108. data/lib/calabash-cucumber/resources/swipe_left_ios6_iphone.base64 +0 -28
  109. data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_ipad.base64 +0 -17
  110. data/lib/calabash-cucumber/resources/swipe_right_hard_ios4_iphone.base64 +0 -17
  111. data/lib/calabash-cucumber/resources/swipe_right_ios4_ipad.base64 +0 -13
  112. data/lib/calabash-cucumber/resources/swipe_right_ios4_iphone.base64 +0 -13
  113. data/lib/calabash-cucumber/resources/swipe_right_ios5_ipad.base64 +0 -17
  114. data/lib/calabash-cucumber/resources/swipe_right_ios5_iphone.base64 +0 -17
  115. data/lib/calabash-cucumber/resources/swipe_right_ios6_ipad.base64 +0 -25
  116. data/lib/calabash-cucumber/resources/swipe_right_ios6_iphone.base64 +0 -25
  117. data/lib/calabash-cucumber/resources/swipe_up_ios5_ipad.base64 +0 -34
  118. data/lib/calabash-cucumber/resources/swipe_up_ios5_iphone.base64 +0 -28
  119. data/lib/calabash-cucumber/resources/swipe_up_ios6_ipad.base64 +0 -25
  120. data/lib/calabash-cucumber/resources/swipe_up_ios6_iphone.base64 +0 -25
  121. data/lib/calabash-cucumber/resources/touch_done_ios4_ipad.base64 +0 -7
  122. data/lib/calabash-cucumber/resources/touch_done_ios4_iphone.base64 +0 -9
  123. data/lib/calabash-cucumber/resources/touch_done_ios5_ipad.base64 +0 -7
  124. data/lib/calabash-cucumber/resources/touch_done_ios5_iphone.base64 +0 -9
  125. data/lib/calabash-cucumber/resources/touch_hold_ios5_ipad.base64 +0 -9
  126. data/lib/calabash-cucumber/resources/touch_hold_ios5_iphone.base64 +0 -9
  127. data/lib/calabash-cucumber/resources/touch_hold_ios6_ipad.base64 +0 -9
  128. data/lib/calabash-cucumber/resources/touch_hold_ios6_iphone.base64 +0 -9
  129. data/lib/calabash-cucumber/resources/touch_ios4_ipad.base64 +0 -9
  130. data/lib/calabash-cucumber/resources/touch_ios4_iphone.base64 +0 -9
  131. data/lib/calabash-cucumber/resources/touch_ios5_ipad.base64 +0 -9
  132. data/lib/calabash-cucumber/resources/touch_ios5_iphone.base64 +0 -9
  133. data/lib/calabash-cucumber/resources/touch_ios7_ipad.base64 +0 -9
  134. data/lib/calabash-cucumber/resources/touch_ios7_iphone.base64 +0 -9
  135. data/lib/calabash-cucumber/resources/wheel_down_ios4_ipad.base64 +0 -159
  136. data/lib/calabash-cucumber/resources/wheel_down_ios4_iphone.base64 +0 -159
  137. data/lib/calabash-cucumber/resources/wheel_down_ios5_ipad.base64 +0 -156
  138. data/lib/calabash-cucumber/resources/wheel_down_ios5_iphone.base64 +0 -156
  139. data/lib/calabash-cucumber/resources/wheel_up_ios4_ipad.base64 +0 -166
  140. data/lib/calabash-cucumber/resources/wheel_up_ios4_iphone.base64 +0 -166
  141. data/lib/calabash-cucumber/resources/wheel_up_ios5_ipad.base64 +0 -156
  142. data/lib/calabash-cucumber/resources/wheel_up_ios5_iphone.base64 +0 -156
  143. data/scripts/EmptyAppHack.app/Default-568h@2x.png +0 -0
  144. data/scripts/EmptyAppHack.app/Default.png +0 -0
  145. data/scripts/EmptyAppHack.app/Default@2x.png +0 -0
  146. data/scripts/EmptyAppHack.app/EmptyAppHack +0 -0
  147. data/scripts/EmptyAppHack.app/Info.plist +0 -0
  148. data/scripts/EmptyAppHack.app/PkgInfo +0 -1
  149. data/scripts/EmptyAppHack.app/en.lproj/InfoPlist.strings +0 -0
  150. data/scripts/com.example.plist +0 -0
  151. data/scripts/data/.GlobalPreferences.plist +0 -0
  152. data/scripts/reset_simulator.scpt +0 -0
  153. data/spec/bin/calabash_ios_sim_spec.rb +0 -24
  154. data/spec/launcher_spec.rb +0 -166
  155. data/spec/logging_spec.rb +0 -38
  156. data/spec/plist_buddy_spec.rb +0 -99
  157. data/spec/resources/enable-accessibility/6.1/.gitkeep +0 -0
  158. data/spec/resources/enable-accessibility/7.0.3-64/.gitkeep +0 -0
  159. data/spec/resources/enable-accessibility/7.0.3/.gitkeep +0 -0
  160. data/spec/resources/enable-accessibility/7.1-64/.gitkeep +0 -0
  161. data/spec/resources/enable-accessibility/7.1/.gitkeep +0 -0
  162. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/Default-568h@2x.png +0 -0
  163. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/Info.plist +0 -0
  164. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/LPSimpleExample-cal +0 -0
  165. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/PkgInfo +0 -1
  166. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/InfoPlist.strings +0 -0
  167. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFirstViewController.nib +0 -0
  168. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFirstViewController~ipad.nib +0 -0
  169. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFourthViewController.nib +0 -0
  170. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPFourthViewController~ipad.nib +0 -0
  171. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPSecondViewController.nib +0 -0
  172. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPSecondViewController~ipad.nib +0 -0
  173. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPThirdViewController.nib +0 -0
  174. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/en.lproj/LPThirdViewController~ipad.nib +0 -0
  175. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/first.png +0 -0
  176. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/first@2x.png +0 -0
  177. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/second.png +0 -0
  178. data/spec/resources/enable-accessibility/LPSimpleExample-cal.app/second@2x.png +0 -0
  179. data/spec/resources/plist_buddy/com.example.plist +0 -0
  180. data/spec/resources/plist_buddy/com.testing.plist +0 -18
  181. data/spec/simulator_accessibility_spec.rb +0 -206
  182. data/spec/spec_helper.rb +0 -31
  183. data/spec/version_spec.rb +0 -13
  184. data/spec/xctools_spec.rb +0 -58
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- APPL????
Binary file
Binary file
Binary file
@@ -1,24 +0,0 @@
1
- require File.expand_path(File.join(__FILE__, '..', '..', 'spec_helper'))
2
- require File.expand_path(File.join(__FILE__, '..', '..', '..', 'bin', 'calabash-ios-sim'))
3
- require 'calabash-cucumber/utils/simulator_accessibility'
4
- require 'calabash-cucumber/wait_helpers'
5
-
6
- include Calabash::Cucumber::WaitHelpers
7
-
8
- describe 'calabash ios sim cli' do
9
-
10
- it 'should deprecate the sim_quit method' do
11
- out = capture_stderr do
12
- quit_sim
13
- end
14
- tokens = out.string.split("\n")
15
- puts tokens
16
- expect(tokens[1]).to be == "WARN: deprecated '0.9.169' - 'use Calabash::Cucumber::SimulatorAccessibility.quit_simulator'"
17
- end
18
-
19
- it 'should be able to reset the content and settings of the simulator' do
20
- calabash_sim_reset
21
- expect(existing_simulator_support_sdk_dirs.count).to be == 1
22
- end
23
-
24
- end
@@ -1,166 +0,0 @@
1
- require 'spec_helper'
2
- require 'calabash-cucumber/launcher'
3
- require 'run_loop'
4
-
5
- describe 'Calabash Launcher' do
6
-
7
- UDID = '66h3hfgc466836ehcg72738eh8f322842855d2fd'
8
- IPHONE_4IN_R_64 = 'iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1'
9
- before(:each) do
10
- @launcher = Calabash::Cucumber::Launcher.new
11
- end
12
-
13
- before(:each) do
14
- ENV['DEVICE_TARGET'] = nil
15
- ENV['DETECT_CONNECTED_DEVICE'] = nil
16
- end
17
-
18
- def set_device_target(val)
19
- ENV['DEVICE_TARGET'] = val
20
- end
21
-
22
- describe 'simulator_target? should respond correctly to DEVICE_TARGET' do
23
-
24
- it 'should return true if DEVICE_TARGET is nil' do
25
- expect(@launcher.simulator_target?).to be == false
26
- end
27
-
28
- it 'should return true if DEVICE_TARGET is simulator' do
29
- set_device_target('simulator')
30
- expect(@launcher.simulator_target?).to be == true
31
- end
32
-
33
- it 'should return false if DEVICE_TARGET is device' do
34
- set_device_target('device')
35
- expect(@launcher.simulator_target?).to be == false
36
- end
37
-
38
- it 'should return false if DEVICE_TARGET is udid' do
39
- # noinspection SpellCheckingInspection
40
- set_device_target(UDID)
41
- expect(@launcher.simulator_target?).to be == false
42
- end
43
-
44
- it 'should return true for Xcode 5.1 style simulator names' do
45
- set_device_target('iPhone Retina (4-inch) - Simulator - iOS 7.1')
46
- expect(@launcher.simulator_target?).to be == true
47
-
48
- set_device_target('iPhone - Simulator - iOS 6.1')
49
- expect(@launcher.simulator_target?).to be == true
50
-
51
- set_device_target('iPad Retina (64-bit) - Simulator - iOS 7.0')
52
- expect(@launcher.simulator_target?).to be == true
53
- end
54
-
55
- it 'should return true when passed a hash with :device_target => a simulator' do
56
- hash = {:device_target => 'simulator'}
57
- expect(@launcher.simulator_target?(hash)).to be == true
58
-
59
- hash = {:device_target => 'iPhone Retina (4-inch) - Simulator - iOS 7.1'}
60
- expect(@launcher.simulator_target?(hash)).to be == true
61
- end
62
-
63
- it 'should return false when passed a hash with :device_target != a simulator' do
64
- hash = {:device_target => 'device'}
65
- expect(@launcher.simulator_target?(hash)).to be == false
66
-
67
- hash = {:device_target => UDID}
68
- expect(@launcher.simulator_target?(hash)).to be == false
69
-
70
- hash = {:device_target => 'foobar'}
71
- expect(@launcher.simulator_target?(hash)).to be == false
72
- end
73
-
74
- it 'should return false when passed a hash with no :device_target key' do
75
- hash = {:foobar => 'foobar'}
76
- expect(@launcher.simulator_target?(hash)).to be == false
77
- end
78
-
79
- end
80
-
81
- describe 'default launch args should respect DEVICE_TARGET' do
82
-
83
- it "it should return 'simulator' if DEVICE_TARGET nil" do
84
- args = @launcher.default_launch_args
85
- expect(args[:device_target]).to be == 'simulator'
86
- end
87
-
88
- describe 'running with instruments' do
89
-
90
- it 'should be running against instruments' do
91
- args = @launcher.default_launch_args
92
- expect(args[:launch_method]).to be == :instruments
93
- end
94
-
95
- describe 'running against devices' do
96
-
97
- describe 'when DEVICE_TARGET = < udid >' do
98
- before(:each) do
99
- ENV['DEVICE_TARGET'] = UDID
100
- end
101
-
102
- it 'it should return udid if DEVICE_TARGET is a udid' do
103
- args = @launcher.default_launch_args
104
- expect(args[:device_target]).to be == UDID
105
- expect(args[:udid]).to be == UDID
106
- end
107
- end
108
-
109
- describe 'when DEVICE_TARGET = device' do
110
- before(:each) do
111
- ENV['DEVICE_TARGET'] = 'device'
112
- end
113
-
114
- describe 'detecting connected devices' do
115
- describe "when DETECT_CONNECTED_DEVICE == '1'" do
116
- it 'should return a udid if DEVICE_TARGET=device if a device is connected and simulator otherwise' do
117
- ENV['DETECT_CONNECTED_DEVICE'] = '1'
118
- args = @launcher.default_launch_args
119
- target = args[:device_target]
120
- detected = RunLoop::Core.detect_connected_device
121
-
122
- if detected
123
- expect(target).to be == detected
124
- expect(args[:udid]).to be == detected
125
- else
126
- pending('this behavior is needs verification')
127
- expect(target).to be == 'simulator'
128
- end
129
- end
130
-
131
- describe "when DETECT_CONNECTED_DEVICE != '1'" do
132
- it 'should return a udid if DEVICE_TARGET=device if a device is connected and simulator otherwise' do
133
- args = @launcher.default_launch_args
134
- target = args[:device_target]
135
- expect(target).to be == 'device'
136
- expect(args[:udid]).to be == 'device'
137
- end
138
- end
139
- end
140
- end
141
- end
142
- end
143
-
144
- describe 'running against simulators' do
145
-
146
- describe 'DEVICE_TARGET is an iphone in Xcode 5.1 format' do
147
- before(:each) do
148
- ENV['DEVICE_TARGET'] = IPHONE_4IN_R_64
149
- end
150
-
151
- it 'should return the correct simulator' do
152
- args = @launcher.default_launch_args
153
- expect(args[:device_target]).to be == IPHONE_4IN_R_64
154
- end
155
-
156
- end
157
-
158
- end
159
- end
160
-
161
- describe 'running without instruments' do
162
-
163
-
164
- end
165
- end
166
- end
data/spec/logging_spec.rb DELETED
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
- require 'stringio'
3
-
4
- describe 'calabash logging' do
5
-
6
- include Calabash::Cucumber::Logging
7
-
8
- it 'should output info messages' do
9
- info_msg = 'this is an info message'
10
- calabash_info(info_msg)
11
- out = capture_stdout do
12
- calabash_info(info_msg)
13
- end
14
- expect(out.string).to be == "\e[32m\nINFO: #{info_msg}\e[0m\n"
15
- end
16
-
17
- it 'should output warning messages' do
18
- warn_msg = 'this is a warning message'
19
- calabash_warn(warn_msg)
20
- out = capture_stderr do
21
- calabash_warn(warn_msg)
22
- end
23
- expect(out.string).to be == "\e[34m\nWARN: #{warn_msg}\e[0m\n"
24
- end
25
-
26
- it 'should output deprecated messages' do
27
- version = '0.9.169'
28
- dep_msg = 'this is a deprecation message'
29
- _deprecated(version, dep_msg, :warn)
30
- out = capture_stderr do
31
- _deprecated(version, dep_msg, :warn)
32
- end
33
- tokens = out.string.split("\n")
34
- expect("#{tokens[0]}\n#{tokens[1]}").to be == "\e[34m\nWARN: deprecated '#{version}' - '#{dep_msg}'"
35
- expect(tokens.count).to be == 7
36
- end
37
-
38
- end
@@ -1,99 +0,0 @@
1
- require 'calabash-cucumber/utils/plist_buddy'
2
-
3
- include Calabash::Cucumber::PlistBuddy
4
-
5
- describe '.plist editing' do
6
-
7
- describe 'plist_buddy method' do
8
- it 'should return the path to the plist_buddy binary' do
9
- expect(plist_buddy).to be == '/usr/libexec/PlistBuddy'
10
- end
11
- end
12
-
13
- describe 'build_plist_cmd' do
14
-
15
- TEMPLATE_PLIST = File.expand_path('./spec/resources/plist_buddy/com.example.plist')
16
- TESTING_PLIST = File.expand_path('./spec/resources/plist_buddy/com.testing.plist')
17
-
18
- before(:each) do
19
- FileUtils.rm(TESTING_PLIST) if File.exist?(TESTING_PLIST)
20
- FileUtils.cp(TEMPLATE_PLIST, TESTING_PLIST)
21
- end
22
-
23
- describe 'raises errors' do
24
-
25
- it 'should raise error if file does not exist' do
26
- expect { build_plist_cmd(:foo, nil, '/path/does/not/exist') }.to raise_error(RuntimeError)
27
- end
28
-
29
- it 'should raise error if command is not valid' do
30
- expect { build_plist_cmd(:foo, nil, TESTING_PLIST) }.to raise_error(ArgumentError)
31
- end
32
-
33
- it 'should raise error if args_hash is missing required key/value pairs' do
34
- expect { build_plist_cmd(:print, {:foo => 'bar'}, TESTING_PLIST) }.to raise_error(ArgumentError)
35
- end
36
-
37
- end
38
-
39
- describe 'composing commands' do
40
-
41
- it 'should compose print commands' do
42
- cmd = build_plist_cmd(:print, {:key => 'foo'}, TESTING_PLIST)
43
- expect(cmd).to be == "/usr/libexec/PlistBuddy -c \"Print :foo\" \"#{TESTING_PLIST}\""
44
- end
45
-
46
- it 'should compose set commands' do
47
- cmd = build_plist_cmd(:set, {:key => 'foo', :value => 'bar'}, TESTING_PLIST)
48
- expect(cmd).to be == "/usr/libexec/PlistBuddy -c \"Set :foo bar\" \"#{TESTING_PLIST}\""
49
- end
50
-
51
- it 'should compose add commands' do
52
- cmd = build_plist_cmd(:add, {:key => 'foo', :value => 'bar', :type => 'bool'}, TESTING_PLIST)
53
- expect(cmd).to be == "/usr/libexec/PlistBuddy -c \"Add :foo bool bar\" \"#{TESTING_PLIST}\""
54
- end
55
-
56
- end
57
-
58
- describe 'reading properties' do
59
-
60
- VERBOSE = {:verbose => true}
61
- QUIET = {:verbose => false}
62
-
63
- hash =
64
- {
65
-
66
- :access_enabled => 'AccessibilityEnabled',
67
- :app_access_enabled => 'ApplicationAccessibilityEnabled',
68
- :automation_enabled => 'AutomationEnabled',
69
- :inspector_showing => 'AXInspectorEnabled',
70
- :inspector_full_size => 'AXInspector.enabled',
71
- :inspector_frame => 'AXInspector.frame'
72
- }
73
-
74
- it 'should read properties' do
75
- res = plist_read(hash[:inspector_showing], TESTING_PLIST, QUIET)
76
- expect(res).to be == 'false'
77
-
78
- res = plist_read('FOO', TESTING_PLIST, QUIET)
79
- expect(res).to be == nil
80
- end
81
-
82
- it 'should set existing properties' do
83
- res = plist_set(hash[:inspector_showing], 'bool', 'true', TESTING_PLIST, QUIET)
84
- expect(res).to be == true
85
-
86
- res = plist_read(hash[:inspector_showing], TESTING_PLIST, QUIET)
87
- expect(res).to be == 'true'
88
- end
89
-
90
- it 'should add new properties' do
91
- res = plist_set('FOO', 'bool', 'true', TESTING_PLIST, QUIET)
92
- expect(res).to be == true
93
-
94
- res = plist_read('FOO', TESTING_PLIST, QUIET)
95
- expect(res).to be == 'true'
96
- end
97
- end
98
- end
99
- end
File without changes
File without changes
File without changes
File without changes
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>AXInspectorEnabled</key>
6
- <false/>
7
- <key>AssistiveTouchEnabled</key>
8
- <false/>
9
- <key>AssistiveTouchHardwareEnabled</key>
10
- <false/>
11
- <key>AssistiveTouchScannerEnabled</key>
12
- <false/>
13
- <key>FOO</key>
14
- <true/>
15
- <key>VoiceOverTouchEnabled</key>
16
- <false/>
17
- </dict>
18
- </plist>
@@ -1,206 +0,0 @@
1
- require 'spec_helper'
2
- require 'calabash-cucumber/utils/simulator_accessibility'
3
- require 'calabash-cucumber/launcher'
4
- require 'sim_launcher'
5
-
6
- include Calabash::Cucumber::SimulatorAccessibility
7
-
8
- describe 'simulator accessibility tool' do
9
-
10
- it 'should be able to find the simulator app support directory' do
11
- path = simulator_app_support_dir
12
- expect(File.exist?(path)).to be == true
13
- end
14
-
15
- it 'should be able to open and close the simulator' do
16
- cmd = "ps auxw | grep \"iPhone Simulator.app/Contents/MacOS/iPhone Simulator\" | grep -v grep"
17
-
18
- quit_simulator
19
- sleep(2)
20
- expect(`#{cmd}`.split("\n").count).to be == 0
21
-
22
- launch_simulator
23
- sleep(4)
24
- expect(`#{cmd}`.split("\n").count).to be == 1
25
- end
26
-
27
- it 'should be able to return a path a com.apple.Accessibility.plist for an SDK' do
28
- sdk = "#{simulator_app_support_dir}/7.1"
29
- expected = "#{sdk}/Library/Preferences/com.apple.Accessibility.plist"
30
- actual = plist_path_with_sdk_dir(sdk)
31
- expect(actual).to be == expected
32
- end
33
-
34
- # brittle because some users will not have installed 6.1 or 7.0, but hey, why
35
- # are them gem dev'ing or gem testing?
36
- it 'should be able to return possible SDKs' do
37
- actual = possible_simulator_sdks
38
- instruments_version = instruments(:version)
39
-
40
- if instruments_version == '5.1' or instruments_version == '5.1.1'
41
- expected = ['6.1', '7.0.3', '7.0.3-64', '7.1', '7.1-64']
42
- expect(actual).to be == expected
43
- else
44
- pending("Xcode version '#{instruments_version}' is not supported by this test - gem needs update!")
45
- end
46
- end
47
-
48
- # brittle because some users will not have installed 6.1 or 7.0, but hey, why
49
- # are them gem dev'ing or gem testing?
50
- it 'should be able to return Simulator Support SDK dirs' do
51
- actual = possible_simulator_support_sdk_dirs
52
- instruments_version = instruments(:version)
53
- if instruments_version == '5.1' or instruments_version == '5.1.1'
54
- expect(actual.count).to be == 5
55
- else
56
- pending("Xcode version '#{instruments_version}' is not supported by this test - gem needs update!")
57
- end
58
- end
59
-
60
- it 'should be able to find existing simulator support sdk dirs' do
61
- mocked_support_dir = File.expand_path(File.join(__FILE__, '..', 'resources/enable-accessibility/'))
62
- self.should_receive(:simulator_app_support_dir).and_return(mocked_support_dir)
63
- actual = existing_simulator_support_sdk_dirs
64
- expect(actual.count).to be == 5
65
- end
66
-
67
-
68
- describe 'enabling accessibility' do
69
-
70
- before(:each) do
71
- @sim_launcher = SimLauncher::Simulator.new
72
- @sdk_detector = SimLauncher::SdkDetector.new(@sim_launcher)
73
- quit_simulator
74
-
75
- @latest_sdk = @sdk_detector.latest_sdk_version
76
- @device_target = "iPhone Retina (4-inch) - Simulator - iOS #{@latest_sdk}"
77
- @launch_args =
78
- {
79
- :launch_method => :instruments,
80
- :reset => false,
81
- :bundle_id => nil,
82
- :device => 'iphone',
83
- :no_stop => false,
84
- :no_launch => false,
85
- :sdk_version => @latest_sdk,
86
- :app => lp_simple_example,
87
- :timeout => 30,
88
- :device_target => @device_target,
89
- :launch_retries => 1
90
- }
91
-
92
- @launcher = Calabash::Cucumber::Launcher.new
93
-
94
- end
95
-
96
- def lp_simple_example
97
- File.expand_path(File.join(__FILE__, '..', 'resources/enable-accessibility/LPSimpleExample-cal.app'))
98
- end
99
-
100
- def repopulate_sim_app_support_for_sdk(sdk=@sdk_detector.latest_sdk_version)
101
- path = File.join(simulator_app_support_dir, "#{sdk}")
102
- unless File.exist?(path)
103
- calabash_info("repopulating simulator app support for sdk '#{sdk}'")
104
- quit_simulator
105
- @sim_launcher.launch_iphone_app(lp_simple_example, sdk)
106
- sleep(5)
107
- quit_simulator
108
- end
109
- end
110
-
111
- describe 'on existing SDK directories' do
112
-
113
- before(:each) do
114
- reset_simulator_content_and_settings
115
- end
116
-
117
- it 'should not be able to launch LPSimpleExample-app b/c accessibility is not enabled' do
118
- msgs =
119
- [
120
- 'Will throw a "ScriptAgent quit unexpectedly" UI dialog!',
121
- '',
122
- 'This dialog is generated because the app failed to a launch',
123
- 'correctly on the simulator. I checked run_loop and this is not',
124
- 'caused by anything there.',
125
- '',
126
- 'AFAICT there is nothing to be done about this.']
127
- calabash_warn(msgs.join("\n"))
128
- begin
129
- expect { @launcher.new_run_loop(@launch_args) }.to raise_error(Calabash::Cucumber::Launcher::StartError)
130
- ensure
131
- @launcher.stop
132
- end
133
- end
134
-
135
- it 'should be able to enable accessibility for the latest sdk' do
136
- repopulate_sim_app_support_for_sdk(@latest_sdk)
137
-
138
- dir = File.join(simulator_app_support_dir, "#{@latest_sdk}")
139
- enable_accessibility_in_sdk_dir(dir)
140
-
141
- begin
142
- expect(@launcher.new_run_loop(@launch_args)).to be_a(Hash)
143
- ensure
144
- @launcher.stop
145
- end
146
-
147
- end
148
- end
149
-
150
- describe 'on non-existing SDK directories' do
151
- before(:each) do
152
- quit_simulator
153
- sleep(2)
154
- existing_simulator_support_sdk_dirs.each do |dir|
155
- FileUtils.rm_rf(dir)
156
- end
157
-
158
- reset_simulator_content_and_settings
159
-
160
- quit_simulator
161
- # let the iOS Simulator do what it needs to do at shut-down
162
- sleep(2)
163
- end
164
-
165
- it 'should be able to enable accessibility on all possible simulators' do
166
- enable_accessibility_on_simulators
167
- @launch_args[:sdk_version] = nil
168
- @launch_args[:timeout] = 20
169
- @launch_args[:launch_retries] = 3
170
-
171
- # these configurations correspond to iOS/Hardware configurations that
172
- # do not exist. As an example, there is no iOS 6.1 64-bit implementation,
173
- # so a simulator like:
174
- #
175
- # 'iPhone Retina (4-inch 64-bit) - Simulator - iOS 6.1'
176
- #
177
- # does not even make sense.
178
- #
179
- # ditto for 'iPhone - Simulator - iOS 7.0' - there is no non-retina
180
- # iOS 7 hardware
181
- # -1 Apple
182
- excluded = [
183
- 'iPhone - Simulator - iOS 7.0',
184
- 'iPhone - Simulator - iOS 7.1',
185
- 'iPhone Retina (4-inch 64-bit) - Simulator - iOS 6.1',
186
- 'iPad Retina (64-bit) - Simulator - iOS 6.1'
187
- ]
188
- instruments(:sims).each do |simulator|
189
- if excluded.include?(simulator)
190
- calabash_warn("skipping simulator '#{simulator}' - instruments passed us an invalid configuration!")
191
- else
192
- @launch_args[:device_target] = simulator
193
- calabash_info("starting simulator '#{simulator}'")
194
- begin
195
- expect(@launcher.new_run_loop(@launch_args)).to be_a(Hash)
196
- ensure
197
- @launcher.stop
198
- sleep(2)
199
- end
200
- end
201
- end
202
- end
203
-
204
- end
205
- end
206
- end