ilesspainfulclient-cucumber 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.idea/iLessPainfulClient.iml +7 -1
  2. data/.idea/misc.xml +3 -0
  3. data/.idea/workspace.xml +78 -177
  4. data/CHANGES.txt +7 -0
  5. data/Gemfile.lock +39 -0
  6. data/lib/.idea/.name +1 -0
  7. data/lib/.idea/encodings.xml +5 -0
  8. data/lib/.idea/lib.iml +9 -0
  9. data/lib/.idea/misc.xml +15 -0
  10. data/lib/.idea/modules.xml +9 -0
  11. data/lib/.idea/vcs.xml +7 -0
  12. data/lib/.idea/workspace.xml +200 -0
  13. data/lib/ilesspainfulclient-cucumber/lesspainful_steps.rb +16 -1
  14. data/lib/ilesspainfulclient-cucumber/operations.rb +41 -19
  15. data/lib/ilesspainfulclient-cucumber/resources/cell_swipe_ios4_iphone.base64 +51 -0
  16. data/lib/ilesspainfulclient-cucumber/resources/cell_swipe_ios5_iphone.base64 +74 -0
  17. data/lib/ilesspainfulclient-cucumber/resources/pinch_in_ios4_iphone.base64 +104 -0
  18. data/lib/ilesspainfulclient-cucumber/resources/{rotate_home_down_to_left_iphone.base64 → rotate_home_down_to_left_ios4_iphone.base64} +0 -0
  19. data/lib/ilesspainfulclient-cucumber/resources/{rotate_home_down_to_right_iphone.base64 → rotate_home_down_to_right_ios4_iphone.base64} +0 -0
  20. data/lib/ilesspainfulclient-cucumber/resources/{rotate_home_left_to_down_iphone.base64 → rotate_home_left_to_down_ios4_iphone.base64} +0 -0
  21. data/lib/ilesspainfulclient-cucumber/resources/{rotate_home_right_to_down_iphone.base64 → rotate_home_right_to_down_ios4_iphone.base64} +0 -0
  22. data/lib/ilesspainfulclient-cucumber/resources/{swipe_left_hard_iphone.base64 → swipe_left_hard_ios4_iphone.base64} +0 -0
  23. data/lib/ilesspainfulclient-cucumber/resources/{swipe_left_iphone.base64 → swipe_left_ios4_iphone.base64} +0 -0
  24. data/lib/ilesspainfulclient-cucumber/resources/{swipe_right_hard_iphone.base64 → swipe_right_hard_ios4_iphone.base64} +0 -0
  25. data/lib/ilesspainfulclient-cucumber/resources/{swipe_right_iphone.base64 → swipe_right_ios4_iphone.base64} +0 -0
  26. data/lib/ilesspainfulclient-cucumber/resources/touch_done_ios4_iphone.base64 +8 -0
  27. data/lib/ilesspainfulclient-cucumber/resources/touch_ios4_iphone.base64 +7 -0
  28. data/lib/ilesspainfulclient-cucumber/resources/touch_ios5_iphone.base64 +7 -0
  29. data/lib/ilesspainfulclient-cucumber/version.rb +1 -1
  30. metadata +33 -27
  31. data/lib/ilesspainfulclient-cucumber/resources/cell_swipe_ipad.base64 +0 -33
  32. data/lib/ilesspainfulclient-cucumber/resources/cell_swipe_iphone.base64 +0 -80
  33. data/lib/ilesspainfulclient-cucumber/resources/pinch_in_ipad.base64 +0 -188
  34. data/lib/ilesspainfulclient-cucumber/resources/pinch_in_iphone.base64 +0 -234
  35. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_left_ipad.base64 +0 -3
  36. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_right_ipad.base64 +0 -5
  37. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_down_to_up_ipad.base64 +0 -3
  38. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_left_to_down_ipad.base64 +0 -3
  39. data/lib/ilesspainfulclient-cucumber/resources/rotate_home_right_to_down_ipad.base64 +0 -3
data/lib/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ lib
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/lib/.idea/lib.iml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
9
+
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="DependencyValidationManager">
4
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
5
+ </component>
6
+ <component name="Git.Settings">
7
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
8
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
9
+ </component>
10
+ <component name="ProjectResources">
11
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
12
+ </component>
13
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.2-p290" project-jdk-type="RUBY_SDK" />
14
+ </project>
15
+
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/lib.iml" filepath="$PROJECT_DIR$/.idea/lib.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
data/lib/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="" />
5
+ </component>
6
+ </project>
7
+
@@ -0,0 +1,200 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="885d2b02-2cc7-4b7d-921e-47fadacd26a8" name="Default" comment="" />
5
+ <ignored path="lib.iws" />
6
+ <ignored path=".idea/workspace.xml" />
7
+ <option name="TRACKING_ENABLED" value="true" />
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
14
+ <component name="CreatePatchCommitExecutor">
15
+ <option name="PATCH_PATH" value="" />
16
+ <option name="REVERSE_PATCH" value="false" />
17
+ </component>
18
+ <component name="DaemonCodeAnalyzer">
19
+ <disable_hints />
20
+ </component>
21
+ <component name="FavoritesManager">
22
+ <favorites_list name="lib" />
23
+ </component>
24
+ <component name="FileEditorManager">
25
+ <leaf />
26
+ </component>
27
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
28
+ <OptionsSetting value="true" id="Add" />
29
+ <OptionsSetting value="true" id="Remove" />
30
+ <OptionsSetting value="true" id="Checkout" />
31
+ <OptionsSetting value="true" id="Update" />
32
+ <OptionsSetting value="true" id="Status" />
33
+ <OptionsSetting value="true" id="Edit" />
34
+ <ConfirmationsSetting value="0" id="Add" />
35
+ <ConfirmationsSetting value="0" id="Remove" />
36
+ </component>
37
+ <component name="ProjectReloadState">
38
+ <option name="STATE" value="0" />
39
+ </component>
40
+ <component name="ProjectView">
41
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
42
+ <flattenPackages />
43
+ <showMembers />
44
+ <showModules />
45
+ <showLibraryContents />
46
+ <hideEmptyPackages />
47
+ <abbreviatePackageNames />
48
+ <autoscrollToSource />
49
+ <autoscrollFromSource />
50
+ <sortByType />
51
+ </navigator>
52
+ <panes>
53
+ <pane id="ProjectPane">
54
+ <subPane>
55
+ <PATH>
56
+ <PATH_ELEMENT>
57
+ <option name="myItemId" value="lib" />
58
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
59
+ </PATH_ELEMENT>
60
+ </PATH>
61
+ <PATH>
62
+ <PATH_ELEMENT>
63
+ <option name="myItemId" value="lib" />
64
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
65
+ </PATH_ELEMENT>
66
+ <PATH_ELEMENT>
67
+ <option name="myItemId" value="lib" />
68
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
69
+ </PATH_ELEMENT>
70
+ </PATH>
71
+ </subPane>
72
+ </pane>
73
+ <pane id="Scope" />
74
+ <pane id="Favorites" />
75
+ </panes>
76
+ </component>
77
+ <component name="PropertiesComponent">
78
+ <property name="options.splitter.main.proportions" value="0.3" />
79
+ <property name="WebServerToolWindowFactoryState" value="false" />
80
+ <property name="options.lastSelected" value="preferences.externalTools" />
81
+ <property name="options.searchVisible" value="true" />
82
+ <property name="options.splitter.details.proportions" value="0.2" />
83
+ </component>
84
+ <component name="RunManager">
85
+ <list size="0" />
86
+ </component>
87
+ <component name="ShelveChangesManager" show_recycled="false" />
88
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
89
+ <option name="USER" value="" />
90
+ <option name="PASSWORD" value="" />
91
+ <option name="mySSHConnectionTimeout" value="30000" />
92
+ <option name="mySSHReadTimeout" value="30000" />
93
+ <option name="LAST_MERGED_REVISION" />
94
+ <option name="MERGE_DRY_RUN" value="false" />
95
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
96
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
97
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
98
+ <option name="DETECT_NESTED_COPIES" value="true" />
99
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
100
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
101
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
102
+ <option name="FORCE_UPDATE" value="false" />
103
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
104
+ </component>
105
+ <component name="TaskManager">
106
+ <task active="true" id="Default" summary="Default task">
107
+ <created>1318007779090</created>
108
+ <updated>1318007779090</updated>
109
+ </task>
110
+ <servers />
111
+ </component>
112
+ <component name="ToolWindowManager">
113
+ <frame x="359" y="159" width="1005" height="578" extended-state="0" />
114
+ <editor active="false" />
115
+ <layout>
116
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
117
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
118
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
119
+ <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
120
+ <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24974516" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
121
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
122
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
123
+ <window_info id="JsTestDriver Server" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
124
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
125
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
126
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
127
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
128
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
129
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
130
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
131
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
132
+ </layout>
133
+ </component>
134
+ <component name="VcsManagerConfiguration">
135
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
136
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
137
+ <option name="CHECK_NEW_TODO" value="true" />
138
+ <option name="myTodoPanelSettings">
139
+ <value>
140
+ <are-packages-shown value="false" />
141
+ <are-modules-shown value="false" />
142
+ <flatten-packages value="false" />
143
+ <is-autoscroll-to-source value="false" />
144
+ </value>
145
+ </option>
146
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
147
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
148
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
149
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
150
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
151
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
152
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
153
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
154
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
155
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
156
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
157
+ <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
158
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
159
+ <option name="LAST_COMMIT_MESSAGE" />
160
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
161
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
162
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
163
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
164
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
165
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
166
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
167
+ <option name="ACTIVE_VCS_NAME" />
168
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
169
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
170
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
171
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
172
+ </component>
173
+ <component name="XDebuggerManager">
174
+ <breakpoint-manager />
175
+ </component>
176
+ <component name="editorHistoryManager">
177
+ <entry file="file://$PROJECT_DIR$/ilesspainfulclient-cucumber.rb">
178
+ <provider selected="true" editor-type-id="text-editor">
179
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
180
+ <folding />
181
+ </state>
182
+ </provider>
183
+ </entry>
184
+ <entry file="file://$PROJECT_DIR$/ilesspainfulclient-cucumber/color_helper.rb">
185
+ <provider selected="true" editor-type-id="text-editor">
186
+ <state line="1" column="0" selection-start="42" selection-end="42" vertical-scroll-proportion="0.032822758">
187
+ <folding />
188
+ </state>
189
+ </provider>
190
+ </entry>
191
+ <entry file="file://$PROJECT_DIR$/ilesspainfulclient-cucumber/cucumber.rb">
192
+ <provider selected="true" editor-type-id="text-editor">
193
+ <state line="2" column="0" selection-start="51" selection-end="100" vertical-scroll-proportion="0.065645516">
194
+ <folding />
195
+ </state>
196
+ </provider>
197
+ </entry>
198
+ </component>
199
+ </project>
200
+
@@ -16,6 +16,7 @@ end
16
16
 
17
17
  Then /^I (press|touch) "([^\"]*)"$/ do |_,name|
18
18
  touch("view marked:'#{name}'")
19
+
19
20
  sleep(STEP_PAUSE)
20
21
  end
21
22
 
@@ -245,7 +246,9 @@ end
245
246
 
246
247
  ### Assertions ###
247
248
  Then /^I should see "([^\"]*)"$/ do |expected_mark|
248
- check_element_exists("view marked:'#{expected_mark}'")
249
+ res = (element_exists( "view marked:'#{expected_mark}'" ) ||
250
+ element_exists( "view text:'#{expected_mark}'"))
251
+ res.should be_true
249
252
  end
250
253
 
251
254
  Then /^I should not see "([^\"]*)"$/ do |expected_mark|
@@ -274,6 +277,18 @@ Then /^I see the "([^\"]*)"$/ do |text|
274
277
  end
275
278
 
276
279
 
280
+ Then /^I should see a map$/ do
281
+ check_element_exists("view:'MKMapView'")
282
+ end
283
+
284
+ Then /^I touch user location$/ do
285
+ touch("view:'MKUserLocationView'")
286
+ end
287
+
288
+ Then /^I touch done$/ do
289
+ done
290
+ end
291
+
277
292
 
278
293
  #** TODO /^I dont see the text "([^\"]*)"$/
279
294
  # /^I dont see the "([^\"]*)"$/ do |text|
@@ -11,8 +11,9 @@ module Operations
11
11
  map(uiquery, :query, *args)
12
12
  end
13
13
 
14
- def touch(uiquery,*args)
15
- views_touched=map(uiquery, :touch, *args)
14
+ def touch(uiquery,options={})
15
+ options[:query] = uiquery
16
+ views_touched = playback("touch",options)
16
17
  raise "could not find view to touch: '#{uiquery}', args: #{args}" if views_touched.empty?
17
18
  views_touched
18
19
  end
@@ -26,22 +27,22 @@ module Operations
26
27
  end
27
28
 
28
29
  def set_text(uiquery, txt)
29
- text_fields_modified = map(uiquery, "setText", txt)
30
+ text_fields_modified = map(uiquery, :setText, txt)
30
31
  raise "could not find text field #{uiquery}" if text_fields_modified.empty?
31
32
  text_fields_modified
32
33
  end
33
34
 
34
35
 
35
36
  def swipe(dir,options={})
36
- playback("swipe_#{dir}_#{ENV['DEVICE']}",options)
37
+ playback("swipe_#{dir}}",options)
37
38
  end
38
39
 
39
40
  def cell_swipe(options={})
40
- playback("cell_swipe_#{ENV['DEVICE']}",options)
41
+ playback("cell_swipe",options)
41
42
  end
42
43
 
43
44
  def done
44
- map(nil,:touchDone)
45
+ map(nil,:touchDone,load_playback_data("touch_done"))
45
46
  end
46
47
 
47
48
  def scroll(uiquery,direction)
@@ -50,9 +51,18 @@ module Operations
50
51
  views_touched
51
52
  end
52
53
 
54
+ def scroll_to_row(uiquery,number)
55
+ views_touched=map(uiquery, :scrollToRow, number)
56
+ raise "could not find view to scroll: '#{uiquery}', args: #{number}" if views_touched.empty?
57
+ views_touched
58
+ end
59
+
53
60
  def pinch(in_out,options={})
54
61
  options.merge!({:reverse=>in_out.to_sym==:out})
55
- playback("pinch_in_#{ENV['DEVICE']}", options)
62
+ if ENV['OS'] == 'ios5'
63
+ options.merge!(:prototype => load_playback_data("pinch_in",{"OS" => "ios4"}))
64
+ end
65
+ playback("pinch_in", options)
56
66
  end
57
67
 
58
68
  def rotate(dir)
@@ -80,7 +90,7 @@ module Operations
80
90
  if rotate_cmd.nil?
81
91
  throw "Does not support rotating #{dir} when home button is pointing #{@current_rotation}"
82
92
  end
83
- playback("rotate_home_#{rotate_cmd}_#{ENV['DEVICE']}")
93
+ playback("rotate_home_#{rotate_cmd}")
84
94
  end
85
95
 
86
96
  def background(secs)
@@ -131,27 +141,38 @@ module Operations
131
141
  !matches.empty?
132
142
  end
133
143
 
134
- def playback(recording, options={})
144
+
145
+ def load_playback_data(recording,options={})
146
+ os = options["OS"] || ENV["OS"]
147
+ device = options["DEVICE"] || ENV["DEVICE"]
148
+
135
149
  rec_dir = ENV['PLAYBACK_DIR'] || "#{Dir.pwd}/playback"
150
+ if !recording.end_with?".base64"
151
+ recording = "#{recording}_#{os}_#{device}.base64"
152
+ end
136
153
  data = nil
137
- if (File.exists?("#{recording}.base64"))
138
- data = File.read("#{recording}.base64")
154
+ if (File.exists?(recording))
155
+ data = File.read(recording)
139
156
  puts "found #{recording}"
140
- elsif (File.exists?("#{rec_dir}/#{recording}.base64"))
141
- data = File.read("#{rec_dir}/#{recording}.base64")
142
- puts "#{rec_dir}/#{recording}.base64"
143
- elsif (File.exists?("#{DATA_PATH}/resources/#{recording}.base64"))
144
- data = File.read("#{DATA_PATH}/resources/#{recording}.base64")
145
- puts "#{DATA_PATH}/resources/#{recording}.base64"
157
+ elsif (File.exists?("#{rec_dir}/#{recording}"))
158
+ data = File.read("#{rec_dir}/#{recording}")
159
+ puts "#{rec_dir}/#{recording}"
160
+ elsif (File.exists?("#{DATA_PATH}/resources/#{recording}"))
161
+ data = File.read("#{DATA_PATH}/resources/#{recording}")
162
+ puts "#{DATA_PATH}/resources/#{recording}"
146
163
  else
147
- raise "Playback not found: #{recording} (searched for #{recording}.base64 in #{Dir.pwd}, #{rec_dir}, #{DATA_PATH}/resources"
164
+ raise "Playback not found: #{recording} (searched for #{recording} in #{Dir.pwd}, #{rec_dir}, #{DATA_PATH}/resources"
148
165
  end
149
-
166
+ data
167
+ end
168
+ def playback(recording, options={})
169
+ data = load_playback_data(recording)
150
170
 
151
171
  post_data = %Q|{"events":"#{data}"|
152
172
  post_data<< %Q|,"query":"#{options[:query]}"| if options[:query]
153
173
  post_data<< %Q|,"offset":#{options[:offset].to_json}| if options[:offset]
154
174
  post_data<< %Q|,"reverse":#{options[:reverse]}| if options[:reverse]
175
+ post_data<< %Q|,"prototype":"#{options[:prototype]}"| if options[:prototype]
155
176
  post_data << "}"
156
177
 
157
178
  res = http({:method=>:post, :raw=>true, :path=>'play'}, post_data)
@@ -172,6 +193,7 @@ module Operations
172
193
  File.open("_recording.plist",'wb') do |f|
173
194
  f.write res
174
195
  end
196
+ file_name = "#{file_name}_#{ENV['OS']}_#{ENV['DEVICE']}.base64"
175
197
  system("plutil -i _recording.plist -o _recording_binary.plist -convert binary1")
176
198
  system("openssl base64 -in _recording_binary.plist -out #{file_name}")
177
199
  system("rm _recording.plist _recording_binary.plist")
@@ -0,0 +1,51 @@
1
+ YnBsaXN0MDCvEBYBEBYcIigvNjxCSU9VW2FnbXN5fYOH1QIECgwOAwULDQ9URGF0
2
+ YU8QPAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGCRAICAgAAAIA/
3
+ AACAPwAArEIAAChCAYBlRKBYTG9jYXRpb27SBggHCVFYIkKsAABRWSJCKAAAVFRp
4
+ bWUTAAAEfylMXG5UVHlwZRELuV5XaW5kb3dMb2NhdGlvbtIGCAcJ1QIECgwOERIU
5
+ DRVPEDwCAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABKJgCAgIAAACA
6
+ PwAAgD8AAK5CAAAoQo4TqJig0gYIEwkiQq4AABMAAAR/Qyr/ANIGCBMJ1QIECgwO
7
+ FxgaDRtPEDwCAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABKJgCAgIA
8
+ AACAPwAAgD8AALJCAAAoQgFWZUSg0gYIGQkiQrIAABMAAAR/RDj6C9IGCBkJ1QIE
9
+ CgwOHR4gDSFPEDwCAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABKJgC
10
+ AgIAAACAPwAAgD8AALhCAAAoQgFWZUSg0gYIHwkiQrgAABMAAAR/RSWjO9IGCB8J
11
+ 1QIECgwOIyQmDSdPEDwCAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAA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