bauxite 0.6.18 → 0.6.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +293 -293
- data/Rakefile +128 -128
- data/bin/bauxite +27 -27
- data/doc/Bauxite.html +6 -9
- data/doc/Bauxite/Action.html +298 -315
- data/doc/Bauxite/ActionModule.html +23 -26
- data/doc/Bauxite/Application.html +36 -38
- data/doc/Bauxite/Context.html +303 -303
- data/doc/Bauxite/Errors.html +6 -9
- data/doc/Bauxite/Errors/AssertionError.html +6 -9
- data/doc/Bauxite/Errors/FileNotFoundError.html +6 -9
- data/doc/Bauxite/Errors/FormatError.html +6 -9
- data/doc/Bauxite/Loggers.html +6 -9
- data/doc/Bauxite/Loggers/CompositeLogger.html +29 -32
- data/doc/Bauxite/Loggers/EchoLogger.html +10 -13
- data/doc/Bauxite/Loggers/FileLogger.html +25 -28
- data/doc/Bauxite/Loggers/HtmlLogger.html +99 -102
- data/doc/Bauxite/Loggers/NullLogger.html +16 -19
- data/doc/Bauxite/Loggers/ReportLogger.html +43 -46
- data/doc/Bauxite/Loggers/TerminalLogger.html +76 -79
- data/doc/Bauxite/Loggers/XtermLogger.html +28 -31
- data/doc/Bauxite/Parser.html +87 -89
- data/doc/Bauxite/ParserModule.html +19 -22
- data/doc/Bauxite/Selector.html +99 -105
- data/doc/Bauxite/SelectorModule.html +27 -30
- data/doc/README_md.html +117 -103
- data/doc/created.rid +58 -58
- data/doc/fonts.css +167 -167
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +117 -103
- data/doc/js/darkfish.js +32 -11
- data/doc/js/jquery.js +0 -0
- data/doc/js/navigation.js +0 -0
- data/doc/js/search.js +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/searcher.js +0 -0
- data/doc/rdoc.css +580 -580
- data/doc/table_of_contents.html +69 -72
- data/lib/bauxite.rb +28 -28
- data/lib/bauxite/actions/alias.rb +51 -51
- data/lib/bauxite/actions/assert.rb +49 -49
- data/lib/bauxite/actions/asserth.rb +60 -60
- data/lib/bauxite/actions/assertm.rb +49 -49
- data/lib/bauxite/actions/assertv.rb +40 -40
- data/lib/bauxite/actions/assertw.rb +47 -47
- data/lib/bauxite/actions/break.rb +39 -39
- data/lib/bauxite/actions/capture.rb +61 -61
- data/lib/bauxite/actions/click.rb +36 -36
- data/lib/bauxite/actions/debug.rb +103 -103
- data/lib/bauxite/actions/doif.rb +43 -43
- data/lib/bauxite/actions/dounless.rb +43 -43
- data/lib/bauxite/actions/echo.rb +36 -36
- data/lib/bauxite/actions/exec.rb +46 -46
- data/lib/bauxite/actions/exit.rb +35 -35
- data/lib/bauxite/actions/failif.rb +52 -52
- data/lib/bauxite/actions/js.rb +41 -41
- data/lib/bauxite/actions/load.rb +49 -49
- data/lib/bauxite/actions/open.rb +35 -35
- data/lib/bauxite/actions/params.rb +40 -40
- data/lib/bauxite/actions/replace.rb +37 -37
- data/lib/bauxite/actions/reset.rb +38 -38
- data/lib/bauxite/actions/return.rb +68 -68
- data/lib/bauxite/actions/ruby.rb +58 -58
- data/lib/bauxite/actions/select.rb +48 -48
- data/lib/bauxite/actions/set.rb +39 -39
- data/lib/bauxite/actions/setif.rb +44 -44
- data/lib/bauxite/actions/source.rb +44 -44
- data/lib/bauxite/actions/store.rb +38 -38
- data/lib/bauxite/actions/submit.rb +37 -37
- data/lib/bauxite/actions/test.rb +67 -67
- data/lib/bauxite/actions/tryload.rb +71 -71
- data/lib/bauxite/actions/wait.rb +38 -38
- data/lib/bauxite/actions/write.rb +44 -44
- data/lib/bauxite/application.rb +349 -349
- data/lib/bauxite/core/action.rb +199 -199
- data/lib/bauxite/core/context.rb +791 -791
- data/lib/bauxite/core/errors.rb +41 -41
- data/lib/bauxite/core/logger.rb +169 -169
- data/lib/bauxite/core/parser.rb +85 -85
- data/lib/bauxite/core/selector.rb +152 -152
- data/lib/bauxite/loggers/composite.rb +91 -91
- data/lib/bauxite/loggers/echo.rb +36 -36
- data/lib/bauxite/loggers/file.rb +68 -68
- data/lib/bauxite/loggers/html.rb +154 -154
- data/lib/bauxite/loggers/terminal.rb +134 -134
- data/lib/bauxite/loggers/xterm.rb +101 -101
- data/lib/bauxite/parsers/csv.rb +43 -43
- data/lib/bauxite/parsers/default.rb +42 -42
- data/lib/bauxite/parsers/html.rb +79 -79
- data/lib/bauxite/selectors/attr.rb +39 -39
- data/lib/bauxite/selectors/frame.rb +60 -60
- data/lib/bauxite/selectors/json.rb +88 -88
- data/lib/bauxite/selectors/sid.rb +38 -38
- data/lib/bauxite/selectors/smart.rb +80 -80
- data/lib/bauxite/selectors/window.rb +77 -77
- data/test/alert.bxt +3 -3
- data/test/alert/page.html +4 -4
- data/test/alias.bxt +9 -9
- data/test/asserth.bxt +2 -2
- data/test/assertv.bxt +1 -1
- data/test/assertw.bxt +7 -7
- data/test/broken.bxt.manual +0 -0
- data/test/bug_load_path.bxt.manual +0 -0
- data/test/bug_load_path/broken.bxt.manual +0 -0
- data/test/bug_load_path/test.bxt +0 -0
- data/test/capture.bxt.manual +20 -20
- data/test/capture/my_test.bxt +1 -1
- data/test/capture/page.html +6 -6
- data/test/capture_on_error.bxt.manual +3 -3
- data/test/capture_on_error/my_test.bxt +1 -1
- data/test/capture_on_error/page.html +2 -2
- data/test/debug.bxt.manual +0 -0
- data/test/default_selector.bxt.manual +7 -7
- data/test/default_selector/page.html +10 -10
- data/test/default_selector_var.bxt +1 -1
- data/test/delay.bxt +2 -2
- data/test/delay/page.html +4 -4
- data/test/doif.bxt +6 -6
- data/test/dounless.bxt +6 -6
- data/test/exec.bxt +6 -6
- data/test/exit.bxt +3 -3
- data/test/exit/test.bxt +3 -3
- data/test/extension.bxt.manual +4 -4
- data/test/extension/custom.rb +12 -12
- data/test/extension/page.html +4 -4
- data/test/failif.bxt +7 -7
- data/test/failif/page.html +5 -5
- data/test/format.bxt +17 -17
- data/test/format/page.html +6 -6
- data/test/frame.bxt +6 -6
- data/test/frame/child_frame.html +6 -6
- data/test/frame/grandchild_frame.html +4 -4
- data/test/frame/page.html +4 -4
- data/test/js.bxt +4 -4
- data/test/json.bxt +19 -19
- data/test/json/array.json +3 -3
- data/test/json/object.json +13 -13
- data/test/load.bxt +18 -18
- data/test/load/child.bxt +12 -12
- data/test/parsers.bxt +1 -1
- data/test/parsers.csv +7 -7
- data/test/parsers.html +32 -32
- data/test/parsers/page.html +6 -6
- data/test/return.bxt +1 -1
- data/test/return/f1.bxt +1 -1
- data/test/return/f2.bxt +1 -1
- data/test/return/f3.bxt +1 -1
- data/test/return/f4.bxt +2 -2
- data/test/ruby.bxt +1 -1
- data/test/ruby/custom.rb +5 -5
- data/test/select.bxt +9 -9
- data/test/select/page.html +8 -8
- data/test/selectors.bxt +7 -7
- data/test/selectors/page.html +6 -6
- data/test/set_builtin.bxt +5 -0
- data/test/set_builtin/page.html +5 -0
- data/test/setif.bxt +3 -3
- data/test/smart_selector.bxt +17 -17
- data/test/smart_selector/page.html +17 -17
- data/test/stdin.bxt +0 -0
- data/test/submit.bxt +4 -4
- data/test/submit/page.html +6 -6
- data/test/submit/page2.html +4 -4
- data/test/test.bxt.manual +6 -6
- data/test/test/test1.bxt +2 -2
- data/test/test/test2.bxt +3 -3
- data/test/test/test3.bxt +2 -2
- data/test/test/test4.bxt +1 -1
- data/test/test/test5.bxt +1 -1
- data/test/window.bxt +14 -14
- data/test/window/page.html +5 -5
- data/test/window/popup.html +4 -4
- metadata +5 -3
data/doc/fonts/Lato-Light.ttf
CHANGED
File without changes
|
File without changes
|
data/doc/fonts/Lato-Regular.ttf
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/doc/images/add.png
CHANGED
File without changes
|
data/doc/images/arrow_up.png
CHANGED
File without changes
|
data/doc/images/brick.png
CHANGED
File without changes
|
data/doc/images/brick_link.png
CHANGED
File without changes
|
data/doc/images/bug.png
CHANGED
File without changes
|
data/doc/images/bullet_black.png
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/doc/images/date.png
CHANGED
File without changes
|
data/doc/images/delete.png
CHANGED
File without changes
|
data/doc/images/find.png
CHANGED
File without changes
|
File without changes
|
data/doc/images/macFFBgHack.png
CHANGED
File without changes
|
data/doc/images/package.png
CHANGED
File without changes
|
data/doc/images/page_green.png
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/doc/images/plugin.png
CHANGED
File without changes
|
data/doc/images/ruby.png
CHANGED
File without changes
|
data/doc/images/tag_blue.png
CHANGED
File without changes
|
data/doc/images/tag_green.png
CHANGED
File without changes
|
data/doc/images/transparent.png
CHANGED
File without changes
|
data/doc/images/wrench.png
CHANGED
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">¶</a> <a href="#
|
123
|
+
<h1 id="label-bauxite">bauxite<span><a href="#label-bauxite">¶</a> <a href="#top">↑</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">"selenium-webdriver"</span>
|
136
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">"selenium-webdriver"</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">"http://google.com"</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">"http://google.com"</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">'q'</span>)
|
145
|
-
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">send_keys</span> <span class="ruby-string">"Hello WebDriver!"</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">'q'</span>)
|
142
|
+
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">send_keys</span> <span class="ruby-string">"Hello WebDriver!"</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
|
160
|
-
write
|
161
|
-
click
|
156
|
+
<pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">"http://google.com"</span>
|
157
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"name=q"</span> <span class="ruby-string">"Hello WebDriver!"</span>
|
158
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"gbqfb"</span>
|
159
|
+
</pre>
|
162
160
|
|
163
|
-
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#
|
161
|
+
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#top">↑</a></span></h2>
|
164
162
|
|
165
163
|
<p>In a nutshell:</p>
|
166
164
|
|
167
|
-
<pre>gem install bauxite</
|
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'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">¶</a> <a href="#
|
182
|
+
<h2 id="label-Hello+World">Hello World<span><a href="#label-Hello+World">¶</a> <a href="#top">↑</a></span></h2>
|
184
183
|
|
185
184
|
<p>Paste the following text into <code>hello.bxt</code>:</p>
|
186
185
|
|
187
|
-
<pre>open
|
186
|
+
<pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">"http://www.gnu.org/fun/jokes/helloworld.html"</span>
|
187
|
+
</pre>
|
188
188
|
|
189
189
|
<p>Launch a terminal/command prompt and type:</p>
|
190
190
|
|
191
|
-
<pre>bauxite hello
|
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">¶</a> <a href="#
|
194
|
+
<h2 id="label-Command-line+Interface">Command-line Interface<span><a href="#label-Command-line+Interface">¶</a> <a href="#top">↑</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">¶</a> <a href="#
|
203
|
+
<h2 id="label-The+Bauxite+Language">The <a href="Bauxite.html">Bauxite</a> Language<span><a href="#label-The+Bauxite+Language">¶</a> <a href="#top">↑</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
|
215
|
-
write
|
216
|
-
click
|
215
|
+
<pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">"http://google.com"</span>
|
216
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"name=q"</span> <span class="ruby-string">"Hello WebDriver!"</span>
|
217
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"gbqfb"</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
|
247
|
+
<pre class="ruby"><span class="ruby-identifier">click</span> <span class="ruby-string">"gbqfb"</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
|
262
|
+
<pre class="ruby"><span class="ruby-identifier">write</span> <span class="ruby-string">"name=q"</span> <span class="ruby-string">"Hello WebDriver!"</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">¶</a> <a href="#
|
294
|
+
<h2 id="label-Firefox+add-on">Firefox add-on<span><a href="#label-Firefox+add-on">¶</a> <a href="#top">↑</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">¶</a> <a href="#
|
303
|
+
<h2 id="label-Installing+Ruby">Installing Ruby<span><a href="#label-Installing+Ruby">¶</a> <a href="#top">↑</a></span></h2>
|
300
304
|
|
301
305
|
<p>I won'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</
|
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">¶</a> <a href="#
|
325
|
+
<h2 id="label-Implementation">Implementation<span><a href="#label-Implementation">¶</a> <a href="#top">↑</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">¶</a> <a href="#
|
343
|
+
<h2 id="label-Extending+Bauxite">Extending <a href="Bauxite.html">Bauxite</a><span><a href="#label-Extending+Bauxite">¶</a> <a href="#top">↑</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">¶</a> <a href="#
|
348
|
+
<h3 id="label-Functional+extensions">Functional extensions<span><a href="#label-Functional+extensions">¶</a> <a href="#top">↑</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><!-- http://hostname/login.html -->
|
350
|
-
<form>
|
351
|
-
<input id="username" name="username" type="text" />
|
352
|
-
<input id="password" name="password" type="password" />
|
353
|
-
<input id="login" type="submit" value="Login"/>
|
354
|
+
<pre><!-- http://hostname/login.html -->
|
355
|
+
<form>
|
356
|
+
<input id="username" name="username" type="text" />
|
357
|
+
<input id="password" name="password" type="password" />
|
358
|
+
<input id="login" type="submit" value="Login"/>
|
354
359
|
</form></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
|
360
|
-
write
|
361
|
-
write
|
362
|
-
click
|
364
|
+
<pre class="ruby"><span class="ruby-identifier">open</span> <span class="ruby-string">"http://hostname/login.html"</span>
|
365
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"username"</span> <span class="ruby-string">"jdoe"</span>
|
366
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"password"</span> <span class="ruby-string">"hello world!"</span>
|
367
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"login"</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'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
|
382
|
-
write
|
383
|
-
write
|
384
|
-
click
|
386
|
+
<pre class="ruby"><span class="ruby-comment"># login.bxt
|
387
|
+
<span class="ruby-identifier">open</span> <span class="ruby-string">"http://hostname/login.html"</span>
|
388
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"username"</span> <span class="ruby-string">"jdoe"</span>
|
389
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"password"</span> <span class="ruby-string">"hello world!"</span>
|
390
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"login"</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
|
392
|
-
write
|
393
|
-
write
|
394
|
-
click
|
397
|
+
<pre class="ruby"><span class="ruby-comment"># login.bxt
|
398
|
+
<span class="ruby-identifier">open</span> <span class="ruby-string">"http://hostname/login.html"</span>
|
399
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"username"</span> <span class="ruby-string">"${username}"</span>
|
400
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"password"</span> <span class="ruby-string">"${password}"</span>
|
401
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"login"</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
|
403
|
-
write
|
404
|
-
write
|
405
|
-
click
|
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">"http://hostname/login.html"</span>
|
411
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"username"</span> <span class="ruby-string">"${username}"</span>
|
412
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"password"</span> <span class="ruby-string">"${password}"</span>
|
413
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"login"</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
|
419
|
+
<pre class="ruby"><span class="ruby-comment"># main_test.bxt
|
420
|
+
<span class="ruby-identifier">load</span> <span class="ruby-string">"login.bxt"</span> <span class="ruby-string">"username=jdoe"</span> <span class="ruby-string">"password=hello world!"</span>
|
412
421
|
|
413
|
-
|
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 "login" "load" "login.bxt" "username=${1}" "password=${2}"</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
|
436
|
+
<pre class="ruby"><span class="ruby-comment"># main_test.bxt
|
437
|
+
<span class="ruby-identifier">load</span> <span class="ruby-string">"alias.bxt"</span>
|
428
438
|
|
429
|
-
login
|
439
|
+
<span class="ruby-identifier">login</span> <span class="ruby-string">"jdoe"</span> <span class="ruby-string">"hello world!"</span>
|
430
440
|
|
431
|
-
|
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">¶</a> <a href="#
|
447
|
+
<h3 id="label-Coded+plugins">Coded plugins<span><a href="#label-Coded+plugins">¶</a> <a href="#top">↑</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><form>
|
448
|
-
<input custom-attr="username" type="text" />
|
449
|
-
<input custom-attr="password" type="password" />
|
450
|
-
<input custom-attr="login" type="submit" value="Login"/>
|
458
|
+
<pre><form>
|
459
|
+
<input custom-attr="username" type="text" />
|
460
|
+
<input custom-attr="password" type="password" />
|
461
|
+
<input custom-attr="login" type="submit" value="Login"/>
|
451
462
|
</form></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
|
458
|
-
write
|
459
|
-
click
|
467
|
+
<pre class="ruby"><span class="ruby-comment"># === my_test.bxt === #
|
468
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"attr=custom-attr:username"</span> <span class="ruby-string">"jdoe"</span>
|
469
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"attr=custom-attr:password"</span> <span class="ruby-string">"hello world!"</span>
|
470
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"attr=custom-attr:login"</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 ===
|
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">"custom-attr:#{value}"</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">"custom-attr:#{value}"</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
|
476
|
-
write
|
477
|
-
click
|
486
|
+
<pre class="ruby"><span class="ruby-comment"># === my_test.bxt === #
|
487
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"custom=username"</span> <span class="ruby-string">"jdoe"</span>
|
488
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"custom=password"</span> <span class="ruby-string">"hello world!"</span>
|
489
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"custom=login"</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">¶</a> <a href="#
|
497
|
+
<h2 id="label-Jenkins+Integration">Jenkins Integration<span><a href="#label-Jenkins+Integration">¶</a> <a href="#top">↑</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 "$WORKSPACE/test-results" \
|
507
|
+
<pre>#!/bin/bash
|
508
|
+
source ~/.rvm/scripts/rvm
|
509
|
+
bauxite -t 60 -o 240 --jenkins "$WORKSPACE/test-results" \
|
497
510
|
"$WORKSPACE/test/suite.bxt"</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 "$WORKSPACE/test-results" \
|
|
502
515
|
|
503
516
|
<p><code>suite.bxt</code> could be something like:</p>
|
504
517
|
|
505
|
-
<pre># === suite.bxt === #
|
506
|
-
test login
|
507
|
-
test register
|
508
|
-
test browse_around
|
509
|
-
test purchase_something
|
510
|
-
|
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://
|
544
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-
|
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
|
|