iCuke 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.gitmodules +1 -1
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +41 -0
  4. data/README.markdown +126 -0
  5. data/Rakefile +34 -12
  6. data/VERSION +1 -1
  7. data/bin/icuke +12 -10
  8. data/ext/Rakefile +6 -0
  9. data/ext/iCuke/{sdk3.1/DefaultsResponse.h → DefaultsResponse.h} +0 -0
  10. data/ext/iCuke/{sdk3.1/DefaultsResponse.m → DefaultsResponse.m} +0 -0
  11. data/ext/iCuke/{sdk3.1/EventResponse.h → EventResponse.h} +0 -0
  12. data/ext/iCuke/{sdk3.1/EventResponse.m → EventResponse.m} +0 -0
  13. data/ext/iCuke/{sdk3.1/ModuleResponse.h → ModuleResponse.h} +0 -0
  14. data/ext/iCuke/{sdk3.1/ModuleResponse.m → ModuleResponse.m} +0 -0
  15. data/ext/iCuke/{sdk3.1/QuitResponse.h → QuitResponse.h} +0 -0
  16. data/ext/iCuke/{sdk3.1/QuitResponse.m → QuitResponse.m} +0 -0
  17. data/ext/iCuke/Rakefile +14 -13
  18. data/ext/iCuke/{sdk3.1/Recorder.h → Recorder.h} +0 -0
  19. data/ext/iCuke/{sdk3.1/Recorder.m → Recorder.m} +0 -0
  20. data/ext/iCuke/{sdk3.1/RecorderResponse.h → RecorderResponse.h} +0 -0
  21. data/ext/iCuke/{sdk3.1/RecorderResponse.m → RecorderResponse.m} +0 -0
  22. data/ext/iCuke/{sdk3.1/SynthesizeSingleton.h → SynthesizeSingleton.h} +0 -0
  23. data/ext/iCuke/{sdk3.1/ViewResponse.h → ViewResponse.h} +0 -0
  24. data/ext/iCuke/{sdk3.1/ViewResponse.m → ViewResponse.m} +0 -0
  25. data/ext/iCuke/{sdk3.1/Viewer.h → Viewer.h} +0 -0
  26. data/ext/iCuke/{sdk4.0/Viewer.m → Viewer.m} +0 -0
  27. data/ext/iCuke/{sdk3.1/iCukeHTTPResponseHandler.h → iCukeHTTPResponseHandler.h} +0 -0
  28. data/ext/iCuke/{sdk3.1/iCukeHTTPResponseHandler.m → iCukeHTTPResponseHandler.m} +0 -0
  29. data/ext/iCuke/{sdk3.1/iCukeHTTPServer.h → iCukeHTTPServer.h} +0 -0
  30. data/ext/iCuke/{sdk4.0/iCukeHTTPServer.m → iCukeHTTPServer.m} +4 -2
  31. data/ext/iCuke/{sdk3.1/iCukeServer.h → iCukeServer.h} +0 -0
  32. data/ext/iCuke/{sdk3.1/iCukeServer.m → iCukeServer.m} +0 -0
  33. data/ext/iCuke/{sdk3.1/json → json}/JSON.h +0 -0
  34. data/ext/iCuke/{sdk3.1/json → json}/NSObject+SBJSON.h +0 -0
  35. data/ext/iCuke/{sdk3.1/json → json}/NSObject+SBJSON.m +0 -0
  36. data/ext/iCuke/{sdk3.1/json → json}/NSString+SBJSON.h +0 -0
  37. data/ext/iCuke/{sdk3.1/json → json}/NSString+SBJSON.m +0 -0
  38. data/ext/iCuke/{sdk3.1/json → json}/SBJSON.h +0 -0
  39. data/ext/iCuke/{sdk3.1/json → json}/SBJSON.m +0 -0
  40. data/ext/iCuke/{sdk3.1/json → json}/SBJsonBase.h +0 -0
  41. data/ext/iCuke/{sdk3.1/json → json}/SBJsonBase.m +0 -0
  42. data/ext/iCuke/{sdk3.1/json → json}/SBJsonParser.h +0 -0
  43. data/ext/iCuke/{sdk3.1/json → json}/SBJsonParser.m +0 -0
  44. data/ext/iCuke/{sdk3.1/json → json}/SBJsonWriter.h +0 -0
  45. data/ext/iCuke/{sdk3.1/json → json}/SBJsonWriter.m +0 -0
  46. data/features/starting_project.feature +18 -0
  47. data/features/step_definitions/shell.rb +41 -0
  48. data/features/support/env.rb +2 -0
  49. data/features/support/environment.rb +40 -0
  50. data/features/supported_sdks.feature +12 -0
  51. data/iCuke.gemspec +149 -161
  52. data/lib/icuke/configuration.rb +19 -0
  53. data/lib/icuke/core_ext.rb +27 -0
  54. data/lib/icuke/cucumber.rb +29 -265
  55. data/lib/icuke/cucumber_compat.rb +4 -0
  56. data/lib/icuke/icuke_world.rb +149 -0
  57. data/lib/icuke/sdk.rb +5 -13
  58. data/lib/icuke/simulator_driver.rb +201 -0
  59. data/lib/icuke/waxsim.rb +47 -9
  60. data/spec/cucumber_spec.rb +130 -0
  61. data/spec/fixtures/controls_page.xml +252 -0
  62. data/spec/process_spec.rb +76 -0
  63. data/spec/screen_spec.rb +173 -0
  64. data/spec/simulate_spec.rb +75 -0
  65. data/spec/simulator_spec.rb +28 -0
  66. data/spec/spec.opts +2 -0
  67. data/spec/spec_helper.rb +67 -0
  68. metadata +222 -121
  69. data/.gitignore +0 -15
  70. data/README.rdoc +0 -68
  71. data/ext/WaxSim/Simulator.h +0 -31
  72. data/ext/WaxSim/Simulator.m +0 -131
  73. data/ext/WaxSim/WaxSim.m +0 -110
  74. data/ext/WaxSim/WaxSim.xcodeproj/project.pbxproj +0 -238
  75. data/ext/WaxSim/WaxSim_Prefix.pch +0 -7
  76. data/ext/WaxSim/build/Release/waxsim +0 -0
  77. data/ext/WaxSim/build/Release/waxsim.dSYM/Contents/Info.plist +0 -20
  78. data/ext/WaxSim/build/Release/waxsim.dSYM/Contents/Resources/DWARF/waxsim +0 -0
  79. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/Objects-normal/x86_64/Simulator.o +0 -0
  80. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/Objects-normal/x86_64/WaxSim.o +0 -0
  81. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/Objects-normal/x86_64/waxsim.LinkFileList +0 -2
  82. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/WaxSim.dep +0 -6
  83. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/WaxSim~.dep +0 -6
  84. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/build-state.dat +0 -227
  85. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/build-state~.dat +0 -227
  86. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/waxsim-all-target-headers.hmap +0 -0
  87. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/waxsim-generated-files.hmap +0 -0
  88. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/waxsim-own-target-headers.hmap +0 -0
  89. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/waxsim-project-headers.hmap +0 -0
  90. data/ext/WaxSim/build/WaxSim.build/Release/WaxSim.build/waxsim.hmap +0 -0
  91. data/ext/WaxSim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +0 -126
  92. data/ext/iCuke/sdk3.1/Rakefile +0 -20
  93. data/ext/iCuke/sdk3.1/Viewer.m +0 -203
  94. data/ext/iCuke/sdk3.1/iCukeHTTPServer.m +0 -365
  95. data/ext/iCuke/sdk4.0/DefaultsResponse.h +0 -5
  96. data/ext/iCuke/sdk4.0/DefaultsResponse.m +0 -66
  97. data/ext/iCuke/sdk4.0/EventResponse.h +0 -5
  98. data/ext/iCuke/sdk4.0/EventResponse.m +0 -130
  99. data/ext/iCuke/sdk4.0/ModuleResponse.h +0 -5
  100. data/ext/iCuke/sdk4.0/ModuleResponse.m +0 -76
  101. data/ext/iCuke/sdk4.0/QuitResponse.h +0 -5
  102. data/ext/iCuke/sdk4.0/QuitResponse.m +0 -23
  103. data/ext/iCuke/sdk4.0/Rakefile +0 -20
  104. data/ext/iCuke/sdk4.0/Recorder.h +0 -17
  105. data/ext/iCuke/sdk4.0/Recorder.m +0 -90
  106. data/ext/iCuke/sdk4.0/RecorderResponse.h +0 -6
  107. data/ext/iCuke/sdk4.0/RecorderResponse.m +0 -68
  108. data/ext/iCuke/sdk4.0/SynthesizeSingleton.h +0 -68
  109. data/ext/iCuke/sdk4.0/ViewResponse.h +0 -5
  110. data/ext/iCuke/sdk4.0/ViewResponse.m +0 -84
  111. data/ext/iCuke/sdk4.0/Viewer.h +0 -8
  112. data/ext/iCuke/sdk4.0/iCukeHTTPResponseHandler.h +0 -50
  113. data/ext/iCuke/sdk4.0/iCukeHTTPResponseHandler.m +0 -381
  114. data/ext/iCuke/sdk4.0/iCukeHTTPServer.h +0 -53
  115. data/ext/iCuke/sdk4.0/iCukeServer.h +0 -14
  116. data/ext/iCuke/sdk4.0/iCukeServer.m +0 -65
  117. data/ext/iCuke/sdk4.0/json/JSON.h +0 -50
  118. data/ext/iCuke/sdk4.0/json/NSObject+SBJSON.h +0 -68
  119. data/ext/iCuke/sdk4.0/json/NSObject+SBJSON.m +0 -53
  120. data/ext/iCuke/sdk4.0/json/NSString+SBJSON.h +0 -58
  121. data/ext/iCuke/sdk4.0/json/NSString+SBJSON.m +0 -55
  122. data/ext/iCuke/sdk4.0/json/SBJSON.h +0 -75
  123. data/ext/iCuke/sdk4.0/json/SBJSON.m +0 -212
  124. data/ext/iCuke/sdk4.0/json/SBJsonBase.h +0 -86
  125. data/ext/iCuke/sdk4.0/json/SBJsonBase.m +0 -78
  126. data/ext/iCuke/sdk4.0/json/SBJsonParser.h +0 -87
  127. data/ext/iCuke/sdk4.0/json/SBJsonParser.m +0 -475
  128. data/ext/iCuke/sdk4.0/json/SBJsonWriter.h +0 -129
  129. data/ext/iCuke/sdk4.0/json/SBJsonWriter.m +0 -228
@@ -0,0 +1,252 @@
1
+ <screen>
2
+ <frame x="0.000000" y="0.000000" width="320.000000" height="480.000000"/>
3
+ <UIWindow>
4
+ <UILayoutContainerView>
5
+ <UINavigationTransitionView>
6
+ <UIViewControllerWrapperView>
7
+ <UITableView>
8
+ <UITableViewCell>
9
+ <UIGroupTableViewCellBackground/>
10
+ <UIView>
11
+ <UILabel traits="static_text " label="ControlsViewController.m: -(UISlider *)customSlider">
12
+ <frame x="20.000000" y="465.000000" width="280.000000" height="37.000000"/>
13
+ </UILabel>
14
+ </UIView>
15
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UISlider *)customSlider">
16
+ <frame x="-0.000000" y="464.000000" width="318.001068" height="39.000000"/>
17
+ </UITableTextAccessibilityElement>
18
+ </UITableViewCell>
19
+ <UITableViewCell>
20
+ <UIGroupTableViewCellBackground/>
21
+ <UIView>
22
+ <UILabel traits="static_text " label="Customized Slider">
23
+ <frame x="20.000000" y="415.000000" width="280.000000" height="49.000000"/>
24
+ </UILabel>
25
+ <UISlider traits="" label="Custom" value="50%">
26
+ <frame x="184.000000" y="427.000000" width="120.000000" height="23.000000"/>
27
+ <UIImageView/>
28
+ <UIImageView/>
29
+ <UIImageView/>
30
+ </UISlider>
31
+ </UIView>
32
+ <UITableTextAccessibilityElement traits="" label="Customized Slider">
33
+ <frame x="-0.000000" y="414.000000" width="318.001068" height="50.000000"/>
34
+ </UITableTextAccessibilityElement>
35
+ <UIAccessibilityElementMockView traits="updates_frequently " label="Custom" value="50%">
36
+ <frame x="184.000000" y="427.000000" width="120.000000" height="23.000000"/>
37
+ </UIAccessibilityElementMockView>
38
+ </UITableViewCell>
39
+ <UITableViewCell>
40
+ <UIGroupTableViewCellBackground/>
41
+ <UIView>
42
+ <UILabel traits="static_text " label="ControlsViewController.m: -(UISlider *)sliderCtl">
43
+ <frame x="20.000000" y="313.000000" width="280.000000" height="37.000000"/>
44
+ </UILabel>
45
+ </UIView>
46
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UISlider *)sliderCtl">
47
+ <frame x="-0.000000" y="312.000000" width="318.001068" height="39.000000"/>
48
+ </UITableTextAccessibilityElement>
49
+ </UITableViewCell>
50
+ <UITableViewCell>
51
+ <UIGroupTableViewCellBackground/>
52
+ <UIView>
53
+ <UILabel traits="static_text " label="Standard Slider">
54
+ <frame x="20.000000" y="263.000000" width="280.000000" height="49.000000"/>
55
+ </UILabel>
56
+ <UISlider traits="" label="Standard slider" value="50%">
57
+ <frame x="184.000000" y="275.000000" width="120.000000" height="23.000000"/>
58
+ <UIImageView/>
59
+ <UIImageView/>
60
+ <UIImageView/>
61
+ </UISlider>
62
+ </UIView>
63
+ <UITableTextAccessibilityElement traits="" label="Standard Slider">
64
+ <frame x="-0.000000" y="262.000000" width="318.001068" height="50.000000"/>
65
+ </UITableTextAccessibilityElement>
66
+ <UIAccessibilityElementMockView traits="updates_frequently " label="Standard slider" value="50%">
67
+ <frame x="184.000000" y="275.000000" width="120.000000" height="23.000000"/>
68
+ </UIAccessibilityElementMockView>
69
+ </UITableViewCell>
70
+ <UITableViewCell>
71
+ <UIGroupTableViewCellBackground/>
72
+ <UIView>
73
+ <UILabel traits="static_text " label="ControlsViewController.m: -(UISwitch *)switchCtl">
74
+ <frame x="20.000000" y="161.000000" width="280.000000" height="37.000000"/>
75
+ </UILabel>
76
+ </UIView>
77
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UISwitch *)switchCtl">
78
+ <frame x="-0.000000" y="160.000000" width="318.001068" height="39.000000"/>
79
+ </UITableTextAccessibilityElement>
80
+ </UITableViewCell>
81
+ <UITableViewCell>
82
+ <UIGroupTableViewCellBackground/>
83
+ <UIView>
84
+ <UILabel traits="static_text " label="Standard Switch">
85
+ <frame x="20.000000" y="111.000000" width="280.000000" height="49.000000"/>
86
+ </UILabel>
87
+ <UISwitch traits="button " label="Standard switch">
88
+ <frame x="208.000000" y="123.000000" width="94.000000" height="27.000000"/>
89
+ <_UISwitchSlider>
90
+ <UIImageView/>
91
+ <UIImageView/>
92
+ <UIView>
93
+ <UILabel traits="static_text " label="ON">
94
+ <frame x="171.000000" y="123.000000" width="24.000000" height="27.000000"/>
95
+ </UILabel>
96
+ <UILabel traits="static_text " label="OFF">
97
+ <frame x="259.000000" y="123.000000" width="32.000000" height="27.000000"/>
98
+ </UILabel>
99
+ </UIView>
100
+ <UIImageView/>
101
+ </_UISwitchSlider>
102
+ </UISwitch>
103
+ </UIView>
104
+ <UITableTextAccessibilityElement traits="" label="Standard Switch">
105
+ <frame x="-0.000000" y="110.000000" width="318.001068" height="50.000000"/>
106
+ </UITableTextAccessibilityElement>
107
+ <UIAccessibilityElementMockView traits="button updates_frequently " label="Standard switch">
108
+ <frame x="208.000000" y="123.000000" width="94.000000" height="27.000000"/>
109
+ </UIAccessibilityElementMockView>
110
+ </UITableViewCell>
111
+ <UIImageView/>
112
+ <UITableHeaderFooterView/>
113
+ <UITableHeaderFooterView/>
114
+ <UITableHeaderFooterView/>
115
+ <UIImageView/>
116
+ <UITableViewSectionElement>
117
+ <frame x="0.000000" y="74.000000" width="320.000000" height="36.000000"/>
118
+ <UITableSectionPart traits="" label="UISwitch">
119
+ <frame x="0.000000" y="74.000000" width="320.000000" height="36.000000"/>
120
+ </UITableSectionPart>
121
+ </UITableViewSectionElement>
122
+ <UITableViewCellAccessibilityElement>
123
+ <frame x="0.000000" y="110.000000" width="320.000000" height="50.000000"/>
124
+ <UITableTextAccessibilityElement traits="" label="Standard Switch">
125
+ <frame x="-0.000000" y="110.000000" width="318.001068" height="50.000000"/>
126
+ </UITableTextAccessibilityElement>
127
+ <UIAccessibilityElementMockView traits="button updates_frequently " label="Standard switch">
128
+ <frame x="208.000000" y="123.000000" width="94.000000" height="27.000000"/>
129
+ </UIAccessibilityElementMockView>
130
+ </UITableViewCellAccessibilityElement>
131
+ <UITableViewCellAccessibilityElement>
132
+ <frame x="0.000000" y="160.000000" width="320.000000" height="39.000000"/>
133
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UISwitch *)switchCtl">
134
+ <frame x="-0.000000" y="160.000000" width="318.001068" height="39.000000"/>
135
+ </UITableTextAccessibilityElement>
136
+ </UITableViewCellAccessibilityElement>
137
+ <UITableViewSectionElement>
138
+ <frame x="0.000000" y="226.000000" width="320.000000" height="36.000000"/>
139
+ <UITableSectionPart traits="" label="UISlider">
140
+ <frame x="0.000000" y="226.000000" width="320.000000" height="36.000000"/>
141
+ </UITableSectionPart>
142
+ </UITableViewSectionElement>
143
+ <UITableViewCellAccessibilityElement>
144
+ <frame x="0.000000" y="262.000000" width="320.000000" height="50.000000"/>
145
+ <UITableTextAccessibilityElement traits="" label="Standard Slider">
146
+ <frame x="-0.000000" y="262.000000" width="318.001068" height="50.000000"/>
147
+ </UITableTextAccessibilityElement>
148
+ <UIAccessibilityElementMockView traits="updates_frequently " label="Standard slider" value="50%">
149
+ <frame x="184.000000" y="275.000000" width="120.000000" height="23.000000"/>
150
+ </UIAccessibilityElementMockView>
151
+ </UITableViewCellAccessibilityElement>
152
+ <UITableViewCellAccessibilityElement>
153
+ <frame x="0.000000" y="312.000000" width="320.000000" height="39.000000"/>
154
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UISlider *)sliderCtl">
155
+ <frame x="-0.000000" y="312.000000" width="318.001068" height="39.000000"/>
156
+ </UITableTextAccessibilityElement>
157
+ </UITableViewCellAccessibilityElement>
158
+ <UITableViewSectionElement>
159
+ <frame x="0.000000" y="378.000000" width="320.000000" height="36.000000"/>
160
+ <UITableSectionPart traits="" label="UISlider">
161
+ <frame x="0.000000" y="378.000000" width="320.000000" height="36.000000"/>
162
+ </UITableSectionPart>
163
+ </UITableViewSectionElement>
164
+ <UITableViewCellAccessibilityElement>
165
+ <frame x="0.000000" y="414.000000" width="320.000000" height="50.000000"/>
166
+ <UITableTextAccessibilityElement traits="" label="Customized Slider">
167
+ <frame x="-0.000000" y="414.000000" width="318.001068" height="50.000000"/>
168
+ </UITableTextAccessibilityElement>
169
+ <UIAccessibilityElementMockView traits="updates_frequently " label="Custom" value="50%">
170
+ <frame x="184.000000" y="427.000000" width="120.000000" height="23.000000"/>
171
+ </UIAccessibilityElementMockView>
172
+ </UITableViewCellAccessibilityElement>
173
+ <UITableViewCellAccessibilityElement>
174
+ <frame x="0.000000" y="464.000000" width="320.000000" height="39.000000"/>
175
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UISlider *)customSlider">
176
+ <frame x="-0.000000" y="464.000000" width="318.001068" height="39.000000"/>
177
+ </UITableTextAccessibilityElement>
178
+ </UITableViewCellAccessibilityElement>
179
+ <UITableViewSectionElement>
180
+ <frame x="0.000000" y="530.000000" width="320.000000" height="36.000000"/>
181
+ <UITableSectionPart traits="" label="UIPageControl">
182
+ <frame x="0.000000" y="530.000000" width="320.000000" height="36.000000"/>
183
+ </UITableSectionPart>
184
+ </UITableViewSectionElement>
185
+ <UITableViewCellAccessibilityElement>
186
+ <frame x="0.000000" y="0.000000" width="0.000000" height="0.000000"/>
187
+ <UITableTextAccessibilityElement traits="" label="Ten Pages">
188
+ <frame x="-0.000000" y="0.000000" width="-1.998950" height="0.000000"/>
189
+ </UITableTextAccessibilityElement>
190
+ <UIAccessibilityElementMockView traits="updates_frequently " label="page 1 of 10">
191
+ <frame x="0.000000" y="0.000000" width="158.000000" height="25.000000"/>
192
+ </UIAccessibilityElementMockView>
193
+ </UITableViewCellAccessibilityElement>
194
+ <UITableViewCellAccessibilityElement>
195
+ <frame x="0.000000" y="0.000000" width="0.000000" height="0.000000"/>
196
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UIPageControl *)pageControl">
197
+ <frame x="-0.000000" y="0.000000" width="-1.998950" height="0.000000"/>
198
+ </UITableTextAccessibilityElement>
199
+ </UITableViewCellAccessibilityElement>
200
+ <UITableViewSectionElement>
201
+ <frame x="0.000000" y="682.000000" width="320.000000" height="36.000000"/>
202
+ <UITableSectionPart traits="" label="UIActivityIndicatorView">
203
+ <frame x="0.000000" y="682.000000" width="320.000000" height="36.000000"/>
204
+ </UITableSectionPart>
205
+ </UITableViewSectionElement>
206
+ <UITableViewCellAccessibilityElement>
207
+ <frame x="0.000000" y="0.000000" width="0.000000" height="0.000000"/>
208
+ <UITableTextAccessibilityElement traits="" label="Style Gray">
209
+ <frame x="-0.000000" y="0.000000" width="-1.998950" height="0.000000"/>
210
+ </UITableTextAccessibilityElement>
211
+ </UITableViewCellAccessibilityElement>
212
+ <UITableViewCellAccessibilityElement>
213
+ <frame x="0.000000" y="0.000000" width="0.000000" height="0.000000"/>
214
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UIActivityIndicatorView *)progressInd">
215
+ <frame x="-0.000000" y="0.000000" width="-1.998950" height="0.000000"/>
216
+ </UITableTextAccessibilityElement>
217
+ </UITableViewCellAccessibilityElement>
218
+ <UITableViewSectionElement>
219
+ <frame x="0.000000" y="834.000000" width="320.000000" height="36.000000"/>
220
+ <UITableSectionPart traits="" label="UIProgressView">
221
+ <frame x="0.000000" y="834.000000" width="320.000000" height="36.000000"/>
222
+ </UITableSectionPart>
223
+ </UITableViewSectionElement>
224
+ <UITableViewCellAccessibilityElement>
225
+ <frame x="0.000000" y="0.000000" width="0.000000" height="0.000000"/>
226
+ <UITableTextAccessibilityElement traits="" label="Style Default">
227
+ <frame x="-0.000000" y="0.000000" width="-1.998950" height="0.000000"/>
228
+ </UITableTextAccessibilityElement>
229
+ <UIAccessibilityElementMockView traits="updates_frequently " label="Progress" value="50%">
230
+ <frame x="0.000000" y="0.000000" width="160.000000" height="24.000000"/>
231
+ </UIAccessibilityElementMockView>
232
+ </UITableViewCellAccessibilityElement>
233
+ <UITableViewCellAccessibilityElement>
234
+ <frame x="0.000000" y="0.000000" width="0.000000" height="0.000000"/>
235
+ <UITableTextAccessibilityElement traits="" label="ControlsViewController.m: -(UIProgressView *)progressBar">
236
+ <frame x="-0.000000" y="0.000000" width="-1.998950" height="0.000000"/>
237
+ </UITableTextAccessibilityElement>
238
+ </UITableViewCellAccessibilityElement>
239
+ </UITableView>
240
+ </UIViewControllerWrapperView>
241
+ </UINavigationTransitionView>
242
+ <UINavigationBar>
243
+ <UINavigationItemView traits="static_text " label="Controls">
244
+ <frame x="118.000000" y="28.000000" width="84.000000" height="27.000000"/>
245
+ </UINavigationItemView>
246
+ <UINavigationItemButtonView traits="button " label="Back">
247
+ <frame x="5.000000" y="27.000000" width="49.000000" height="30.000000"/>
248
+ </UINavigationItemButtonView>
249
+ </UINavigationBar>
250
+ </UILayoutContainerView>
251
+ </UIWindow>
252
+ </screen>
@@ -0,0 +1,76 @@
1
+ require 'spec/spec_helper'
2
+ require 'icuke/waxsim'
3
+
4
+ describe ICuke::Simulator::Process do
5
+
6
+ it "should provide a list of commands necessary to set up the environment" do
7
+ p = ICuke::Simulator::Process.new('foo', {})
8
+ p.should respond_to(:setup_commands)
9
+ p.setup_commands.should be_kind_of(Array)
10
+ end
11
+
12
+ it "should not provide a defaults command when retina is not specified" do
13
+ found = ICuke::Simulator::Process.new('foo', {}).setup_commands.detect {|c| c =~ /^defaults/}
14
+ found.should be_nil
15
+ end
16
+
17
+ it "should set SimulateDevice to \"iPhone (Retina)\" if platform is iPhone and retina is required" do
18
+ attrs = {:platform => :iphone, :retina => true}
19
+ found = ICuke::Simulator::Process.new('foo', attrs).setup_commands.detect {|c| c =~ /^defaults/}
20
+ found.should_not be_nil
21
+ found.should == "defaults write com.apple.iphonesimulator SimulateDevice '\"iPhone (Retina)\"'"
22
+ end
23
+
24
+ it "should set SimulateDevice to \"iPhone\" if platform is iPhone and retina is rejected" do
25
+ attrs = {:platform => :iphone, :retina => false}
26
+ found = ICuke::Simulator::Process.new('foo', attrs).setup_commands.detect {|c| c =~ /^defaults/}
27
+ found.should_not be_nil
28
+ found.should == "defaults write com.apple.iphonesimulator SimulateDevice '\"iPhone\"'"
29
+ end
30
+
31
+ it "should set SimulateDevice to \"iPad\" if platform is iPad and retina is rejected" do
32
+ attrs = {:platform => :ipad, :retina => false}
33
+ found = ICuke::Simulator::Process.new('foo', attrs).setup_commands.detect {|c| c =~ /^defaults/}
34
+ found.should_not be_nil
35
+ found.should == "defaults write com.apple.iphonesimulator SimulateDevice '\"iPad\"'"
36
+ end
37
+
38
+ describe '#with_launch_options' do
39
+
40
+ it "should return a new Process" do
41
+ p = ICuke::Simulator::Process.new("foo.xcodeproj").with_launch_options({})
42
+ p.should be_kind_of(ICuke::Simulator::Process)
43
+ end
44
+
45
+ it "should not mutate the original Process" do
46
+ p1 = ICuke::Simulator::Process.new("foo.xcodeproj")
47
+ p2 = p1.with_launch_options(:env => {'FOO' => 'F'})
48
+ p1.launch_options.should_not == p2.launch_options
49
+ end
50
+
51
+ it "should replace existing simple values" do
52
+ p = ICuke::Simulator::Process.new("foo.xcodeproj", :platform => :ipad).with_launch_options(:platform => :iphone)
53
+ p.launch_options[:platform].should == :iphone
54
+ end
55
+
56
+ it "should not remove existing variables" do
57
+ p = ICuke::Simulator::Process.new("foo.xcodeproj", :env => {'FOO' => 'F'}).with_launch_options(:env => {})
58
+ p.launch_options[:env].should have_key('FOO')
59
+ p.launch_options[:env]['FOO'].should == 'F'
60
+ end
61
+
62
+ it "should add environment variables" do
63
+ p = ICuke::Simulator::Process.new("foo.xcodeproj", :env => {'FOO' => 'F'}).with_launch_options(:env => {'BAR' => 'B'})
64
+ p.launch_options[:env].should have_key('BAR')
65
+ p.launch_options[:env]['BAR'].should == 'B'
66
+ end
67
+
68
+ it "should replace existing environment variables" do
69
+ p = ICuke::Simulator::Process.new("foo.xcodeproj", :env => {'FOO' => 'F'}).with_launch_options(:env => {'FOO' => 'B'})
70
+ p.launch_options[:env].should have_key('FOO')
71
+ p.launch_options[:env]['FOO'].should == 'B'
72
+ end
73
+
74
+ end
75
+
76
+ end
@@ -0,0 +1,173 @@
1
+ require 'spec/spec_helper'
2
+ require 'icuke/screen'
3
+
4
+ describe Screen do
5
+ before(:all) do
6
+ @xml = File.read('spec/fixtures/controls_page.xml')
7
+ end
8
+
9
+ before(:each) do
10
+ @screen = Screen.new(@xml)
11
+ end
12
+
13
+ context "when testing if an element exists" do
14
+
15
+ it "should be able to search for a label" do
16
+ @screen.exists?("Customized Slider").should be_true
17
+ end
18
+
19
+ it "should be able to search for a label within a scope" do
20
+ # why does this not work with any scope?
21
+ @screen.exists?("Customized Slider", "UIWindow").should be_true
22
+ end
23
+
24
+ it "should be able to search for a value" do
25
+ @screen.exists?("50%").should be_true
26
+ end
27
+
28
+ it "should be able to search for a node" do
29
+ @screen.exists?("UISlider").should be_true
30
+ end
31
+
32
+ it "should know when an element is visible on the screen" do
33
+ @screen.visible?("Standard Slider").should be_true
34
+ end
35
+
36
+ end
37
+
38
+ context "when finding a tappable element" do
39
+
40
+ it "should find an element with a button trait" do
41
+ @screen.first_tappable_element("Standard switch").name.should == "UISwitch"
42
+ end
43
+
44
+ it "should find an element with an updates_frequently trait" do
45
+ @screen.first_tappable_element("Custom").name.should == "UIAccessibilityElementMockView"
46
+ end
47
+
48
+ it "should find an element by its label" do
49
+ @screen.first_tappable_element("Customized Slider").name.should == "UILabel"
50
+ end
51
+
52
+ it "should raise an exception when the element is not found" do
53
+ lambda{@screen.first_tappable_element("does_not_exist")}.should raise_error
54
+ end
55
+
56
+ end
57
+
58
+ context "when finding a slider element" do
59
+
60
+ it "should find a slider by its label" do
61
+ @screen.first_slider_element("Standard slider").name.should == "UISlider"
62
+ end
63
+
64
+ it "should find a slider by a UILabel withing the same parent" do
65
+ @screen.first_slider_element("Standard Slider").name.should == "UISlider"
66
+ end
67
+
68
+ it "should raise an exception when the element is not found" do
69
+ lambda{@screen.first_slider_element("does_not_exist")}.should raise_error
70
+ end
71
+
72
+ end
73
+
74
+ context "when finding the button for a slider" do
75
+
76
+ before(:each) do
77
+ @frame = {}
78
+ @element = {}
79
+ @element.should_receive(:child).at_least(:once).and_return(@frame)
80
+ end
81
+
82
+ it "should find coordinates when slider is horizontal" do
83
+ set_frame_values(184,275,120,24)
84
+ {'50%' => 244, '100%' => 294, '75%' => 269, '25%' => 219, '0%' => 194}.each do |v|
85
+ @element['value'] = v[0]
86
+ x, y = @screen.find_slider_button(@element)
87
+ x.should == v[1]
88
+ y.should == 287
89
+ end
90
+ end
91
+
92
+ it "should find coordinates when slider is vertical" do
93
+ set_frame_values(184,175,24,120)
94
+ {'50%' => 235, '100%' => 285, '75%' => 260,'25%' => 210, '0%' => 185}.each do |v|
95
+ @element['value'] = v[0]
96
+ x,y = @screen.find_slider_button(@element)
97
+ x.should == 196
98
+ y.should == v[1]
99
+ end
100
+ end
101
+
102
+ end
103
+
104
+ context "when finding a location corresponding to a percentage for a slider" do
105
+
106
+ before(:each) do
107
+ @frame = {}
108
+ @element = {}
109
+ @element.should_receive(:child).at_least(:once).and_return(@frame)
110
+ end
111
+
112
+ it "should find percentage coordinate when slider is horizontal" do
113
+ set_frame_values(184,275,120,24)
114
+ {50 => 244, 100 => 294, 75 => 269, 25 => 219, 0 => 194}.each do |v|
115
+ x,y = @screen.find_slider_percentage_location(@element, v[0])
116
+ x.should == v[1]
117
+ y.should == 287
118
+ end
119
+ end
120
+
121
+ it "should find percentage coordinate when slider is vertical" do
122
+ set_frame_values(184,175,24,120)
123
+ {50 => 235, 100 => 285, 75 => 260, 25 => 210, 0 => 185}.each do |v|
124
+ x,y = @screen.find_slider_percentage_location(@element, v[0])
125
+ x.should == 196
126
+ y.should == v[1]
127
+ end
128
+ end
129
+
130
+ end
131
+
132
+ context "when finding the coordinates for a swipe" do
133
+
134
+ it "should start the coordinates with the center of the screen" do
135
+ x,y,x2,y2 = @screen.swipe_coordinates(:down)
136
+ x.should == 160
137
+ y.should == 240
138
+ end
139
+
140
+ it "should end the swipe at the top center when swiping up" do
141
+ x,y,x2,y2 = @screen.swipe_coordinates(:up)
142
+ x2.should == 160
143
+ y2.should == 0
144
+ end
145
+
146
+ it "should end the swipe at the bottom center when swiping down" do
147
+ x,y,x2,y2 = @screen.swipe_coordinates(:down)
148
+ x2.should == 160
149
+ y2.should == 480
150
+ end
151
+
152
+ it "should end the swipe at the right center when swiping right" do
153
+ x,y,x2,y2 = @screen.swipe_coordinates(:right)
154
+ x2.should == 320
155
+ y2.should == 240
156
+ end
157
+
158
+ it "should end the swipe at the left center when swiping left" do
159
+ x,y,x2,y2 = @screen.swipe_coordinates(:left)
160
+ x2.should == 0
161
+ y2.should == 240
162
+ end
163
+
164
+ end
165
+
166
+ def set_frame_values(x, y, width, height)
167
+ @frame['x'] = x
168
+ @frame['y'] = y
169
+ @frame['width'] = width
170
+ @frame['height'] = height
171
+ end
172
+
173
+ end