bauxite 0.6.18 → 0.6.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +293 -293
  4. data/Rakefile +128 -128
  5. data/bin/bauxite +27 -27
  6. data/doc/Bauxite.html +6 -9
  7. data/doc/Bauxite/Action.html +298 -315
  8. data/doc/Bauxite/ActionModule.html +23 -26
  9. data/doc/Bauxite/Application.html +36 -38
  10. data/doc/Bauxite/Context.html +303 -303
  11. data/doc/Bauxite/Errors.html +6 -9
  12. data/doc/Bauxite/Errors/AssertionError.html +6 -9
  13. data/doc/Bauxite/Errors/FileNotFoundError.html +6 -9
  14. data/doc/Bauxite/Errors/FormatError.html +6 -9
  15. data/doc/Bauxite/Loggers.html +6 -9
  16. data/doc/Bauxite/Loggers/CompositeLogger.html +29 -32
  17. data/doc/Bauxite/Loggers/EchoLogger.html +10 -13
  18. data/doc/Bauxite/Loggers/FileLogger.html +25 -28
  19. data/doc/Bauxite/Loggers/HtmlLogger.html +99 -102
  20. data/doc/Bauxite/Loggers/NullLogger.html +16 -19
  21. data/doc/Bauxite/Loggers/ReportLogger.html +43 -46
  22. data/doc/Bauxite/Loggers/TerminalLogger.html +76 -79
  23. data/doc/Bauxite/Loggers/XtermLogger.html +28 -31
  24. data/doc/Bauxite/Parser.html +87 -89
  25. data/doc/Bauxite/ParserModule.html +19 -22
  26. data/doc/Bauxite/Selector.html +99 -105
  27. data/doc/Bauxite/SelectorModule.html +27 -30
  28. data/doc/README_md.html +117 -103
  29. data/doc/created.rid +58 -58
  30. data/doc/fonts.css +167 -167
  31. data/doc/fonts/Lato-Light.ttf +0 -0
  32. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  33. data/doc/fonts/Lato-Regular.ttf +0 -0
  34. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  35. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  36. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  37. data/doc/images/add.png +0 -0
  38. data/doc/images/arrow_up.png +0 -0
  39. data/doc/images/brick.png +0 -0
  40. data/doc/images/brick_link.png +0 -0
  41. data/doc/images/bug.png +0 -0
  42. data/doc/images/bullet_black.png +0 -0
  43. data/doc/images/bullet_toggle_minus.png +0 -0
  44. data/doc/images/bullet_toggle_plus.png +0 -0
  45. data/doc/images/date.png +0 -0
  46. data/doc/images/delete.png +0 -0
  47. data/doc/images/find.png +0 -0
  48. data/doc/images/loadingAnimation.gif +0 -0
  49. data/doc/images/macFFBgHack.png +0 -0
  50. data/doc/images/package.png +0 -0
  51. data/doc/images/page_green.png +0 -0
  52. data/doc/images/page_white_text.png +0 -0
  53. data/doc/images/page_white_width.png +0 -0
  54. data/doc/images/plugin.png +0 -0
  55. data/doc/images/ruby.png +0 -0
  56. data/doc/images/tag_blue.png +0 -0
  57. data/doc/images/tag_green.png +0 -0
  58. data/doc/images/transparent.png +0 -0
  59. data/doc/images/wrench.png +0 -0
  60. data/doc/images/wrench_orange.png +0 -0
  61. data/doc/images/zoom.png +0 -0
  62. data/doc/index.html +117 -103
  63. data/doc/js/darkfish.js +32 -11
  64. data/doc/js/jquery.js +0 -0
  65. data/doc/js/navigation.js +0 -0
  66. data/doc/js/search.js +0 -0
  67. data/doc/js/search_index.js +1 -1
  68. data/doc/js/searcher.js +0 -0
  69. data/doc/rdoc.css +580 -580
  70. data/doc/table_of_contents.html +69 -72
  71. data/lib/bauxite.rb +28 -28
  72. data/lib/bauxite/actions/alias.rb +51 -51
  73. data/lib/bauxite/actions/assert.rb +49 -49
  74. data/lib/bauxite/actions/asserth.rb +60 -60
  75. data/lib/bauxite/actions/assertm.rb +49 -49
  76. data/lib/bauxite/actions/assertv.rb +40 -40
  77. data/lib/bauxite/actions/assertw.rb +47 -47
  78. data/lib/bauxite/actions/break.rb +39 -39
  79. data/lib/bauxite/actions/capture.rb +61 -61
  80. data/lib/bauxite/actions/click.rb +36 -36
  81. data/lib/bauxite/actions/debug.rb +103 -103
  82. data/lib/bauxite/actions/doif.rb +43 -43
  83. data/lib/bauxite/actions/dounless.rb +43 -43
  84. data/lib/bauxite/actions/echo.rb +36 -36
  85. data/lib/bauxite/actions/exec.rb +46 -46
  86. data/lib/bauxite/actions/exit.rb +35 -35
  87. data/lib/bauxite/actions/failif.rb +52 -52
  88. data/lib/bauxite/actions/js.rb +41 -41
  89. data/lib/bauxite/actions/load.rb +49 -49
  90. data/lib/bauxite/actions/open.rb +35 -35
  91. data/lib/bauxite/actions/params.rb +40 -40
  92. data/lib/bauxite/actions/replace.rb +37 -37
  93. data/lib/bauxite/actions/reset.rb +38 -38
  94. data/lib/bauxite/actions/return.rb +68 -68
  95. data/lib/bauxite/actions/ruby.rb +58 -58
  96. data/lib/bauxite/actions/select.rb +48 -48
  97. data/lib/bauxite/actions/set.rb +39 -39
  98. data/lib/bauxite/actions/setif.rb +44 -44
  99. data/lib/bauxite/actions/source.rb +44 -44
  100. data/lib/bauxite/actions/store.rb +38 -38
  101. data/lib/bauxite/actions/submit.rb +37 -37
  102. data/lib/bauxite/actions/test.rb +67 -67
  103. data/lib/bauxite/actions/tryload.rb +71 -71
  104. data/lib/bauxite/actions/wait.rb +38 -38
  105. data/lib/bauxite/actions/write.rb +44 -44
  106. data/lib/bauxite/application.rb +349 -349
  107. data/lib/bauxite/core/action.rb +199 -199
  108. data/lib/bauxite/core/context.rb +791 -791
  109. data/lib/bauxite/core/errors.rb +41 -41
  110. data/lib/bauxite/core/logger.rb +169 -169
  111. data/lib/bauxite/core/parser.rb +85 -85
  112. data/lib/bauxite/core/selector.rb +152 -152
  113. data/lib/bauxite/loggers/composite.rb +91 -91
  114. data/lib/bauxite/loggers/echo.rb +36 -36
  115. data/lib/bauxite/loggers/file.rb +68 -68
  116. data/lib/bauxite/loggers/html.rb +154 -154
  117. data/lib/bauxite/loggers/terminal.rb +134 -134
  118. data/lib/bauxite/loggers/xterm.rb +101 -101
  119. data/lib/bauxite/parsers/csv.rb +43 -43
  120. data/lib/bauxite/parsers/default.rb +42 -42
  121. data/lib/bauxite/parsers/html.rb +79 -79
  122. data/lib/bauxite/selectors/attr.rb +39 -39
  123. data/lib/bauxite/selectors/frame.rb +60 -60
  124. data/lib/bauxite/selectors/json.rb +88 -88
  125. data/lib/bauxite/selectors/sid.rb +38 -38
  126. data/lib/bauxite/selectors/smart.rb +80 -80
  127. data/lib/bauxite/selectors/window.rb +77 -77
  128. data/test/alert.bxt +3 -3
  129. data/test/alert/page.html +4 -4
  130. data/test/alias.bxt +9 -9
  131. data/test/asserth.bxt +2 -2
  132. data/test/assertv.bxt +1 -1
  133. data/test/assertw.bxt +7 -7
  134. data/test/broken.bxt.manual +0 -0
  135. data/test/bug_load_path.bxt.manual +0 -0
  136. data/test/bug_load_path/broken.bxt.manual +0 -0
  137. data/test/bug_load_path/test.bxt +0 -0
  138. data/test/capture.bxt.manual +20 -20
  139. data/test/capture/my_test.bxt +1 -1
  140. data/test/capture/page.html +6 -6
  141. data/test/capture_on_error.bxt.manual +3 -3
  142. data/test/capture_on_error/my_test.bxt +1 -1
  143. data/test/capture_on_error/page.html +2 -2
  144. data/test/debug.bxt.manual +0 -0
  145. data/test/default_selector.bxt.manual +7 -7
  146. data/test/default_selector/page.html +10 -10
  147. data/test/default_selector_var.bxt +1 -1
  148. data/test/delay.bxt +2 -2
  149. data/test/delay/page.html +4 -4
  150. data/test/doif.bxt +6 -6
  151. data/test/dounless.bxt +6 -6
  152. data/test/exec.bxt +6 -6
  153. data/test/exit.bxt +3 -3
  154. data/test/exit/test.bxt +3 -3
  155. data/test/extension.bxt.manual +4 -4
  156. data/test/extension/custom.rb +12 -12
  157. data/test/extension/page.html +4 -4
  158. data/test/failif.bxt +7 -7
  159. data/test/failif/page.html +5 -5
  160. data/test/format.bxt +17 -17
  161. data/test/format/page.html +6 -6
  162. data/test/frame.bxt +6 -6
  163. data/test/frame/child_frame.html +6 -6
  164. data/test/frame/grandchild_frame.html +4 -4
  165. data/test/frame/page.html +4 -4
  166. data/test/js.bxt +4 -4
  167. data/test/json.bxt +19 -19
  168. data/test/json/array.json +3 -3
  169. data/test/json/object.json +13 -13
  170. data/test/load.bxt +18 -18
  171. data/test/load/child.bxt +12 -12
  172. data/test/parsers.bxt +1 -1
  173. data/test/parsers.csv +7 -7
  174. data/test/parsers.html +32 -32
  175. data/test/parsers/page.html +6 -6
  176. data/test/return.bxt +1 -1
  177. data/test/return/f1.bxt +1 -1
  178. data/test/return/f2.bxt +1 -1
  179. data/test/return/f3.bxt +1 -1
  180. data/test/return/f4.bxt +2 -2
  181. data/test/ruby.bxt +1 -1
  182. data/test/ruby/custom.rb +5 -5
  183. data/test/select.bxt +9 -9
  184. data/test/select/page.html +8 -8
  185. data/test/selectors.bxt +7 -7
  186. data/test/selectors/page.html +6 -6
  187. data/test/set_builtin.bxt +5 -0
  188. data/test/set_builtin/page.html +5 -0
  189. data/test/setif.bxt +3 -3
  190. data/test/smart_selector.bxt +17 -17
  191. data/test/smart_selector/page.html +17 -17
  192. data/test/stdin.bxt +0 -0
  193. data/test/submit.bxt +4 -4
  194. data/test/submit/page.html +6 -6
  195. data/test/submit/page2.html +4 -4
  196. data/test/test.bxt.manual +6 -6
  197. data/test/test/test1.bxt +2 -2
  198. data/test/test/test2.bxt +3 -3
  199. data/test/test/test3.bxt +2 -2
  200. data/test/test/test4.bxt +1 -1
  201. data/test/test/test5.bxt +1 -1
  202. data/test/window.bxt +14 -14
  203. data/test/window/page.html +5 -5
  204. data/test/window/popup.html +4 -4
  205. metadata +5 -3
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/doc/images/add.png CHANGED
File without changes
File without changes
data/doc/images/brick.png CHANGED
File without changes
File without changes
data/doc/images/bug.png CHANGED
File without changes
File without changes
File without changes
File without changes
data/doc/images/date.png CHANGED
File without changes
File without changes
data/doc/images/find.png CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/doc/images/ruby.png CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/doc/images/zoom.png CHANGED
File without changes
data/doc/index.html CHANGED
@@ -6,20 +6,17 @@
6
6
 
7
7
  <title>RDoc Documentation</title>
8
8
 
9
- <link href="./fonts.css" rel="stylesheet">
10
- <link href="./rdoc.css" rel="stylesheet">
11
-
12
9
  <script type="text/javascript">
13
10
  var rdoc_rel_prefix = "./";
14
11
  </script>
15
12
 
16
13
  <script src="./js/jquery.js"></script>
17
- <script src="./js/navigation.js"></script>
18
- <script src="./js/search_index.js"></script>
19
- <script src="./js/search.js"></script>
20
- <script src="./js/searcher.js"></script>
21
14
  <script src="./js/darkfish.js"></script>
22
15
 
16
+ <link href="./css/fonts.css" rel="stylesheet">
17
+ <link href="./css/rdoc.css" rel="stylesheet">
18
+
19
+
23
20
 
24
21
  <body id="top" role="document" class="file">
25
22
  <nav role="navigation">
@@ -123,7 +120,7 @@
123
120
  <main role="main">
124
121
 
125
122
 
126
- <h1 id="label-bauxite">bauxite<span><a href="#label-bauxite">&para;</a> <a href="#documentation">&uarr;</a></span></h1>
123
+ <h1 id="label-bauxite">bauxite<span><a href="#label-bauxite">&para;</a> <a href="#top">&uarr;</a></span></h1>
127
124
 
128
125
  <p><a href="Bauxite.html">Bauxite</a> is a façade over Selenium intended for
129
126
  non-developers</p>
@@ -136,16 +133,16 @@ create functional abstractions over technical details.</p>
136
133
  <p>Take a look at the following Ruby excerpt from <a
137
134
  href="http://code.google.com/p/selenium/wiki/RubyBindings">code.google.com/p/selenium/wiki/RubyBindings</a>:</p>
138
135
 
139
- <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&quot;selenium-webdriver&quot;</span>
136
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&quot;selenium-webdriver&quot;</span>
140
137
 
141
- <span class="ruby-identifier">driver</span> = <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span>.<span class="ruby-identifier">for</span> :<span class="ruby-identifier">firefox</span>
142
- <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">navigate</span>.<span class="ruby-identifier">to</span> <span class="ruby-string">&quot;http://google.com&quot;</span>
138
+ <span class="ruby-identifier">driver</span> = <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span>.<span class="ruby-identifier">for</span> :<span class="ruby-identifier">firefox</span>
139
+ <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">navigate</span>.<span class="ruby-identifier">to</span> <span class="ruby-string">&quot;http://google.com&quot;</span>
143
140
 
144
- <span class="ruby-identifier">element</span> = <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">find_element</span>(:<span class="ruby-identifier">name</span>, <span class="ruby-string">&#39;q&#39;</span>)
145
- <span class="ruby-identifier">element</span>.<span class="ruby-identifier">send_keys</span> <span class="ruby-string">&quot;Hello WebDriver!&quot;</span>
146
- <span class="ruby-identifier">element</span>.<span class="ruby-identifier">submit</span>
141
+ <span class="ruby-identifier">element</span> = <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">find_element</span>(:<span class="ruby-identifier">name</span>, <span class="ruby-string">&#39;q&#39;</span>)
142
+ <span class="ruby-identifier">element</span>.<span class="ruby-identifier">send_keys</span> <span class="ruby-string">&quot;Hello WebDriver!&quot;</span>
143
+ <span class="ruby-identifier">element</span>.<span class="ruby-identifier">submit</span>
147
144
 
148
- <span class="ruby-identifier">puts</span> <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">title</span>
145
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">title</span>
149
146
 
150
147
  <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">quit</span>
151
148
  </pre>
@@ -156,15 +153,17 @@ might be a bit shocked.</p>
156
153
  <p>The equivalent <a href="Bauxite.html">Bauxite</a> test is easier on the
157
154
  eyes:</p>
158
155
 
159
- <pre>open &quot;http://google.com&quot;
160
- write &quot;name=q&quot; &quot;Hello WebDriver!&quot;
161
- click &quot;gbqfb&quot;</pre>
156
+ <pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://google.com&quot;</span>
157
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;name=q&quot;</span> <span class="ruby-string">&quot;Hello WebDriver!&quot;</span>
158
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;gbqfb&quot;</span>
159
+ </pre>
162
160
 
163
- <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
161
+ <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
164
162
 
165
163
  <p>In a nutshell:</p>
166
164
 
167
- <pre>gem install bauxite</pre>
165
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-identifier">install</span> <span class="ruby-identifier">bauxite</span>
166
+ </pre>
168
167
 
169
168
  <p>If you don&#39;t have Ruby 2.x yet, check the <a
170
169
  href="#installing-ruby">Installing Ruby</a> section below.</p>
@@ -180,17 +179,19 @@ Firefox add-on to record <a href="Bauxite.html">Bauxite</a> tests directly
180
179
  from the browser (please note that this extension is still <em>very</em>
181
180
  experimental so its not yet hosted in the Mozilla add-ons page).</p>
182
181
 
183
- <h2 id="label-Hello+World">Hello World<span><a href="#label-Hello+World">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
182
+ <h2 id="label-Hello+World">Hello World<span><a href="#label-Hello+World">&para;</a> <a href="#top">&uarr;</a></span></h2>
184
183
 
185
184
  <p>Paste the following text into <code>hello.bxt</code>:</p>
186
185
 
187
- <pre>open &quot;http://www.gnu.org/fun/jokes/helloworld.html&quot;</pre>
186
+ <pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://www.gnu.org/fun/jokes/helloworld.html&quot;</span>
187
+ </pre>
188
188
 
189
189
  <p>Launch a terminal/command prompt and type:</p>
190
190
 
191
- <pre>bauxite hello.bxt</pre>
191
+ <pre class="ruby"><span class="ruby-identifier">bauxite</span> <span class="ruby-identifier">hello</span>.<span class="ruby-identifier">bxt</span>
192
+ </pre>
192
193
 
193
- <h2 id="label-Command-line+Interface">Command-line Interface<span><a href="#label-Command-line+Interface">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
194
+ <h2 id="label-Command-line+Interface">Command-line Interface<span><a href="#label-Command-line+Interface">&para;</a> <a href="#top">&uarr;</a></span></h2>
194
195
 
195
196
  <p>The <code>bauxite</code> command-line program supports several
196
197
  configuration options.</p>
@@ -199,7 +200,7 @@ configuration options.</p>
199
200
  href="http://pzavolinsky.github.io/bauxite/Bauxite/Application.html">RDoc
200
201
  documentation</a> for more details.</p>
201
202
 
202
- <h2 id="label-The+Bauxite+Language">The <a href="Bauxite.html">Bauxite</a> Language<span><a href="#label-The+Bauxite+Language">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
203
+ <h2 id="label-The+Bauxite+Language">The <a href="Bauxite.html">Bauxite</a> Language<span><a href="#label-The+Bauxite+Language">&para;</a> <a href="#top">&uarr;</a></span></h2>
203
204
 
204
205
  <p>The <a href="Bauxite.html">Bauxite</a> language is composed of two elements
205
206
  <code>Actions</code> and <code>Selectors</code>: Actions are testing
@@ -211,9 +212,10 @@ elements of a page such as a button, a textbox, a label, etc.</p>
211
212
  contains a series of Actions (one per line). Depending on the Action, a few
212
213
  action arguments might need to be specified as well. For example in:</p>
213
214
 
214
- <pre>open &quot;http://google.com&quot;
215
- write &quot;name=q&quot; &quot;Hello WebDriver!&quot;
216
- click &quot;gbqfb&quot;</pre>
215
+ <pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://google.com&quot;</span>
216
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;name=q&quot;</span> <span class="ruby-string">&quot;Hello WebDriver!&quot;</span>
217
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;gbqfb&quot;</span>
218
+ </pre>
217
219
 
218
220
  <p><code>open</code>, <code>write</code> and <code>click</code> are Actions: -
219
221
  <code>open</code> takes a single URL argument
@@ -242,7 +244,8 @@ href="Bauxite.html">Bauxite</a> uses Selectors.</p>
242
244
 
243
245
  <p>If we want to click the “Search” button we can do the following:</p>
244
246
 
245
- <pre>click &quot;gbqfb&quot;</pre>
247
+ <pre class="ruby"><span class="ruby-identifier">click</span> <span class="ruby-string">&quot;gbqfb&quot;</span>
248
+ </pre>
246
249
 
247
250
  <p><a href="Bauxite.html">Bauxite</a> supports several other Selectors such as
248
251
  <code>name=</code> in the example above. The <code>name</code> Selector
@@ -256,7 +259,8 @@ the <code>=</code> sign.</p>
256
259
  <p>If we want to type the text “Hello WebDriver!” in the textbox we can do the
257
260
  following:</p>
258
261
 
259
- <pre>write &quot;name=q&quot; &quot;Hello WebDriver!&quot;</pre>
262
+ <pre class="ruby"><span class="ruby-identifier">write</span> <span class="ruby-string">&quot;name=q&quot;</span> <span class="ruby-string">&quot;Hello WebDriver!&quot;</span>
263
+ </pre>
260
264
 
261
265
  <p>This section presented a brief introduction into the basic <a
262
266
  href="Bauxite.html">Bauxite</a> concepts. For more details and a list of
@@ -287,7 +291,7 @@ href="http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html">Creating
287
291
  new Selectors</a></p>
288
292
  </li></ul>
289
293
 
290
- <h2 id="label-Firefox+add-on">Firefox add-on<span><a href="#label-Firefox+add-on">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
294
+ <h2 id="label-Firefox+add-on">Firefox add-on<span><a href="#label-Firefox+add-on">&para;</a> <a href="#top">&uarr;</a></span></h2>
291
295
 
292
296
  <p>As an alternative method of writing <a href="Bauxite.html">Bauxite</a>
293
297
  tests, you might try the <a
@@ -296,15 +300,15 @@ Firefox add-on to record <a href="Bauxite.html">Bauxite</a> tests directly
296
300
  from the browser (please note that this extension is still <em>very</em>
297
301
  experimental so its not yet hosted in the Mozilla add-ons page).</p>
298
302
 
299
- <h2 id="label-Installing+Ruby">Installing Ruby<span><a href="#label-Installing+Ruby">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
303
+ <h2 id="label-Installing+Ruby">Installing Ruby<span><a href="#label-Installing+Ruby">&para;</a> <a href="#top">&uarr;</a></span></h2>
300
304
 
301
305
  <p>I won&#39;t cover all the details of installing Ruby on your system (Google
302
306
  knows best), but the following should probably work.</p>
303
307
 
304
308
  <p>In GNU/Linux, you can install <a href="http://rvm.io/">RVM</a>, then Ruby:</p>
305
309
 
306
- <pre>curl -sSL https://get.rvm.io | bash -s stable
307
- source ~/.rvm/scripts/rvm
310
+ <pre>curl -sSL https://get.rvm.io | bash -s stable
311
+ source ~/.rvm/scripts/rvm
308
312
  rvm install ruby-2.1.0</pre>
309
313
 
310
314
  <p>In Windows, you can install Ruby 2.x with <a
@@ -315,9 +319,10 @@ Ruby</code> option in your start menu.</p>
315
319
  <p>Regadless of your OS, you should be able to install <a
316
320
  href="Bauxite.html">Bauxite</a> with:</p>
317
321
 
318
- <pre>gem install bauxite</pre>
322
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-identifier">install</span> <span class="ruby-identifier">bauxite</span>
323
+ </pre>
319
324
 
320
- <h2 id="label-Implementation">Implementation<span><a href="#label-Implementation">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
325
+ <h2 id="label-Implementation">Implementation<span><a href="#label-Implementation">&para;</a> <a href="#top">&uarr;</a></span></h2>
321
326
 
322
327
  <p><a href="Bauxite.html">Bauxite</a> is both a command-line program and a
323
328
  library. You can use the program to run <a href="Bauxite.html">Bauxite</a>
@@ -335,31 +340,32 @@ application take a look a the code in
335
340
  example of how to create a <a href="Bauxite.html">Bauxite</a> Context and
336
341
  execute some actions.</p>
337
342
 
338
- <h2 id="label-Extending+Bauxite">Extending <a href="Bauxite.html">Bauxite</a><span><a href="#label-Extending+Bauxite">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
343
+ <h2 id="label-Extending+Bauxite">Extending <a href="Bauxite.html">Bauxite</a><span><a href="#label-Extending+Bauxite">&para;</a> <a href="#top">&uarr;</a></span></h2>
339
344
 
340
345
  <p><a href="Bauxite.html">Bauxite</a> supports two types of extensions:
341
346
  functional extensions and coded plugins.</p>
342
347
 
343
- <h3 id="label-Functional+extensions">Functional extensions<span><a href="#label-Functional+extensions">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
348
+ <h3 id="label-Functional+extensions">Functional extensions<span><a href="#label-Functional+extensions">&para;</a> <a href="#top">&uarr;</a></span></h3>
344
349
 
345
350
  <p>Functional extensions are composite constructs created using existing <a
346
351
  href="Bauxite.html">Bauxite</a> actions to convey functional meaning. For
347
352
  example, imagine a login form:</p>
348
353
 
349
- <pre>&lt;!-- http://hostname/login.html --&gt;
350
- &lt;form&gt;
351
- &lt;input id=&quot;username&quot; name=&quot;username&quot; type=&quot;text&quot; /&gt;
352
- &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; /&gt;
353
- &lt;input id=&quot;login&quot; type=&quot;submit&quot; value=&quot;Login&quot;/&gt;
354
+ <pre>&lt;!-- http://hostname/login.html --&gt;
355
+ &lt;form&gt;
356
+ &lt;input id=&quot;username&quot; name=&quot;username&quot; type=&quot;text&quot; /&gt;
357
+ &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; /&gt;
358
+ &lt;input id=&quot;login&quot; type=&quot;submit&quot; value=&quot;Login&quot;/&gt;
354
359
  &lt;/form&gt;</pre>
355
360
 
356
361
  <p>The <a href="Bauxite.html">Bauxite</a> code to login into this site would
357
362
  be:</p>
358
363
 
359
- <pre>open &quot;http://hostname/login.html&quot;
360
- write &quot;username&quot; &quot;jdoe&quot;
361
- write &quot;password&quot; &quot;hello world!&quot;
362
- click &quot;login&quot;</pre>
364
+ <pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://hostname/login.html&quot;</span>
365
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;username&quot;</span> <span class="ruby-string">&quot;jdoe&quot;</span>
366
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;password&quot;</span> <span class="ruby-string">&quot;hello world!&quot;</span>
367
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;login&quot;</span>
368
+ </pre>
363
369
 
364
370
  <p>If we were creating a suite of automated web tests for our
365
371
  <em>hostname</em> site, we&#39;ll probably need to login into the site
@@ -370,70 +376,75 @@ test in our suite.</p>
370
376
  tests into many files and include one test into another with the
371
377
  <code>load</code> action.</p>
372
378
 
373
- <pre># my_test.bxt (by the way, this is a comment)
374
- load other_test_fragment.bxt
379
+ <pre># my_test.bxt (by the way, this is a comment)
380
+ load other_test_fragment.bxt
375
381
  ...</pre>
376
382
 
377
383
  <p>Back to our login example, first we can package the login part of our tests
378
384
  into a separate <a href="Bauxite.html">Bauxite</a> file:</p>
379
385
 
380
- <pre># login.bxt
381
- open &quot;http://hostname/login.html&quot;
382
- write &quot;username&quot; &quot;jdoe&quot;
383
- write &quot;password&quot; &quot;hello world!&quot;
384
- click &quot;login&quot;</pre>
386
+ <pre class="ruby"><span class="ruby-comment"># login.bxt
387
+ <span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://hostname/login.html&quot;</span>
388
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;username&quot;</span> <span class="ruby-string">&quot;jdoe&quot;</span>
389
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;password&quot;</span> <span class="ruby-string">&quot;hello world!&quot;</span>
390
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;login&quot;</span>
391
+ </pre>
385
392
 
386
393
  <p>Of course we would like to be able to login with different
387
394
  username/password combinations, so we can replace the literals in
388
395
  <code>login.bxt</code> with variables:</p>
389
396
 
390
- <pre># login.bxt
391
- open &quot;http://hostname/login.html&quot;
392
- write &quot;username&quot; &quot;${username}&quot;
393
- write &quot;password&quot; &quot;${password}&quot;
394
- click &quot;login&quot;</pre>
397
+ <pre class="ruby"><span class="ruby-comment"># login.bxt
398
+ <span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://hostname/login.html&quot;</span>
399
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;username&quot;</span> <span class="ruby-string">&quot;${username}&quot;</span>
400
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;password&quot;</span> <span class="ruby-string">&quot;${password}&quot;</span>
401
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;login&quot;</span>
402
+ </pre>
395
403
 
396
404
  <p>Now, we would like to assert that both <code>username</code> and
397
405
  <code>password</code> variables are set before calling our test (just in
398
406
  case someone forgets). We can do this with <code>params</code></p>
399
407
 
400
- <pre># login.bxt
401
- params username password
402
- open &quot;http://hostname/login.html&quot;
403
- write &quot;username&quot; &quot;${username}&quot;
404
- write &quot;password&quot; &quot;${password}&quot;
405
- click &quot;login&quot;</pre>
408
+ <pre class="ruby"><span class="ruby-comment"># login.bxt
409
+ <span class="ruby-identifier">params</span> <span class="ruby-identifier">username</span> <span class="ruby-identifier">password</span>
410
+ <span class="ruby-identifier">open</span> <span class="ruby-string">&quot;http://hostname/login.html&quot;</span>
411
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;username&quot;</span> <span class="ruby-string">&quot;${username}&quot;</span>
412
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;password&quot;</span> <span class="ruby-string">&quot;${password}&quot;</span>
413
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;login&quot;</span>
414
+ </pre>
406
415
 
407
416
  <p>In our main test we can load <code>login.bxt</code> and specify the
408
417
  variables required using this code:</p>
409
418
 
410
- <pre># main_test.bxt
411
- load &quot;login.bxt&quot; &quot;username=jdoe&quot; &quot;password=hello world!&quot;
419
+ <pre class="ruby"><span class="ruby-comment"># main_test.bxt
420
+ <span class="ruby-identifier">load</span> <span class="ruby-string">&quot;login.bxt&quot;</span> <span class="ruby-string">&quot;username=jdoe&quot;</span> <span class="ruby-string">&quot;password=hello world!&quot;</span>
412
421
 
413
- # additional actions go here</pre>
422
+ <span class="ruby-comment"># additional actions go here</span>
423
+ </pre>
414
424
 
415
425
  <p>We could improve this even further by creating an <code>alias</code> to
416
426
  simplify the login process. To do this, lets create an new file called
417
427
  <code>alias.bxt</code>:</p>
418
428
 
419
- <pre># alias.bxt
429
+ <pre># alias.bxt
420
430
  alias &quot;login&quot; &quot;load&quot; &quot;login.bxt&quot; &quot;username=${1}&quot; &quot;password=${2}&quot;</pre>
421
431
 
422
432
  <p>Note that the <code>alias</code> action supports positional arguments.</p>
423
433
 
424
434
  <p>Now we can change our main test to use our alias:</p>
425
435
 
426
- <pre># main_test.bxt
427
- load &quot;alias.bxt&quot;
436
+ <pre class="ruby"><span class="ruby-comment"># main_test.bxt
437
+ <span class="ruby-identifier">load</span> <span class="ruby-string">&quot;alias.bxt&quot;</span>
428
438
 
429
- login &quot;jdoe&quot; &quot;hello world!&quot;
439
+ <span class="ruby-identifier">login</span> <span class="ruby-string">&quot;jdoe&quot;</span> <span class="ruby-string">&quot;hello world!&quot;</span>
430
440
 
431
- # additional actions go here</pre>
441
+ <span class="ruby-comment"># additional actions go here</span>
442
+ </pre>
432
443
 
433
444
  <p>That was a bit of work but the resulting test is purely functional (minus
434
445
  the load alias part, of course).</p>
435
446
 
436
- <h3 id="label-Coded+plugins">Coded plugins<span><a href="#label-Coded+plugins">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
447
+ <h3 id="label-Coded+plugins">Coded plugins<span><a href="#label-Coded+plugins">&para;</a> <a href="#top">&uarr;</a></span></h3>
437
448
 
438
449
  <p>Coded plugins are Ruby files that extend the <a
439
450
  href="Bauxite.html">Bauxite</a> language by providing additional language
@@ -444,44 +455,46 @@ href="Bauxite.html">Bauxite</a> actions, selectors and loggers.</p>
444
455
  were identified using a custom HTML attribute instead of <code>id</code>.
445
456
  For example:</p>
446
457
 
447
- <pre>&lt;form&gt;
448
- &lt;input custom-attr=&quot;username&quot; type=&quot;text&quot; /&gt;
449
- &lt;input custom-attr=&quot;password&quot; type=&quot;password&quot; /&gt;
450
- &lt;input custom-attr=&quot;login&quot; type=&quot;submit&quot; value=&quot;Login&quot;/&gt;
458
+ <pre>&lt;form&gt;
459
+ &lt;input custom-attr=&quot;username&quot; type=&quot;text&quot; /&gt;
460
+ &lt;input custom-attr=&quot;password&quot; type=&quot;password&quot; /&gt;
461
+ &lt;input custom-attr=&quot;login&quot; type=&quot;submit&quot; value=&quot;Login&quot;/&gt;
451
462
  &lt;/form&gt;</pre>
452
463
 
453
464
  <p>Using standard <a href="Bauxite.html">Bauxite</a> language we could select
454
465
  these elements using:</p>
455
466
 
456
- <pre># === my_test.bxt === #
457
- write &quot;attr=custom-attr:username&quot; &quot;jdoe&quot;
458
- write &quot;attr=custom-attr:password&quot; &quot;hello world!&quot;
459
- click &quot;attr=custom-attr:login&quot;</pre>
467
+ <pre class="ruby"><span class="ruby-comment"># === my_test.bxt === #
468
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;attr=custom-attr:username&quot;</span> <span class="ruby-string">&quot;jdoe&quot;</span>
469
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;attr=custom-attr:password&quot;</span> <span class="ruby-string">&quot;hello world!&quot;</span>
470
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;attr=custom-attr:login&quot;</span>
471
+ </pre>
460
472
 
461
473
  <p>But we can improve the overall readability of our test by using a coded
462
474
  plugin:</p>
463
475
 
464
- <pre class="ruby"><span class="ruby-comment"># === plugins/custom_selector.rb === #</span>
465
- <span class="ruby-keyword">class</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Selector</span>
466
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">custom</span>(<span class="ruby-identifier">value</span>)
467
- <span class="ruby-identifier">attr</span> <span class="ruby-node">&quot;custom-attr:#{value}&quot;</span>
468
- <span class="ruby-keyword">end</span>
476
+ <pre class="ruby"><span class="ruby-comment"># === plugins/custom_selector.rb === #
477
+ <span class="ruby-keyword">class</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Selector</span>
478
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">custom</span>(<span class="ruby-identifier">value</span>)
479
+ <span class="ruby-identifier">attr</span> <span class="ruby-node">&quot;custom-attr:#{value}&quot;</span>
480
+ <span class="ruby-keyword">end</span>
469
481
  <span class="ruby-keyword">end</span>
470
482
  </pre>
471
483
 
472
484
  <p>Now we can change our test to look like this:</p>
473
485
 
474
- <pre># === my_test.bxt === #
475
- write &quot;custom=username&quot; &quot;jdoe&quot;
476
- write &quot;custom=password&quot; &quot;hello world!&quot;
477
- click &quot;custom=login&quot;</pre>
486
+ <pre class="ruby"><span class="ruby-comment"># === my_test.bxt === #
487
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;custom=username&quot;</span> <span class="ruby-string">&quot;jdoe&quot;</span>
488
+ <span class="ruby-identifier">write</span> <span class="ruby-string">&quot;custom=password&quot;</span> <span class="ruby-string">&quot;hello world!&quot;</span>
489
+ <span class="ruby-identifier">click</span> <span class="ruby-string">&quot;custom=login&quot;</span>
490
+ </pre>
478
491
 
479
492
  <p>Finally, to execute <a href="Bauxite.html">Bauxite</a> loading our plugin
480
493
  we can type:</p>
481
494
 
482
495
  <pre>bauxite -e plugins my_test.bxt</pre>
483
496
 
484
- <h2 id="label-Jenkins+Integration">Jenkins Integration<span><a href="#label-Jenkins+Integration">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
497
+ <h2 id="label-Jenkins+Integration">Jenkins Integration<span><a href="#label-Jenkins+Integration">&para;</a> <a href="#top">&uarr;</a></span></h2>
485
498
 
486
499
  <p>If you want to run <a href="Bauxite.html">Bauxite</a> tests in your <a
487
500
  href="http://jenkins-ci.org/">Jenkins CI</a> server you must install
@@ -491,9 +504,9 @@ start. Assuming you installed Ruby and <a href="Bauxite.html">Bauxite</a>
491
504
  for the <code>jenkins</code> user (see the instructions above), you can
492
505
  create an execute shell build task with the following text:</p>
493
506
 
494
- <pre>#!/bin/bash
495
- source ~/.rvm/scripts/rvm
496
- bauxite -t 60 -o 240 --jenkins &quot;$WORKSPACE/test-results&quot; \
507
+ <pre>#!/bin/bash
508
+ source ~/.rvm/scripts/rvm
509
+ bauxite -t 60 -o 240 --jenkins &quot;$WORKSPACE/test-results&quot; \
497
510
  &quot;$WORKSPACE/test/suite.bxt&quot;</pre>
498
511
 
499
512
  <p>Assuming you have Selenium Server running on localhost and your workspace
@@ -502,12 +515,13 @@ bauxite -t 60 -o 240 --jenkins &quot;$WORKSPACE/test-results&quot; \
502
515
 
503
516
  <p><code>suite.bxt</code> could be something like:</p>
504
517
 
505
- <pre># === suite.bxt === #
506
- test login.bxt
507
- test register.bxt
508
- test browse_around.bxt
509
- test purchase_something.bxt
510
- # more tests here...</pre>
518
+ <pre class="ruby"><span class="ruby-comment"># === suite.bxt === #
519
+ <span class="ruby-identifier">test</span> <span class="ruby-identifier">login</span>.<span class="ruby-identifier">bxt</span>
520
+ <span class="ruby-identifier">test</span> <span class="ruby-identifier">register</span>.<span class="ruby-identifier">bxt</span>
521
+ <span class="ruby-identifier">test</span> <span class="ruby-identifier">browse_around</span>.<span class="ruby-identifier">bxt</span>
522
+ <span class="ruby-identifier">test</span> <span class="ruby-identifier">purchase_something</span>.<span class="ruby-identifier">bxt</span>
523
+ <span class="ruby-comment"># more tests here...</span>
524
+ </pre>
511
525
 
512
526
  <p>Note the <code>--jenkins</code> option in the configuration above. That
513
527
  option sets the default configuration arguments for Jenkins integration.
@@ -540,7 +554,7 @@ href="https://wiki.jenkins-ci.org/display/JENKINS/Flexible+Publish+Plugin">Plot<
540
554
 
541
555
  <footer id="validator-badges" role="contentinfo">
542
556
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
543
- <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
544
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
557
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
558
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
545
559
  </footer>
546
560