sc-frank-cucumber 1.2.1.00af28c → 1.2.1.b7791c5.debug

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. data/frank-skeleton/frank_static_resources.bundle/bundle/ViewAttributeMapping.plist +63 -0
  2. data/frank-skeleton/frank_static_resources.bundle/bundle/ViewAttributeMappingMac.plist +99 -0
  3. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/ViewAttributeMapping.plist +63 -0
  4. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/ViewAttributeMappingMac.plist +99 -0
  5. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/ajax-loader.gif +0 -0
  6. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/file.gif +0 -0
  7. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/folder-closed.gif +0 -0
  8. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/folder.gif +0 -0
  9. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/loader.gif +0 -0
  10. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/loader.png +0 -0
  11. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/minus.gif +0 -0
  12. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/plus.gif +0 -0
  13. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-black-line.gif +0 -0
  14. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-black.gif +0 -0
  15. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-default-line.gif +0 -0
  16. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-default.gif +0 -0
  17. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-famfamfam-line.gif +0 -0
  18. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-famfamfam.gif +0 -0
  19. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-gray-line.gif +0 -0
  20. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-gray.gif +0 -0
  21. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-red-line.gif +0 -0
  22. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/images/treeview-red.gif +0 -0
  23. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/index.html +86 -0
  24. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/index.html.haml +76 -0
  25. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/accessible_views_view.coffee +41 -0
  26. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/accessible_views_view.js +46 -0
  27. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/controller.coffee +134 -0
  28. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/controller.js +139 -0
  29. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/details_view.coffee +42 -0
  30. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/details_view.js +51 -0
  31. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/dropdown_control.coffee +64 -0
  32. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/dropdown_control.js +73 -0
  33. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/ersatz_model.coffee +46 -0
  34. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/ersatz_model.js +60 -0
  35. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/ersatz_view.coffee +167 -0
  36. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/ersatz_view.js +205 -0
  37. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/experiment_bar_model.coffee +10 -0
  38. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/experiment_bar_model.js +17 -0
  39. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/experiment_bar_view.coffee +44 -0
  40. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/experiment_bar_view.js +63 -0
  41. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/frank.coffee +96 -0
  42. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/frank.js +146 -0
  43. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/backbone.js +1431 -0
  44. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/coffee-script.js +8 -0
  45. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/jquery-ui.min.js +405 -0
  46. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/jquery.min.js +4 -0
  47. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/jquery.treeview.js +251 -0
  48. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/json2.js +481 -0
  49. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/raphael.js +5815 -0
  50. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/require.js +2053 -0
  51. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/lib/underscore.js +1059 -0
  52. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/main.coffee +27 -0
  53. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/main.js +29 -0
  54. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tabs_controller.coffee +13 -0
  55. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tabs_controller.js +22 -0
  56. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/toast_controller.coffee +15 -0
  57. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/toast_controller.js +28 -0
  58. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/transform_stack.coffee +59 -0
  59. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/transform_stack.js +78 -0
  60. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tree_view.coffee +53 -0
  61. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/tree_view.js +64 -0
  62. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/view_hier_model.coffee +37 -0
  63. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/view_hier_model.js +48 -0
  64. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/view_model.coffee +39 -0
  65. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/view_model.js +62 -0
  66. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/index.html +329 -0
  67. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/pictos-web.eot +0 -0
  68. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/pictos-web.svg +114 -0
  69. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/pictos-web.ttf +0 -0
  70. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/pictos-web.woff +0 -0
  71. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/pictos.css +20 -0
  72. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/pictos/pictos_base64.css +18 -0
  73. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/css/symbiote.css +1 -0
  74. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_elements.scss +28 -0
  75. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_header.scss +61 -0
  76. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_inspect_tabs_list_tabs.scss +194 -0
  77. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_jquery.treeview.scss +68 -0
  78. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_jqui.scss +2 -0
  79. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_layout.scss +13 -0
  80. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_mixins.sass +137 -0
  81. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_reset.scss +32 -0
  82. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_selector_test_toolbar.scss +81 -0
  83. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_solarized.scss +16 -0
  84. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_typography.scss +11 -0
  85. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_unicode.scss +3 -0
  86. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/_z_index.scss +2 -0
  87. data/frank-skeleton/frank_static_resources.bundle/bundle/bundle/stylesheets/sass/symbiote.scss +26 -0
  88. data/frank-skeleton/frank_static_resources.bundle/bundle/images/ajax-loader.gif +0 -0
  89. data/frank-skeleton/frank_static_resources.bundle/bundle/images/file.gif +0 -0
  90. data/frank-skeleton/frank_static_resources.bundle/bundle/images/folder-closed.gif +0 -0
  91. data/frank-skeleton/frank_static_resources.bundle/bundle/images/folder.gif +0 -0
  92. data/frank-skeleton/frank_static_resources.bundle/bundle/images/loader.gif +0 -0
  93. data/frank-skeleton/frank_static_resources.bundle/bundle/images/loader.png +0 -0
  94. data/frank-skeleton/frank_static_resources.bundle/bundle/images/minus.gif +0 -0
  95. data/frank-skeleton/frank_static_resources.bundle/bundle/images/plus.gif +0 -0
  96. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-black-line.gif +0 -0
  97. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-black.gif +0 -0
  98. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-default-line.gif +0 -0
  99. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-default.gif +0 -0
  100. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-famfamfam-line.gif +0 -0
  101. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-famfamfam.gif +0 -0
  102. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-gray-line.gif +0 -0
  103. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-gray.gif +0 -0
  104. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-red-line.gif +0 -0
  105. data/frank-skeleton/frank_static_resources.bundle/bundle/images/treeview-red.gif +0 -0
  106. data/frank-skeleton/frank_static_resources.bundle/bundle/index.html +86 -0
  107. data/frank-skeleton/frank_static_resources.bundle/bundle/index.html.haml +76 -0
  108. data/frank-skeleton/frank_static_resources.bundle/bundle/js/accessible_views_view.coffee +41 -0
  109. data/frank-skeleton/frank_static_resources.bundle/bundle/js/accessible_views_view.js +46 -0
  110. data/frank-skeleton/frank_static_resources.bundle/bundle/js/controller.coffee +134 -0
  111. data/frank-skeleton/frank_static_resources.bundle/bundle/js/controller.js +139 -0
  112. data/frank-skeleton/frank_static_resources.bundle/bundle/js/details_view.coffee +42 -0
  113. data/frank-skeleton/frank_static_resources.bundle/bundle/js/details_view.js +51 -0
  114. data/frank-skeleton/frank_static_resources.bundle/bundle/js/dropdown_control.coffee +64 -0
  115. data/frank-skeleton/frank_static_resources.bundle/bundle/js/dropdown_control.js +73 -0
  116. data/frank-skeleton/frank_static_resources.bundle/bundle/js/ersatz_model.coffee +46 -0
  117. data/frank-skeleton/frank_static_resources.bundle/bundle/js/ersatz_model.js +60 -0
  118. data/frank-skeleton/frank_static_resources.bundle/bundle/js/ersatz_view.coffee +167 -0
  119. data/frank-skeleton/frank_static_resources.bundle/bundle/js/ersatz_view.js +205 -0
  120. data/frank-skeleton/frank_static_resources.bundle/bundle/js/experiment_bar_model.coffee +10 -0
  121. data/frank-skeleton/frank_static_resources.bundle/bundle/js/experiment_bar_model.js +17 -0
  122. data/frank-skeleton/frank_static_resources.bundle/bundle/js/experiment_bar_view.coffee +44 -0
  123. data/frank-skeleton/frank_static_resources.bundle/bundle/js/experiment_bar_view.js +63 -0
  124. data/frank-skeleton/frank_static_resources.bundle/bundle/js/frank.coffee +96 -0
  125. data/frank-skeleton/frank_static_resources.bundle/bundle/js/frank.js +146 -0
  126. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/backbone.js +1431 -0
  127. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/coffee-script.js +8 -0
  128. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/jquery-ui.min.js +405 -0
  129. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/jquery.min.js +4 -0
  130. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/jquery.treeview.js +251 -0
  131. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/json2.js +481 -0
  132. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/raphael.js +5815 -0
  133. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/require.js +2053 -0
  134. data/frank-skeleton/frank_static_resources.bundle/bundle/js/lib/underscore.js +1059 -0
  135. data/frank-skeleton/frank_static_resources.bundle/bundle/js/main.coffee +27 -0
  136. data/frank-skeleton/frank_static_resources.bundle/bundle/js/main.js +29 -0
  137. data/frank-skeleton/frank_static_resources.bundle/bundle/js/tabs_controller.coffee +13 -0
  138. data/frank-skeleton/frank_static_resources.bundle/bundle/js/tabs_controller.js +22 -0
  139. data/frank-skeleton/frank_static_resources.bundle/bundle/js/toast_controller.coffee +15 -0
  140. data/frank-skeleton/frank_static_resources.bundle/bundle/js/toast_controller.js +28 -0
  141. data/frank-skeleton/frank_static_resources.bundle/bundle/js/transform_stack.coffee +59 -0
  142. data/frank-skeleton/frank_static_resources.bundle/bundle/js/transform_stack.js +78 -0
  143. data/frank-skeleton/frank_static_resources.bundle/bundle/js/tree_view.coffee +53 -0
  144. data/frank-skeleton/frank_static_resources.bundle/bundle/js/tree_view.js +64 -0
  145. data/frank-skeleton/frank_static_resources.bundle/bundle/js/view_hier_model.coffee +37 -0
  146. data/frank-skeleton/frank_static_resources.bundle/bundle/js/view_hier_model.js +48 -0
  147. data/frank-skeleton/frank_static_resources.bundle/bundle/js/view_model.coffee +39 -0
  148. data/frank-skeleton/frank_static_resources.bundle/bundle/js/view_model.js +62 -0
  149. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/index.html +329 -0
  150. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/pictos-web.eot +0 -0
  151. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/pictos-web.svg +114 -0
  152. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/pictos-web.ttf +0 -0
  153. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/pictos-web.woff +0 -0
  154. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/pictos.css +20 -0
  155. data/frank-skeleton/frank_static_resources.bundle/bundle/pictos/pictos_base64.css +18 -0
  156. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/css/symbiote.css +1 -0
  157. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_elements.scss +28 -0
  158. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_header.scss +61 -0
  159. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_inspect_tabs_list_tabs.scss +194 -0
  160. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_jquery.treeview.scss +68 -0
  161. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_jqui.scss +2 -0
  162. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_layout.scss +13 -0
  163. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_mixins.sass +137 -0
  164. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_reset.scss +32 -0
  165. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_selector_test_toolbar.scss +81 -0
  166. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_solarized.scss +16 -0
  167. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_typography.scss +11 -0
  168. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_unicode.scss +3 -0
  169. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/_z_index.scss +2 -0
  170. data/frank-skeleton/frank_static_resources.bundle/bundle/stylesheets/sass/symbiote.scss +26 -0
  171. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.js +3 -3
  172. data/frank-skeleton/frank_static_resources.bundle/js/frank.js +1 -1
  173. data/frank-skeleton/libCocoaAsyncSocket.a +0 -0
  174. data/frank-skeleton/libCocoaAsyncSocketMac.a +0 -0
  175. data/frank-skeleton/libCocoaHTTPServer.a +0 -0
  176. data/frank-skeleton/libCocoaHTTPServerMac.a +0 -0
  177. data/frank-skeleton/libCocoaLumberjack.a +0 -0
  178. data/frank-skeleton/libCocoaLumberjackMac.a +0 -0
  179. data/frank-skeleton/libFrank.a +0 -0
  180. data/frank-skeleton/libFrankMac.a +0 -0
  181. data/frank-skeleton/libShelley.a +0 -0
  182. data/lib/frank-cucumber/frank_helper.rb +27 -0
  183. data/lib/frank-cucumber/frankifier.rb +7 -4
  184. data/lib/frank-cucumber/version.rb +1 -1
  185. metadata +173 -3
@@ -0,0 +1,167 @@
1
+ ISO_SKEW = 15
2
+ ISO_MAJOR_OFFSET = 50
3
+ ISO_MINOR_OFFSET = 5
4
+ SCREEN_BOUNDS = {
5
+ iphone: { x: 0, y: 0, width: 320, height: 480 }
6
+ ipad: { x: 0, y: 0, width: 768, height: 1024 }
7
+ }
8
+ #SCREENSHOT_URL = symbiote.baseUrlFor( "screenshot" )
9
+
10
+ define ['transform_stack','ersatz_model'], (transformStack,ErsatzModel)->
11
+
12
+ drawStaticBackdropAndReturnTransformer = (paper,deviceFamily,orientation,isoSkew) ->
13
+ paper.clear()
14
+ paper.canvas.setAttribute "width", "100%"
15
+ paper.canvas.setAttribute "height", "100%"
16
+
17
+ isiPhone = ('iphone' == deviceFamily)
18
+
19
+ if isiPhone
20
+ paper.canvas.setAttribute "viewBox", "0 0 380 720"
21
+ rotationPoint = [190,360]
22
+ else
23
+ paper.canvas.setAttribute "viewBox", "0 0 875 1200"
24
+ rotationPoint = [437,600]
25
+
26
+ transformer = transformStack()
27
+
28
+ transformer.skew(0, isoSkew).translate( 6, 6 )
29
+
30
+
31
+ rotation = switch orientation
32
+ when 'landscape_right' then 90
33
+ when 'portrait_upside_down' then 180
34
+ when 'landscape_left' then 270
35
+ else false
36
+
37
+ if rotation
38
+ transformer.rotateAroundPoint(rotation,rotationPoint...)
39
+
40
+ # main outline of device
41
+ if isiPhone
42
+ paper.rect(0, 0, 360, 708, 40).attr(
43
+ fill: "black"
44
+ stroke: "gray"
45
+ "stroke-width": 4
46
+ ).transform transformer.desc()
47
+ else
48
+ paper.rect( 10, 10, 855, 1110, 20 ).attr(
49
+ 'fill': 'black',
50
+ 'stroke': 'gray',
51
+ 'stroke-width': 6
52
+ ).transform transformer.desc()
53
+
54
+
55
+ if isiPhone
56
+ # home button
57
+ transformer.push().translate( 180, 655 )
58
+ paper.circle(0, 0, 34).transform(transformer.desc()).attr( "fill", "90-#303030-#101010" )
59
+
60
+ # square inside home button
61
+ paper.rect(0, 0, 22, 22, 5).attr(
62
+ stroke: "gray"
63
+ "stroke-width": 2
64
+ ).transform transformer.push().translate(-11, -11).descAndPop()
65
+
66
+ transformer.translate(20, 120)
67
+
68
+ else
69
+ transformer.translate(50,50)
70
+
71
+ if( isoSkew > 0 )
72
+ transformer.translate(-ISO_MAJOR_OFFSET, 0)
73
+ transformer
74
+
75
+
76
+ transformFromBaseForViewModel = (baseTransformer,viewModel,withSkew=false)->
77
+ {origin:{x,y}} = viewModel.get('accessibilityFrame')
78
+ baseTransformer.push().translate(x,y)
79
+ if( withSkew )
80
+ baseTransformer.translate(viewModel.get('depth')*-ISO_MINOR_OFFSET, 0)
81
+ baseTransformer.descAndPop()
82
+
83
+ ErsatzViewSnapshotView = Backbone.View.extend
84
+ initialize:->
85
+ @model.on('change:active',_.bind(@updateOpacity,@))
86
+ @render()
87
+
88
+ render: ->
89
+ frame = @model.get('accessibilityFrame')
90
+ @el
91
+ .attr
92
+ transform: transformFromBaseForViewModel( @options.baseTransformer, @model,true )
93
+ src: @model.getSnapshotUrl()
94
+ x: 0
95
+ y: 0
96
+ width: frame.size.width
97
+ height: frame.size.height
98
+ @updateOpacity()
99
+ @el
100
+
101
+ updateOpacity: ->
102
+ opacity = ( if @model.get('active') then 1.0 else 0.05 )
103
+ @el.attr('opacity',opacity)
104
+
105
+
106
+ ErsatzView = Backbone.View.extend
107
+ el: $('#ui-locator-view')
108
+
109
+ initialize: ->
110
+ _.bindAll( @, 'render' )
111
+ @model = new ErsatzModel()
112
+ @highlights = []
113
+ @paper = new Raphael(@.el)
114
+ @model.on 'change:baseScreenshotUrl', _.bind(@refreshBaseScreenshot,@)
115
+ @model.on 'change:isAsploded', _.bind(@render,@)
116
+ @model.on 'snapshots-refreshed', _.bind(@refreshSnapshots,@)
117
+ @model.on 'change:highlightFrames', _.bind(@refreshHighlightFrames,@)
118
+
119
+ render: ->
120
+ @highlights = []
121
+
122
+ isoSkew = (if @model.get('isAsploded') then ISO_SKEW else 0)
123
+ @backdropTransformer = drawStaticBackdropAndReturnTransformer(@paper,@model.get('deviceFamily'),@model.get('orientation'),isoSkew)
124
+ @backdrop = @paper.image()
125
+ @refreshBaseScreenshot()
126
+ if @model.get('isAsploded')
127
+ @backdrop.attr('opacity',0.5)
128
+ @refreshSnapshots()
129
+
130
+ @el
131
+
132
+ screenBounds: -> SCREEN_BOUNDS[@model.get('deviceFamily')]
133
+
134
+
135
+ refreshBaseScreenshot: ->
136
+ newScreenshotUrl = @model.get('baseScreenshotUrl')
137
+ return unless newScreenshotUrl?
138
+
139
+ @backdrop
140
+ .transform(@backdropTransformer.desc())
141
+ .attr( @screenBounds() )
142
+ .attr( 'src', newScreenshotUrl )
143
+ .toFront()
144
+
145
+ refreshSnapshots: ->
146
+ @model.get('allViews').each (viewModel) =>
147
+ snapshotView = new ErsatzViewSnapshotView(
148
+ model: viewModel
149
+ baseTransformer: @backdropTransformer
150
+ el: @paper.image()
151
+ )
152
+
153
+ refreshHighlightFrames: ->
154
+ h.remove() for h in @highlights
155
+ @highlights = []
156
+
157
+ @highlights = _.map @model.get('highlightFrames'), ({origin,size})=>
158
+ @paper.rect().attr(
159
+ fill: "#aaff00"
160
+ opacity: 0.8
161
+ stroke: "black"
162
+ transform: @backdropTransformer.push().translate(origin.x,origin.y).descAndPop()
163
+ x: 0
164
+ y: 0
165
+ width: size.width
166
+ height: size.height
167
+ )
@@ -0,0 +1,205 @@
1
+ (function() {
2
+ var ISO_MAJOR_OFFSET, ISO_MINOR_OFFSET, ISO_SKEW,
3
+ __slice = [].slice;
4
+
5
+ ISO_SKEW = 15;
6
+
7
+ ISO_MAJOR_OFFSET = 50;
8
+
9
+ ISO_MINOR_OFFSET = 5;
10
+
11
+ define(['transform_stack', 'ersatz_model'], function(transformStack, ErsatzModel) {
12
+ var ErsatzView, ErsatzViewSnapshotView, drawStaticBackdropAndReturnTransformer, transformFromBaseForViewModel;
13
+ drawStaticBackdropAndReturnTransformer = function(paper, resolution, deviceFamily, orientation, isoSkew) {
14
+ var isiPhone, isiPad, rotation, rotationPoint, transformer;
15
+ paper.clear();
16
+ paper.canvas.setAttribute("width", "100%");
17
+ paper.canvas.setAttribute("height", "100%");
18
+ isiPhone = 'iphone' === deviceFamily;
19
+ isiPad = 'ipad' == deviceFamily;
20
+ if (isiPhone) {
21
+ width = resolution.width + 60;
22
+ height = resolution.height + 240;
23
+ paper.canvas.setAttribute("viewBox", "0 0 " + width + " " + height);
24
+ rotationPoint = [width / 2, height / 2];
25
+ } else if (isiPad) {
26
+ width = resolution.width + 108;
27
+ height = resolution.height + 176;
28
+ paper.canvas.setAttribute("viewBox", "0 0 " + width + " " + height);
29
+ rotationPoint = [width / 2, height / 2];
30
+ }
31
+ else
32
+ {
33
+ paper.canvas.setAttribute("viewBox", "0 0 " + resolution.width + " " + resolution.height);
34
+ }
35
+ transformer = transformStack();
36
+ transformer.skew(0, isoSkew).translate(6, 6);
37
+ rotation = (function() {
38
+ switch (orientation) {
39
+ case 'landscape_right':
40
+ return 90;
41
+ case 'portrait_upside_down':
42
+ return 180;
43
+ case 'landscape_left':
44
+ return 270;
45
+ default:
46
+ return false;
47
+ }
48
+ })();
49
+ if (rotation) {
50
+ transformer.rotateAroundPoint.apply(transformer, [rotation].concat(__slice.call(rotationPoint)));
51
+ }
52
+ if (isiPhone) {
53
+ width = resolution.width + 40;
54
+ height = resolution.height + 228;
55
+ paper.rect(0, 0, width, height, 40).attr({
56
+ fill: "black",
57
+ stroke: "gray",
58
+ "stroke-width": 4
59
+ }).transform(transformer.desc());
60
+ } else if (isiPad) {
61
+ width = resolution.width + 108;
62
+ height = resolution.height + 86;
63
+ paper.rect(10, 10, width, height, 20).attr({
64
+ 'fill': 'black',
65
+ 'stroke': 'gray',
66
+ 'stroke-width': 6
67
+ }).transform(transformer.desc());
68
+ }
69
+ if (isiPhone) {
70
+ x = resolution.width / 2 + 20;
71
+ y = resolution.height + 175;
72
+ transformer.push().translate(x, y);
73
+ paper.circle(0, 0, 34).transform(transformer.desc()).attr("fill", "90-#303030-#101010");
74
+ paper.rect(0, 0, 22, 22, 5).attr({
75
+ stroke: "gray",
76
+ "stroke-width": 2
77
+ }).transform(transformer.push().translate(-11, -11).descAndPop());
78
+ transformer.translate(20, 120);
79
+ } else if (isiPad) {
80
+ transformer.translate(50, 50);
81
+ }
82
+
83
+ if (isoSkew > 0) {
84
+ transformer.translate(-ISO_MAJOR_OFFSET, 0);
85
+ }
86
+ return transformer;
87
+ };
88
+ transformFromBaseForViewModel = function(baseTransformer, viewModel, withSkew) {
89
+ var x, y, _ref;
90
+ if (withSkew == null) {
91
+ withSkew = false;
92
+ }
93
+ _ref = viewModel.get('accessibilityFrame').origin, x = _ref.x, y = _ref.y;
94
+ baseTransformer.push().translate(x, y);
95
+ if (withSkew) {
96
+ baseTransformer.translate(viewModel.get('depth') * -ISO_MINOR_OFFSET, 0);
97
+ }
98
+ return baseTransformer.descAndPop();
99
+ };
100
+ ErsatzViewSnapshotView = Backbone.View.extend({
101
+ initialize: function() {
102
+ this.model.on('change:active', _.bind(this.updateOpacity, this));
103
+ return this.render();
104
+ },
105
+ render: function() {
106
+ var frame;
107
+ frame = this.model.get('accessibilityFrame');
108
+ this.el.attr({
109
+ transform: transformFromBaseForViewModel(this.options.baseTransformer, this.model, true),
110
+ src: this.model.getSnapshotUrl(),
111
+ x: 0,
112
+ y: 0,
113
+ width: frame.size.width,
114
+ height: frame.size.height
115
+ });
116
+ this.updateOpacity();
117
+ return this.el;
118
+ },
119
+ updateOpacity: function() {
120
+ var opacity;
121
+ opacity = (this.model.get('active') ? 1.0 : 0.05);
122
+ return this.el.attr('opacity', opacity);
123
+ }
124
+ });
125
+ return ErsatzView = Backbone.View.extend({
126
+ el: $('#ui-locator-view'),
127
+ initialize: function() {
128
+ _.bindAll(this, 'render');
129
+ this.model = new ErsatzModel();
130
+ this.highlights = [];
131
+ this.paper = new Raphael(this.el);
132
+ this.model.on('change:baseScreenshotUrl', _.bind(this.refreshBaseScreenshot, this));
133
+ this.model.on('change:isAsploded', _.bind(this.render, this));
134
+ this.model.on('snapshots-refreshed', _.bind(this.refreshSnapshots, this));
135
+ return this.model.on('change:highlightFrames', _.bind(this.refreshHighlightFrames, this));
136
+ },
137
+ render: function() {
138
+ var isoSkew;
139
+ this.highlights = [];
140
+ isoSkew = (this.model.get('isAsploded') ? ISO_SKEW : 0);
141
+ this.backdropTransformer = drawStaticBackdropAndReturnTransformer(this.paper, this.model.get('resolution'), this.model.get('deviceFamily'), this.model.get('orientation'), isoSkew);
142
+ this.backdrop = this.paper.image();
143
+ this.refreshBaseScreenshot();
144
+ if (this.model.get('isAsploded')) {
145
+ this.backdrop.attr('opacity', 0.5);
146
+ this.refreshSnapshots();
147
+ }
148
+ return this.el;
149
+ },
150
+ screenBounds: function() {
151
+ resolution = this.model.get('resolution');
152
+ return {
153
+ x: 0,
154
+ y: 0,
155
+ width: resolution.width,
156
+ height: resolution.height
157
+ };
158
+ },
159
+ refreshBaseScreenshot: function() {
160
+ var newScreenshotUrl;
161
+ newScreenshotUrl = this.model.get('baseScreenshotUrl');
162
+ if (newScreenshotUrl == null) {
163
+ return;
164
+ }
165
+ return this.backdrop.transform(this.backdropTransformer.desc()).attr(this.screenBounds()).attr('src', newScreenshotUrl).toFront();
166
+ },
167
+ refreshSnapshots: function() {
168
+ var _this = this;
169
+ return this.model.get('allViews').each(function(viewModel) {
170
+ var snapshotView;
171
+ return snapshotView = new ErsatzViewSnapshotView({
172
+ model: viewModel,
173
+ baseTransformer: _this.backdropTransformer,
174
+ el: _this.paper.image()
175
+ });
176
+ });
177
+ },
178
+ refreshHighlightFrames: function() {
179
+ var h, _i, _len, _ref,
180
+ _this = this;
181
+ _ref = this.highlights;
182
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
183
+ h = _ref[_i];
184
+ h.remove();
185
+ }
186
+ this.highlights = [];
187
+ return this.highlights = _.map(this.model.get('highlightFrames'), function(_arg) {
188
+ var origin, size;
189
+ origin = _arg.origin, size = _arg.size;
190
+ return _this.paper.rect().attr({
191
+ fill: "#aaff00",
192
+ opacity: 0.8,
193
+ stroke: "black",
194
+ transform: _this.backdropTransformer.push().translate(origin.x, origin.y).descAndPop(),
195
+ x: 0,
196
+ y: 0,
197
+ width: size.width,
198
+ height: size.height
199
+ });
200
+ });
201
+ }
202
+ });
203
+ });
204
+
205
+ }).call(this);
@@ -0,0 +1,10 @@
1
+ define ->
2
+ ExperimentBarModel = Backbone.Model.extend
3
+ defaults:
4
+ engines: ['shelley_compat','uiquery','calabash_uispec']
5
+ selectorEngine: 'shelley_compat'
6
+ selector: ''
7
+
8
+ actionClicked: (actionName)->
9
+ @trigger("#{actionName}-clicked",@)
10
+
@@ -0,0 +1,17 @@
1
+ (function() {
2
+
3
+ define(function() {
4
+ var ExperimentBarModel;
5
+ return ExperimentBarModel = Backbone.Model.extend({
6
+ defaults: {
7
+ engines: ['shelley_compat', 'uiquery', 'calabash_uispec'],
8
+ selectorEngine: 'shelley_compat',
9
+ selector: ''
10
+ },
11
+ actionClicked: function(actionName) {
12
+ return this.trigger("" + actionName + "-clicked", this);
13
+ }
14
+ });
15
+ });
16
+
17
+ }).call(this);
@@ -0,0 +1,44 @@
1
+ define ['experiment_bar_model','dropdown_control'], (ExperimentBarModel,DropdownControl)->
2
+
3
+ ExperimentBarView = Backbone.View.extend
4
+ el: $("#selector-test")
5
+
6
+ initialize: ->
7
+ @actionDropdownView = new DropdownControl.DropdownView()
8
+ @actionDropdownView.setElement(@$('.action-buttons'))
9
+ @actionDropdownView.collection.reset([
10
+ {name: 'highlight', text:'Highlight'},
11
+ {name: 'touch', text:'Touch In App'},
12
+ {name: 'flash', text:'Flash In App'}
13
+ ])
14
+ @actionDropdownView.collection.at(0).select()
15
+ @actionDropdownView.collection.on 'option-clicked', (option)=> @actionClicked(option.get('name'))
16
+
17
+ @engineDropdownView = new DropdownControl.DropdownView()
18
+ @engineDropdownView.setElement(@$('.selector-engine'))
19
+ @engineDropdownView.collection.reset([
20
+ {name: 'shelley_compat', text:'Shelley'},
21
+ {name: 'uiquery', text:'UIQuery'},
22
+ {name: 'calabash_uispec', text:'Calabash'}
23
+ ])
24
+ @engineDropdownView.collection.at(0).select()
25
+ @engineDropdownView.collection.on 'option-clicked', (option)=>
26
+ @model.set( 'selectorEngine', (option.get('name')) )
27
+
28
+ @$selectorInput = @$('input#query')
29
+
30
+
31
+ @model = new ExperimentBarModel()
32
+ @model.on 'change', _.bind(@update,@)
33
+ @update()
34
+
35
+ update: ->
36
+ @$selectorInput.val( @model.get('selector') )
37
+
38
+ actionClicked: (actionName)->
39
+ @updateModelFromSelectorInput()
40
+ @model.actionClicked(actionName)
41
+
42
+
43
+ updateModelFromSelectorInput: ->
44
+ @model.set( 'selector', @$selectorInput.val() )
@@ -0,0 +1,63 @@
1
+ (function() {
2
+
3
+ define(['experiment_bar_model', 'dropdown_control'], function(ExperimentBarModel, DropdownControl) {
4
+ var ExperimentBarView;
5
+ return ExperimentBarView = Backbone.View.extend({
6
+ el: $("#selector-test"),
7
+ initialize: function() {
8
+ var _this = this;
9
+ this.actionDropdownView = new DropdownControl.DropdownView();
10
+ this.actionDropdownView.setElement(this.$('.action-buttons'));
11
+ this.actionDropdownView.collection.reset([
12
+ {
13
+ name: 'highlight',
14
+ text: 'Highlight'
15
+ }, {
16
+ name: 'touch',
17
+ text: 'Touch In App'
18
+ }, {
19
+ name: 'flash',
20
+ text: 'Flash In App'
21
+ }
22
+ ]);
23
+ this.actionDropdownView.collection.at(0).select();
24
+ this.actionDropdownView.collection.on('option-clicked', function(option) {
25
+ return _this.actionClicked(option.get('name'));
26
+ });
27
+ this.engineDropdownView = new DropdownControl.DropdownView();
28
+ this.engineDropdownView.setElement(this.$('.selector-engine'));
29
+ this.engineDropdownView.collection.reset([
30
+ {
31
+ name: 'shelley_compat',
32
+ text: 'Shelley'
33
+ }, {
34
+ name: 'uiquery',
35
+ text: 'UIQuery'
36
+ }, {
37
+ name: 'calabash_uispec',
38
+ text: 'Calabash'
39
+ }
40
+ ]);
41
+ this.engineDropdownView.collection.at(0).select();
42
+ this.engineDropdownView.collection.on('option-clicked', function(option) {
43
+ return _this.model.set('selectorEngine', option.get('name'));
44
+ });
45
+ this.$selectorInput = this.$('input#query');
46
+ this.model = new ExperimentBarModel();
47
+ this.model.on('change', _.bind(this.update, this));
48
+ return this.update();
49
+ },
50
+ update: function() {
51
+ return this.$selectorInput.val(this.model.get('selector'));
52
+ },
53
+ actionClicked: function(actionName) {
54
+ this.updateModelFromSelectorInput();
55
+ return this.model.actionClicked(actionName);
56
+ },
57
+ updateModelFromSelectorInput: function() {
58
+ return this.model.set('selector', this.$selectorInput.val());
59
+ }
60
+ });
61
+ });
62
+
63
+ }).call(this);
@@ -0,0 +1,96 @@
1
+ cacheBust = (url)-> "#{url}?#{(new Date()).getTime()}"
2
+
3
+ baseUrlFor = (path)->
4
+ window.location.protocol + "//" + window.location.host + "/" + path
5
+
6
+ isErrorResponse = (response)-> 'SUCCESS' != response.outcome
7
+
8
+ displayErrorResponse = (response)->
9
+ alert(
10
+ """Frank isn't happy: #{response.reason}
11
+ details: #{response.details}""")
12
+
13
+ fetchViewHierarchy = ->
14
+ request = $.ajax
15
+ type: "POST",
16
+ dataType: "json",
17
+ url: baseUrlFor( "/dump" )
18
+
19
+ fetchOrientation = ->
20
+ deferable = new $.Deferred()
21
+
22
+ request = $.ajax(
23
+ type: "GET",
24
+ dataType: "json",
25
+ url: baseUrlFor( "/orientation" )
26
+ ).done (response)->
27
+ deferable.resolve( response && response.detailed_orientation || 'unknown' )
28
+ .fail( deferable.reject )
29
+
30
+ deferable.promise()
31
+
32
+ requestSnapshotRefresh = ->
33
+ $.ajax
34
+ type: 'GET'
35
+ url: baseUrlFor( "/screenshot/snapshot-all-views" )
36
+
37
+
38
+ sendMapRequest = ({selector, engine, methodName, methodArgs} )->
39
+ selector ||= 'uiquery'
40
+ methodArgs ||= []
41
+
42
+ deferable = new $.Deferred()
43
+ command = {
44
+ query: selector
45
+ selector_engine: engine
46
+ operation: {
47
+ method_name: methodName,
48
+ arguments: methodArgs
49
+ }
50
+ }
51
+
52
+ $.ajax({
53
+ type: "POST"
54
+ dataType: "json"
55
+ data: JSON.stringify( command )
56
+ url: baseUrlFor( '/map' )
57
+ success: (data)->
58
+ if isErrorResponse( data )
59
+ displayErrorResponse( data )
60
+ deferable.reject(data)
61
+ deferable.resolve(data.results)
62
+ error: (xhr,status,error)->
63
+ alert( "Error while talking to Frank: #{status}" )
64
+ deferable.reject(error)
65
+ })
66
+ deferable.promise()
67
+
68
+
69
+
70
+ define ->
71
+ fetchViewHierarchy: fetchViewHierarchy
72
+ fetchOrientation: fetchOrientation
73
+ requestSnapshotRefresh: requestSnapshotRefresh
74
+ baseScreenshotUrl: ->
75
+ cacheBust( baseUrlFor('/screenshot') )
76
+ snapshotUrlForViewWithUid: (uid)->
77
+ cacheBust( baseUrlFor( "/screenshot/view-snapshot/#{uid}" ) )
78
+ sendFlashCommand: (selector,engine)->
79
+ sendMapRequest(
80
+ selector:selector,
81
+ engine: engine,
82
+ methodName: 'FEX_flash'
83
+ )
84
+ sendTouchCommand: (selector,engine)->
85
+ sendMapRequest(
86
+ selector:selector,
87
+ engine: engine,
88
+ methodName: 'touch'
89
+ )
90
+ getAccessibilityFramesForViewsMatchingSelector: (selector,engine)->
91
+ sendMapRequest(
92
+ selector:selector,
93
+ engine: engine,
94
+ methodName: 'accessibilityFrame'
95
+ )
96
+