bauxite 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +118 -144
- data/Rakefile +1 -1
- data/doc/Bauxite/Action.html +1 -1
- data/doc/Bauxite/ActionModule.html +1 -1
- data/doc/Bauxite/Application.html +11 -9
- data/doc/Bauxite/Context.html +24 -24
- data/doc/Bauxite/Errors/AssertionError.html +1 -1
- data/doc/Bauxite/Errors/FileNotFoundError.html +1 -1
- data/doc/Bauxite/Errors/FormatError.html +1 -1
- data/doc/Bauxite/Errors.html +1 -1
- data/doc/Bauxite/Loggers/CompositeLogger.html +1 -1
- data/doc/Bauxite/Loggers/EchoLogger.html +1 -1
- data/doc/Bauxite/Loggers/FileLogger.html +1 -1
- data/doc/Bauxite/Loggers/NullLogger.html +1 -1
- data/doc/Bauxite/Loggers/TerminalLogger.html +1 -1
- data/doc/Bauxite/Loggers/XtermLogger.html +1 -1
- data/doc/Bauxite/Loggers.html +1 -1
- data/doc/Bauxite/Parser.html +55 -3
- data/doc/Bauxite/ParserModule.html +2 -2
- data/doc/Bauxite/Selector.html +8 -6
- data/doc/Bauxite/SelectorModule.html +4 -10
- data/doc/Bauxite.html +3 -1
- data/doc/README_md.html +438 -0
- data/doc/created.rid +43 -42
- data/doc/index.html +355 -3
- data/doc/js/jquery.js +4 -18
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +31 -1
- data/lib/bauxite/core/action.rb +1 -1
- data/lib/bauxite/core/context.rb +1 -0
- data/lib/bauxite/core/parser.rb +13 -5
- data/lib/bauxite/core/selector.rb +3 -11
- data/lib/bauxite.rb +1 -1
- data/test/load.bxt +2 -0
- metadata +3 -2
data/doc/README_md.html
ADDED
@@ -0,0 +1,438 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>README - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "./";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<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
|
+
<script src="./js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="file">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
<div class="nav-section">
|
58
|
+
<h3>Table of Contents</h3>
|
59
|
+
|
60
|
+
<ul class="link-list" role="directory">
|
61
|
+
<li><a href="#label-bauxite">bauxite</a>
|
62
|
+
<li><a href="#label-Installation">Installation</a>
|
63
|
+
<li><a href="#label-Hello+World">Hello World</a>
|
64
|
+
<li><a href="#label-Command-line+Interface">Command-line Interface</a>
|
65
|
+
<li><a href="#label-The+Bauxite+Language">The Bauxite Language</a>
|
66
|
+
<li><a href="#label-Installing+Ruby">Installing Ruby</a>
|
67
|
+
<li><a href="#label-Implementation">Implementation</a>
|
68
|
+
<li><a href="#label-Extending+Bauxite">Extending Bauxite</a>
|
69
|
+
<li><a href="#label-Functional+extensions">Functional extensions</a>
|
70
|
+
<li><a href="#label-Coded+plugins">Coded plugins</a>
|
71
|
+
</ul>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
|
75
|
+
<div id="project-metadata">
|
76
|
+
<div id="fileindex-section" class="nav-section">
|
77
|
+
<h3>Pages</h3>
|
78
|
+
|
79
|
+
<ul class="link-list">
|
80
|
+
|
81
|
+
<li><a href="./README_md.html">README</a>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
</nav>
|
88
|
+
|
89
|
+
<main role="main" aria-label="Page README.md">
|
90
|
+
|
91
|
+
<h1 id="label-bauxite">bauxite<span><a href="#label-bauxite">¶</a> <a href="#documentation">↑</a></span></h1>
|
92
|
+
|
93
|
+
<p><a href="Bauxite.html">Bauxite</a> is a façade over Selenium intended for
|
94
|
+
non-developers</p>
|
95
|
+
|
96
|
+
<p>The idea behind this project was to create a tool that allows
|
97
|
+
non-developers to write web tests in a human-readable language. Another
|
98
|
+
major requirement is to be able to easily extend the test language to
|
99
|
+
create functional abstractions over technical details.</p>
|
100
|
+
|
101
|
+
<p>Take a look at the following Ruby excerpt from <a
|
102
|
+
href="http://code.google.com/p/selenium/wiki/RubyBindings">code.google.com/p/selenium/wiki/RubyBindings</a>:</p>
|
103
|
+
|
104
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">"selenium-webdriver"</span>
|
105
|
+
|
106
|
+
<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>
|
107
|
+
<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>
|
108
|
+
|
109
|
+
<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>)
|
110
|
+
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">send_keys</span> <span class="ruby-string">"Hello WebDriver!"</span>
|
111
|
+
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">submit</span>
|
112
|
+
|
113
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">title</span>
|
114
|
+
|
115
|
+
<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">quit</span>
|
116
|
+
</pre>
|
117
|
+
|
118
|
+
<p>While developers might find that code expressive enough, non-developers
|
119
|
+
might be a bit shocked.</p>
|
120
|
+
|
121
|
+
<p>The equivalent <a href="Bauxite.html">Bauxite</a> test is easier on the
|
122
|
+
eyes:</p>
|
123
|
+
|
124
|
+
<pre>open "http://google.com"
|
125
|
+
write "name=q" "Hello WebDriver!"
|
126
|
+
click "gbqfb"</pre>
|
127
|
+
|
128
|
+
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#documentation">↑</a></span></h2>
|
129
|
+
|
130
|
+
<p>In a nutshell:</p>
|
131
|
+
|
132
|
+
<pre>gem install bauxite</pre>
|
133
|
+
|
134
|
+
<p>If you don't have Ruby 2.x yet, check the <a
|
135
|
+
href="#installing-ruby">Installing Ruby</a> section below.</p>
|
136
|
+
|
137
|
+
<p>Remember you should probably install <a
|
138
|
+
href="http://www.mozilla.org">Firefox</a> (unless you want to use other
|
139
|
+
browsers or Selenium server by specifying the <code>-p</code> switch to the
|
140
|
+
<code>bauxite</code> executable).</p>
|
141
|
+
|
142
|
+
<h2 id="label-Hello+World">Hello World<span><a href="#label-Hello+World">¶</a> <a href="#documentation">↑</a></span></h2>
|
143
|
+
|
144
|
+
<p>Paste the following text into <code>hello.bxt</code>:</p>
|
145
|
+
|
146
|
+
<pre>open "http://www.gnu.org/fun/jokes/helloworld.html"</pre>
|
147
|
+
|
148
|
+
<p>Launch a terminal/command prompt and type:</p>
|
149
|
+
|
150
|
+
<pre>bauxite hello.bxt</pre>
|
151
|
+
|
152
|
+
<h2 id="label-Command-line+Interface">Command-line Interface<span><a href="#label-Command-line+Interface">¶</a> <a href="#documentation">↑</a></span></h2>
|
153
|
+
|
154
|
+
<p>The <code>bauxite</code> command-line program supports several
|
155
|
+
configuration options.</p>
|
156
|
+
|
157
|
+
<p>Refer to the <a
|
158
|
+
href="http://pzavolinsky.github.io/bauxite/Bauxite/Application.html">RDoc
|
159
|
+
documentation</a> for more details.</p>
|
160
|
+
|
161
|
+
<h2 id="label-The+Bauxite+Language">The <a href="Bauxite.html">Bauxite</a> Language<span><a href="#label-The+Bauxite+Language">¶</a> <a href="#documentation">↑</a></span></h2>
|
162
|
+
|
163
|
+
<p>The <a href="Bauxite.html">Bauxite</a> language is composed of two elements
|
164
|
+
<code>Actions</code> and <code>Selectors</code>: Actions are testing
|
165
|
+
operations such as “open this page”, “click this button”, “write this text
|
166
|
+
into that textbox”, etc. Selectors are ways of locating interesting
|
167
|
+
elements of a page such as a button, a textbox, a label, etc.</p>
|
168
|
+
|
169
|
+
<p>A typical <a href="Bauxite.html">Bauxite</a> test is a plain text file that
|
170
|
+
contains a series of Actions (one per line). Depending on the Action, a few
|
171
|
+
action arguments might need to be specified as well. For example in:</p>
|
172
|
+
|
173
|
+
<pre>open "http://google.com"
|
174
|
+
write "name=q" "Hello WebDriver!"
|
175
|
+
click "gbqfb"</pre>
|
176
|
+
|
177
|
+
<p><code>open</code>, <code>write</code> and <code>click</code> are Actions: -
|
178
|
+
<code>open</code> takes a single URL argument
|
179
|
+
(<code>"http://google.com"</code>) and opens that URL in the
|
180
|
+
browser. - <code>write</code> takes two arguments, a Selector
|
181
|
+
(<code>name=q</code>, more on this in a bit) and a text (<code>"Hello
|
182
|
+
WebDriver!"</code>), and writes the text into the element specified by
|
183
|
+
the Selector. - <code>click</code> takes a single Selector argument
|
184
|
+
(<code>gbqfb</code>) and clicks the element specified by the Selector.</p>
|
185
|
+
|
186
|
+
<p>In general, Action arguments can be surrounded by optional double quote
|
187
|
+
characters (<code>"</code>). If an argument contains a space
|
188
|
+
character, the quotes are mandatory (this is the case for the second
|
189
|
+
argument to <code>write</code> in the example above).</p>
|
190
|
+
|
191
|
+
<p>Some Actions operate on page elements (e.g. <code>write</code>,
|
192
|
+
<code>click</code>, etc.). In order to locate these elements, <a
|
193
|
+
href="Bauxite.html">Bauxite</a> uses Selectors.</p>
|
194
|
+
|
195
|
+
<p>The trivial Selector is just a text that matches the last portion of the
|
196
|
+
<code>id</code> attribute of the target element.</p>
|
197
|
+
|
198
|
+
<p>For example, in this HTML fragment:</p>
|
199
|
+
|
200
|
+
<pre><input type="submit" id="gbqfb" value="Search" /></pre>
|
201
|
+
|
202
|
+
<p>If we want to click the “Search” button we can do the following:</p>
|
203
|
+
|
204
|
+
<pre>click "gbqfb"</pre>
|
205
|
+
|
206
|
+
<p><a href="Bauxite.html">Bauxite</a> supports several other Selectors such as
|
207
|
+
<code>name=</code> in the example above. The <code>name</code> Selector
|
208
|
+
finds elements whose <code>name</code> attribute matches the text following
|
209
|
+
the <code>=</code> sign.</p>
|
210
|
+
|
211
|
+
<p>For example, in this HTML fragment:</p>
|
212
|
+
|
213
|
+
<pre><input type="text" name="q" /></pre>
|
214
|
+
|
215
|
+
<p>If we want to type the text “Hello WebDriver!” in textbox we can do the
|
216
|
+
following:</p>
|
217
|
+
|
218
|
+
<pre>write "name=q" "Hello WebDriver!"</pre>
|
219
|
+
|
220
|
+
<p>This section presented a brief introduction into the basic <a
|
221
|
+
href="Bauxite.html">Bauxite</a> concepts. For more details and a list of
|
222
|
+
every Action and Selector available, refer to the RDoc generated
|
223
|
+
documentation in:</p>
|
224
|
+
<ul><li>
|
225
|
+
<p><a
|
226
|
+
href="http://pzavolinsky.github.io/bauxite/Bauxite/Action.html#Action+Methods">Available
|
227
|
+
Actions</a></p>
|
228
|
+
</li><li>
|
229
|
+
<p><a
|
230
|
+
href="http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html#Selector+Methods">Available
|
231
|
+
Bauxite Selectors</a></p>
|
232
|
+
</li><li>
|
233
|
+
<p><a
|
234
|
+
href="http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html#class-Bauxite::Selector-label-Standard+Selenium+Selectors">Selenium
|
235
|
+
Standard Selectors</a></p>
|
236
|
+
</li><li>
|
237
|
+
<p><a href="http://pzavolinsky.github.io/bauxite/Bauxite/Action.html">Creating
|
238
|
+
new Actions</a></p>
|
239
|
+
</li><li>
|
240
|
+
<p><a
|
241
|
+
href="http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html">Creating
|
242
|
+
new Selectors</a></p>
|
243
|
+
</li></ul>
|
244
|
+
|
245
|
+
<h2 id="label-Installing+Ruby">Installing Ruby<span><a href="#label-Installing+Ruby">¶</a> <a href="#documentation">↑</a></span></h2>
|
246
|
+
|
247
|
+
<p>I won't cover all the details of installing Ruby on your system (Google
|
248
|
+
knows best), but the following should probably work.</p>
|
249
|
+
|
250
|
+
<p>In GNU/Linux, you can install <a href="http://rvm.io/">RVM</a>, then Ruby:</p>
|
251
|
+
|
252
|
+
<pre>curl -sSL https://get.rvm.io | bash -s stable
|
253
|
+
source ~/.rvm/scripts/rvm
|
254
|
+
rvm install ruby-2.1.0</pre>
|
255
|
+
|
256
|
+
<p>In Windows, you can install Ruby 2.x with <a
|
257
|
+
href="http://rubyinstaller.org/downloads/">RubyInstaller</a>. After
|
258
|
+
everything is installed, launch the <code>Start Command Prompt with
|
259
|
+
Ruby</code> option in your start menu.</p>
|
260
|
+
|
261
|
+
<p>Regadless of your OS, you should be able to install <a
|
262
|
+
href="Bauxite.html">Bauxite</a> with:</p>
|
263
|
+
|
264
|
+
<pre>gem install bauxite</pre>
|
265
|
+
|
266
|
+
<h2 id="label-Implementation">Implementation<span><a href="#label-Implementation">¶</a> <a href="#documentation">↑</a></span></h2>
|
267
|
+
|
268
|
+
<p><a href="Bauxite.html">Bauxite</a> is both a command-line program and a
|
269
|
+
library. You can use the program to run <a href="Bauxite.html">Bauxite</a>
|
270
|
+
tests directly from a terminal, or you can embed the library in your own
|
271
|
+
application.</p>
|
272
|
+
|
273
|
+
<p>The command-line program is called <code>bauxite</code> and has several
|
274
|
+
command-line options, refer to the <a
|
275
|
+
href="http://pzavolinsky.github.io/bauxite/Bauxite/Application.html">RDoc
|
276
|
+
documentation</a> for more details.</p>
|
277
|
+
|
278
|
+
<p>If you are looking to embed <a href="Bauxite.html">Bauxite</a> in your
|
279
|
+
application take a look a the code in
|
280
|
+
<code>lib/bauxite/application.rb</code>, that should give you a full
|
281
|
+
example of how to create a <a href="Bauxite.html">Bauxite</a> Context and
|
282
|
+
execute some actions.</p>
|
283
|
+
|
284
|
+
<h2 id="label-Extending+Bauxite">Extending <a href="Bauxite.html">Bauxite</a><span><a href="#label-Extending+Bauxite">¶</a> <a href="#documentation">↑</a></span></h2>
|
285
|
+
|
286
|
+
<p><a href="Bauxite.html">Bauxite</a> supports two types of extensions:
|
287
|
+
functional extensions and coded plugins.</p>
|
288
|
+
|
289
|
+
<h3 id="label-Functional+extensions">Functional extensions<span><a href="#label-Functional+extensions">¶</a> <a href="#documentation">↑</a></span></h3>
|
290
|
+
|
291
|
+
<p>Functional extensions are composite constructs created using existing <a
|
292
|
+
href="Bauxite.html">Bauxite</a> actions to convey functional meaning. For
|
293
|
+
example, imagine a login form:</p>
|
294
|
+
|
295
|
+
<pre><!-- http://hostname/login.html -->
|
296
|
+
<form>
|
297
|
+
<input id="username" name="username" type="text" />
|
298
|
+
<input id="password" name="password" type="password" />
|
299
|
+
<input id="login" type="submit" value="Login"/>
|
300
|
+
</form></pre>
|
301
|
+
|
302
|
+
<p>The <a href="Bauxite.html">Bauxite</a> code to login into this site would
|
303
|
+
be:</p>
|
304
|
+
|
305
|
+
<pre>open "http://hostname/login.html"
|
306
|
+
write "username" "jdoe"
|
307
|
+
write "password" "hello world!"
|
308
|
+
click "login"</pre>
|
309
|
+
|
310
|
+
<p>If we were creating a suite of automated web tests for our
|
311
|
+
<em>hostname</em> site, we'll probably need to login into the site
|
312
|
+
several times. This would mean copy/pasting the four lines above into every
|
313
|
+
test in our suite.</p>
|
314
|
+
|
315
|
+
<p>Of course we can do better. We can split <a href="Bauxite.html">Bauxite</a>
|
316
|
+
tests into many files and include one test into another with the
|
317
|
+
<code>load</code> action.</p>
|
318
|
+
|
319
|
+
<pre># my_test.bxt (by the way, this is a comment)
|
320
|
+
load other_test_fragment.bxt
|
321
|
+
...</pre>
|
322
|
+
|
323
|
+
<p>Back to our login example, first we can package the login part of our tests
|
324
|
+
into a separate <a href="Bauxite.html">Bauxite</a> file:</p>
|
325
|
+
|
326
|
+
<pre># login.bxt
|
327
|
+
open "http://hostname/login.html"
|
328
|
+
write "username" "jdoe"
|
329
|
+
write "password" "hello world!"
|
330
|
+
click "login"</pre>
|
331
|
+
|
332
|
+
<p>Of course we would like to be able to login with different
|
333
|
+
username/password combinations, so we can replace the literals in
|
334
|
+
<code>login.bxt</code> with variables:</p>
|
335
|
+
|
336
|
+
<pre># login.bxt
|
337
|
+
open "http://hostname/login.html"
|
338
|
+
write "username" "${username}"
|
339
|
+
write "password" "${password}"
|
340
|
+
click "login"</pre>
|
341
|
+
|
342
|
+
<p>Now, we would like to assert that both <code>username</code> and
|
343
|
+
<code>password</code> variables are set before calling our test (just in
|
344
|
+
case someone forgets). We can do this with <code>params</code></p>
|
345
|
+
|
346
|
+
<pre># login.bxt
|
347
|
+
params username password
|
348
|
+
open "http://hostname/login.html"
|
349
|
+
write "username" "${username}"
|
350
|
+
write "password" "${password}"
|
351
|
+
click "login"</pre>
|
352
|
+
|
353
|
+
<p>In our main test we can load <code>login.bxt</code> and specify the
|
354
|
+
variables required using this code:</p>
|
355
|
+
|
356
|
+
<pre># main_test.bxt
|
357
|
+
load "login.bxt" "username=jdoe" "password=hello world!"
|
358
|
+
|
359
|
+
# additional actions go here</pre>
|
360
|
+
|
361
|
+
<p>We could improve this even further by creating an <code>alias</code> to
|
362
|
+
simplify the login process. To do this, lets create an new file called
|
363
|
+
<code>alias.bxt</code>:</p>
|
364
|
+
|
365
|
+
<pre># alias.bxt
|
366
|
+
alias "login" "load" "login.bxt" "username=${1}" "password=${2}"</pre>
|
367
|
+
|
368
|
+
<p>Note that the <code>alias</code> action supports positional arguments.</p>
|
369
|
+
|
370
|
+
<p>Now we can change our main test to use our alias:</p>
|
371
|
+
|
372
|
+
<pre># main_test.bxt
|
373
|
+
load "alias.bxt"
|
374
|
+
|
375
|
+
login "jdoe" "hello world!"
|
376
|
+
|
377
|
+
# additional actions go here</pre>
|
378
|
+
|
379
|
+
<p>That was a bit of work but the resulting test is purely functional (minus
|
380
|
+
the load alias part, of course).</p>
|
381
|
+
|
382
|
+
<h3 id="label-Coded+plugins">Coded plugins<span><a href="#label-Coded+plugins">¶</a> <a href="#documentation">↑</a></span></h3>
|
383
|
+
|
384
|
+
<p>Coded plugins are Ruby files that extend the <a
|
385
|
+
href="Bauxite.html">Bauxite</a> language by providing additional language
|
386
|
+
elements. Coded plugins can be used to create <a
|
387
|
+
href="Bauxite.html">Bauxite</a> actions, selectors and loggers.</p>
|
388
|
+
|
389
|
+
<p>For example lets assume that throughout a web application input elements
|
390
|
+
were identified using a custom HTML attribute instead of <code>id</code>.
|
391
|
+
For example:</p>
|
392
|
+
|
393
|
+
<pre><form>
|
394
|
+
<input custom-attr="username" type="text" />
|
395
|
+
<input custom-attr="password" type="password" />
|
396
|
+
<input custom-attr="login" type="submit" value="Login"/>
|
397
|
+
</form></pre>
|
398
|
+
|
399
|
+
<p>Using standard <a href="Bauxite.html">Bauxite</a> language we could select
|
400
|
+
these elements using:</p>
|
401
|
+
|
402
|
+
<pre># === my_test.bxt === #
|
403
|
+
write "attr=custom-attr:username" "jdoe"
|
404
|
+
write "attr=custom-attr:password" "hello world!"
|
405
|
+
click "attr=custom-attr:login"</pre>
|
406
|
+
|
407
|
+
<p>But we can improve the overall readability of our test by using a coded
|
408
|
+
plugin:</p>
|
409
|
+
|
410
|
+
<pre class="ruby"><span class="ruby-comment"># === plugins/custom_selector.rb === #</span>
|
411
|
+
<span class="ruby-keyword">class</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Selector</span>
|
412
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">custom</span>(<span class="ruby-identifier">value</span>)
|
413
|
+
<span class="ruby-identifier">attr</span> <span class="ruby-node">"custom-attr:#{value}"</span>
|
414
|
+
<span class="ruby-keyword">end</span>
|
415
|
+
<span class="ruby-keyword">end</span>
|
416
|
+
</pre>
|
417
|
+
|
418
|
+
<p>Now we can change our test to look like this:</p>
|
419
|
+
|
420
|
+
<pre># === my_test.bxt === #
|
421
|
+
write "custom=username" "jdoe"
|
422
|
+
write "custom=password" "hello world!"
|
423
|
+
click "custom=login"</pre>
|
424
|
+
|
425
|
+
<p>Finally, to execute <a href="Bauxite.html">Bauxite</a> loading our plugin
|
426
|
+
we can type:</p>
|
427
|
+
|
428
|
+
<pre>bauxite -e plugins my_test.bxt</pre>
|
429
|
+
</main>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
<footer id="validator-badges" role="contentinfo">
|
434
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
435
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
436
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
437
|
+
</footer>
|
438
|
+
|
data/doc/created.rid
CHANGED
@@ -1,42 +1,43 @@
|
|
1
|
-
Mon, 27 Jan 2014
|
2
|
-
|
3
|
-
lib/bauxite/actions/
|
4
|
-
lib/bauxite/actions/
|
5
|
-
lib/bauxite/actions/
|
6
|
-
lib/bauxite/actions/
|
7
|
-
lib/bauxite/actions/
|
8
|
-
lib/bauxite/actions/
|
9
|
-
lib/bauxite/actions/
|
10
|
-
lib/bauxite/actions/
|
11
|
-
lib/bauxite/actions/
|
12
|
-
lib/bauxite/actions/
|
13
|
-
lib/bauxite/actions/
|
14
|
-
lib/bauxite/actions/
|
15
|
-
lib/bauxite/actions/
|
16
|
-
lib/bauxite/actions/
|
17
|
-
lib/bauxite/actions/
|
18
|
-
lib/bauxite/actions/
|
19
|
-
lib/bauxite/actions/
|
20
|
-
lib/bauxite/actions/
|
21
|
-
lib/bauxite/actions/
|
22
|
-
lib/bauxite/actions/
|
23
|
-
lib/bauxite/actions/
|
24
|
-
lib/bauxite/actions/
|
25
|
-
lib/bauxite/
|
26
|
-
lib/bauxite/
|
27
|
-
lib/bauxite/
|
28
|
-
lib/bauxite/
|
29
|
-
lib/bauxite/
|
30
|
-
lib/bauxite/core/
|
31
|
-
lib/bauxite/
|
32
|
-
lib/bauxite/
|
33
|
-
lib/bauxite/
|
34
|
-
lib/bauxite/
|
35
|
-
lib/bauxite/
|
36
|
-
lib/bauxite/selectors/attr.rb Mon, 27 Jan 2014
|
37
|
-
lib/bauxite/selectors/default.rb Mon, 27 Jan 2014
|
38
|
-
lib/bauxite/
|
39
|
-
lib/bauxite/loggers/
|
40
|
-
lib/bauxite/loggers/
|
41
|
-
lib/bauxite/loggers/
|
42
|
-
lib/bauxite/loggers/
|
1
|
+
Mon, 27 Jan 2014 21:01:52 -0300
|
2
|
+
README.md Mon, 27 Jan 2014 20:58:49 -0300
|
3
|
+
lib/bauxite/actions/break.rb Mon, 27 Jan 2014 20:58:50 -0300
|
4
|
+
lib/bauxite/actions/assert.rb Mon, 27 Jan 2014 20:58:50 -0300
|
5
|
+
lib/bauxite/actions/wait.rb Mon, 27 Jan 2014 20:58:50 -0300
|
6
|
+
lib/bauxite/actions/assertv.rb Mon, 27 Jan 2014 20:58:50 -0300
|
7
|
+
lib/bauxite/actions/open.rb Mon, 27 Jan 2014 20:58:50 -0300
|
8
|
+
lib/bauxite/actions/return.rb Mon, 27 Jan 2014 20:58:50 -0300
|
9
|
+
lib/bauxite/actions/ruby.rb Mon, 27 Jan 2014 20:58:50 -0300
|
10
|
+
lib/bauxite/actions/echo.rb Mon, 27 Jan 2014 20:58:50 -0300
|
11
|
+
lib/bauxite/actions/js.rb Mon, 27 Jan 2014 20:58:50 -0300
|
12
|
+
lib/bauxite/actions/replace.rb Mon, 27 Jan 2014 20:58:50 -0300
|
13
|
+
lib/bauxite/actions/write.rb Mon, 27 Jan 2014 20:58:50 -0300
|
14
|
+
lib/bauxite/actions/params.rb Mon, 27 Jan 2014 20:58:50 -0300
|
15
|
+
lib/bauxite/actions/set.rb Mon, 27 Jan 2014 20:58:50 -0300
|
16
|
+
lib/bauxite/actions/click.rb Mon, 27 Jan 2014 20:58:50 -0300
|
17
|
+
lib/bauxite/actions/reset.rb Mon, 27 Jan 2014 20:58:50 -0300
|
18
|
+
lib/bauxite/actions/debug.rb Mon, 27 Jan 2014 20:58:50 -0300
|
19
|
+
lib/bauxite/actions/source.rb Mon, 27 Jan 2014 20:58:50 -0300
|
20
|
+
lib/bauxite/actions/exec.rb Mon, 27 Jan 2014 20:58:50 -0300
|
21
|
+
lib/bauxite/actions/store.rb Mon, 27 Jan 2014 20:58:50 -0300
|
22
|
+
lib/bauxite/actions/tryload.rb Mon, 27 Jan 2014 20:58:50 -0300
|
23
|
+
lib/bauxite/actions/load.rb Mon, 27 Jan 2014 20:58:50 -0300
|
24
|
+
lib/bauxite/actions/test.rb Mon, 27 Jan 2014 20:58:50 -0300
|
25
|
+
lib/bauxite/actions/alias.rb Mon, 27 Jan 2014 20:58:50 -0300
|
26
|
+
lib/bauxite/parsers/html.rb Mon, 27 Jan 2014 20:58:50 -0300
|
27
|
+
lib/bauxite/parsers/csv.rb Mon, 27 Jan 2014 20:58:50 -0300
|
28
|
+
lib/bauxite/parsers/default.rb Mon, 27 Jan 2014 20:58:50 -0300
|
29
|
+
lib/bauxite/application.rb Mon, 27 Jan 2014 20:58:50 -0300
|
30
|
+
lib/bauxite/core/errors.rb Mon, 27 Jan 2014 20:58:50 -0300
|
31
|
+
lib/bauxite/core/selector.rb Mon, 27 Jan 2014 20:58:50 -0300
|
32
|
+
lib/bauxite/core/context.rb Mon, 27 Jan 2014 20:58:50 -0300
|
33
|
+
lib/bauxite/core/logger.rb Mon, 27 Jan 2014 20:58:50 -0300
|
34
|
+
lib/bauxite/core/action.rb Mon, 27 Jan 2014 20:58:50 -0300
|
35
|
+
lib/bauxite/core/parser.rb Mon, 27 Jan 2014 20:58:50 -0300
|
36
|
+
lib/bauxite/selectors/attr.rb Mon, 27 Jan 2014 20:58:50 -0300
|
37
|
+
lib/bauxite/selectors/default.rb Mon, 27 Jan 2014 20:58:50 -0300
|
38
|
+
lib/bauxite/selectors/frame.rb Mon, 27 Jan 2014 20:58:50 -0300
|
39
|
+
lib/bauxite/loggers/terminal.rb Mon, 27 Jan 2014 20:58:50 -0300
|
40
|
+
lib/bauxite/loggers/file.rb Mon, 27 Jan 2014 20:58:50 -0300
|
41
|
+
lib/bauxite/loggers/composite.rb Mon, 27 Jan 2014 20:58:50 -0300
|
42
|
+
lib/bauxite/loggers/echo.rb Mon, 27 Jan 2014 20:58:50 -0300
|
43
|
+
lib/bauxite/loggers/xterm.rb Mon, 27 Jan 2014 20:58:50 -0300
|