bauxite 0.4.2 → 0.4.3
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 +1 -0
- data/Rakefile +3 -0
- data/doc/Bauxite.html +1 -1
- data/doc/Bauxite/Action.html +2 -1
- data/doc/Bauxite/ActionModule.html +1 -1
- data/doc/Bauxite/Application.html +9 -1
- data/doc/Bauxite/Context.html +156 -27
- data/doc/Bauxite/Errors.html +1 -1
- 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/Loggers.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/Parser.html +1 -1
- data/doc/Bauxite/ParserModule.html +1 -1
- data/doc/Bauxite/Selector.html +52 -52
- data/doc/Bauxite/SelectorModule.html +12 -7
- data/doc/README_md.html +5 -1
- data/doc/created.rid +46 -46
- data/doc/index.html +5 -1
- data/doc/js/jquery.js +4 -18
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +50 -43
- data/lib/bauxite.rb +1 -1
- data/lib/bauxite/actions/open.rb +1 -0
- data/lib/bauxite/application.rb +9 -0
- data/lib/bauxite/core/context.rb +71 -3
- data/lib/bauxite/core/selector.rb +8 -3
- data/lib/bauxite/selectors/frame.rb +7 -7
- data/lib/bauxite/selectors/{default.rb → sid.rb} +2 -2
- data/lib/bauxite/selectors/smart.rb +2 -3
- data/test/default_selector.bxt.manual +7 -0
- data/test/default_selector/page.html +11 -0
- data/test/default_selector_var.bxt +1 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8a3aa61e78bd381ca5c2f417827a89170c6c69e
|
4
|
+
data.tar.gz: 3acbfd338e46b99e2968f28cbd78eb4135881ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73a8fa920d65a790a9757a9f04eda4a2dbf03479ba3a2b9f44c48fba50f4df498ad0f32e678c33d79be417305187dc69e4d9b37b41b6c93aece9b2c671e0182
|
7
|
+
data.tar.gz: 5cffd2b7beeb8e542f0f87483c4bc880c44438d7becf11a59901062a13c24ef8252f3e0e2777e26d1e7f66cada19bad2a69b605171249d2fcf541b9f82994b86
|
data/README.md
CHANGED
@@ -105,6 +105,7 @@ This section presented a brief introduction into the basic Bauxite concepts. Fo
|
|
105
105
|
- [Available Actions](http://pzavolinsky.github.io/bauxite/Bauxite/Action.html#Action+Methods)
|
106
106
|
- [Available Bauxite Selectors](http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html#Selector+Methods)
|
107
107
|
- [Selenium Standard Selectors](http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html#class-Bauxite::Selector-label-Standard+Selenium+Selectors)
|
108
|
+
- [Bauxite Variables](http://pzavolinsky.github.io/bauxite/Bauxite/Context.html#class-Bauxite::Context-label-Context+variables)
|
108
109
|
- [Creating new Actions](http://pzavolinsky.github.io/bauxite/Bauxite/Action.html)
|
109
110
|
- [Creating new Selectors](http://pzavolinsky.github.io/bauxite/Bauxite/Selector.html)
|
110
111
|
|
data/Rakefile
CHANGED
@@ -9,6 +9,7 @@ require 'rubygems/package_task'
|
|
9
9
|
spec = Gem::Specification.new do |s|
|
10
10
|
s.name = 'bauxite'
|
11
11
|
s.summary = 'Bauxite is a façade over Selenium intended for non-developers'
|
12
|
+
s.description = 'The idea behind this project was to create a tool that allows non-developers to write web tests in a human-readable language. Another major requirement is to be able to easily extend the test language to create functional abstractions over technical details.'
|
12
13
|
s.author = 'Patricio Zavolinsky'
|
13
14
|
s.email = 'pzavolinsky at yahoo dot com dot ar'
|
14
15
|
s.homepage = 'https://github.com/pzavolinsky/bauxite'
|
@@ -44,6 +45,8 @@ task :test do
|
|
44
45
|
|
45
46
|
ruby "-Ilib bin/bauxite -v -e #{File.join('test', 'extension')} #{File.join('test', 'extension.bxt.manual')}"
|
46
47
|
|
48
|
+
ruby "-Ilib bin/bauxite -v -s css #{File.join('test', 'default_selector.bxt.manual')}"
|
49
|
+
|
47
50
|
system("ruby -Ilib bin/bauxite #{File.join('test', 'test.bxt.manual')}")
|
48
51
|
fail "The 'test' action test failed to return the expected exit status: the exit status was #{$?.exitstatus}" unless $?.exitstatus == 2
|
49
52
|
end
|
data/doc/Bauxite.html
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
<footer id="validator-badges" role="contentinfo">
|
96
96
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
97
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
97
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
98
98
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
99
99
|
</footer>
|
100
100
|
|
data/doc/Bauxite/Action.html
CHANGED
@@ -824,6 +824,7 @@ href="Context.html#method-i-with_vars">Bauxite::Context#with_vars</a>).</p>
|
|
824
824
|
<pre><span class="ruby-comment"># File lib/bauxite/actions/open.rb, line 31</span>
|
825
825
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">open</span>(<span class="ruby-identifier">url</span>)
|
826
826
|
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">navigate</span>.<span class="ruby-identifier">to</span> <span class="ruby-identifier">url</span>
|
827
|
+
<span class="ruby-keyword">true</span>
|
827
828
|
<span class="ruby-keyword">end</span></pre>
|
828
829
|
</div>
|
829
830
|
|
@@ -1562,7 +1563,7 @@ href="Context.html#method-i-expand">Bauxite::Context#expand</a>).</p>
|
|
1562
1563
|
|
1563
1564
|
<footer id="validator-badges" role="contentinfo">
|
1564
1565
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1565
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
1566
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1566
1567
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1567
1568
|
</footer>
|
1568
1569
|
|
@@ -336,7 +336,7 @@ might yield different results.</p>
|
|
336
336
|
|
337
337
|
<footer id="validator-badges" role="contentinfo">
|
338
338
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
339
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
339
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
340
340
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
341
341
|
</footer>
|
342
342
|
|
@@ -176,6 +176,14 @@ enforces test isolation by resetting the test context before each test
|
|
176
176
|
<dd>
|
177
177
|
<p>Wait for user input when the test completes instead of closing the browser
|
178
178
|
window.</p>
|
179
|
+
</dd><dt>-s, --selector SELECTOR
|
180
|
+
<dd>
|
181
|
+
<p>Default selector strategy. This strategy is applied if the selector text
|
182
|
+
does not contain an <code>=</code> sign.</p>
|
183
|
+
|
184
|
+
<p>To see a complete list of the available selectors execute:</p>
|
185
|
+
|
186
|
+
<pre>bauxite -h</pre>
|
179
187
|
</dd><dt>-u, --url URL
|
180
188
|
<dd>
|
181
189
|
<p>This option is an alias of:</p>
|
@@ -245,7 +253,7 @@ indicates success).</p>
|
|
245
253
|
|
246
254
|
<footer id="validator-badges" role="contentinfo">
|
247
255
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
248
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
256
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
249
257
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
250
258
|
</footer>
|
251
259
|
|
data/doc/Bauxite/Context.html
CHANGED
@@ -54,6 +54,15 @@
|
|
54
54
|
</div>
|
55
55
|
|
56
56
|
|
57
|
+
<div class="nav-section">
|
58
|
+
<h3>Table of Contents</h3>
|
59
|
+
|
60
|
+
<ul class="link-list" role="directory">
|
61
|
+
<li><a href="#class-Bauxite::Context-label-Context+variables">Context variables</a>
|
62
|
+
<li><a href="#class-Bauxite::Context-label-Variable+scope">Variable scope</a>
|
63
|
+
</ul>
|
64
|
+
</div>
|
65
|
+
|
57
66
|
|
58
67
|
<div id="class-metadata">
|
59
68
|
<div id="sections-section" class="nav-section">
|
@@ -130,6 +139,8 @@
|
|
130
139
|
|
131
140
|
<li ><a href="#method-i-stop">#stop</a>
|
132
141
|
|
142
|
+
<li ><a href="#method-i-with_driver_timeout">#with_driver_timeout</a>
|
143
|
+
|
133
144
|
<li ><a href="#method-i-with_timeout">#with_timeout</a>
|
134
145
|
|
135
146
|
<li ><a href="#method-i-with_vars">#with_vars</a>
|
@@ -151,6 +162,72 @@
|
|
151
162
|
by clients execute tests and by actions and selectors to interact with the
|
152
163
|
test engine (i.e. Selenium WebDriver).</p>
|
153
164
|
|
165
|
+
<h3 id="class-Bauxite::Context-label-Context+variables"><a href="Context.html">Context</a> variables<span><a href="#class-Bauxite::Context-label-Context+variables">¶</a> <a href="#documentation">↑</a></span></h3>
|
166
|
+
|
167
|
+
<p><a href="Context.html">Context</a> variables are a key/value pairs scoped
|
168
|
+
to the a test context.</p>
|
169
|
+
|
170
|
+
<p>Variables can be set using different actions. For example:</p>
|
171
|
+
<ul><li>
|
172
|
+
<p><a href="Action.html#method-i-set">Bauxite::Action#set</a> sets a variable
|
173
|
+
to a literal string.</p>
|
174
|
+
</li><li>
|
175
|
+
<p><a href="Action.html#method-i-store">Bauxite::Action#store</a> sets a
|
176
|
+
variable to the value of an element in the page.</p>
|
177
|
+
</li><li>
|
178
|
+
<p><a href="Action.html#method-i-exec">Bauxite::Action#exec</a> sets a
|
179
|
+
variable to the output of an external command (i.e. stdout).</p>
|
180
|
+
</li><li>
|
181
|
+
<p><a href="Action.html#method-i-js">Bauxite::Action#js</a> sets a variable to
|
182
|
+
the result of Javascript command.</p>
|
183
|
+
</li><li>
|
184
|
+
<p><a href="Action.html#method-i-replace">Bauxite::Action#replace</a> sets a
|
185
|
+
variable to the result of doing a find-and-replace operation on a literal.</p>
|
186
|
+
</li></ul>
|
187
|
+
|
188
|
+
<p>Variables can be expanded in every <a href="Action.html">Action</a>
|
189
|
+
argument (e.g. selectors, texts, expressions, etc.). To obtain the value of
|
190
|
+
a variable through variable expansion the following syntax must be used:</p>
|
191
|
+
|
192
|
+
<pre>${var_name}</pre>
|
193
|
+
|
194
|
+
<p>For example:</p>
|
195
|
+
|
196
|
+
<pre>set field "greeting"
|
197
|
+
set name "John"
|
198
|
+
write "${field}_textbox" "Hi, my name is ${name}!"
|
199
|
+
click "${field}_button"</pre>
|
200
|
+
|
201
|
+
<h3 id="class-Bauxite::Context-label-Variable+scope">Variable scope<span><a href="#class-Bauxite::Context-label-Variable+scope">¶</a> <a href="#documentation">↑</a></span></h3>
|
202
|
+
|
203
|
+
<p>When the main test starts (via the <a
|
204
|
+
href="Context.html#method-i-start">start</a> method), the test is bound to
|
205
|
+
the global scope. The variables defined in the global scope are available
|
206
|
+
to every test <a href="Action.html">Action</a>.</p>
|
207
|
+
|
208
|
+
<p>The global scope can have nested variable scopes created by special
|
209
|
+
actions. The variables defined in a scope <code>A</code> are only available
|
210
|
+
to that scope and scopes nested within <code>A</code>.</p>
|
211
|
+
|
212
|
+
<p>Every time an <a href="Action.html">Action</a> loads a file, a new nested
|
213
|
+
scope is created. File-loading actions include:</p>
|
214
|
+
<ul><li>
|
215
|
+
<p><a href="Action.html#method-i-load">Bauxite::Action#load</a></p>
|
216
|
+
</li><li>
|
217
|
+
<p><a href="Action.html#method-i-tryload">Bauxite::Action#tryload</a></p>
|
218
|
+
</li><li>
|
219
|
+
<p><a href="Action.html#method-i-ruby">Bauxite::Action#ruby</a></p>
|
220
|
+
</li><li>
|
221
|
+
<p><a href="Action.html#method-i-test">Bauxite::Action#test</a></p>
|
222
|
+
</li></ul>
|
223
|
+
|
224
|
+
<p>A nested scope can bubble variables to its parent scope with the special
|
225
|
+
action:</p>
|
226
|
+
<ul><li>
|
227
|
+
<p><a
|
228
|
+
href="Action.html#method-i-return_action">Bauxite::Action#return_action</a></p>
|
229
|
+
</li></ul>
|
230
|
+
|
154
231
|
</section>
|
155
232
|
|
156
233
|
|
@@ -295,13 +372,14 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
295
372
|
|
296
373
|
|
297
374
|
<div class="method-source-code" id="new-source">
|
298
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
375
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 113</span>
|
299
376
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
|
300
377
|
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
301
378
|
<span class="ruby-ivar">@driver_name</span> = (<span class="ruby-identifier">options</span>[<span class="ruby-value">:driver</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:firefox</span>).<span class="ruby-identifier">to_sym</span>
|
302
379
|
<span class="ruby-ivar">@variables</span> = {
|
303
|
-
<span class="ruby-string">'__TIMEOUT__'</span>
|
304
|
-
<span class="ruby-string">'__DEBUG__'</span>
|
380
|
+
<span class="ruby-string">'__TIMEOUT__'</span> =<span class="ruby-operator">></span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</span>,
|
381
|
+
<span class="ruby-string">'__DEBUG__'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">false</span>,
|
382
|
+
<span class="ruby-string">'__SELECTOR__'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:selector</span>] <span class="ruby-operator">||</span> <span class="ruby-string">'sid'</span>
|
305
383
|
}
|
306
384
|
<span class="ruby-ivar">@aliases</span> = {}
|
307
385
|
<span class="ruby-ivar">@tests</span> = []
|
@@ -357,7 +435,7 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
357
435
|
|
358
436
|
|
359
437
|
<div class="method-source-code" id="debug-source">
|
360
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
438
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 221</span>
|
361
439
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span>
|
362
440
|
<span class="ruby-identifier">exec_action</span>(<span class="ruby-string">'debug'</span>, <span class="ruby-keyword">false</span>)
|
363
441
|
<span class="ruby-keyword">end</span></pre>
|
@@ -414,10 +492,10 @@ applies if no <code>block</code> was given).</p>
|
|
414
492
|
|
415
493
|
|
416
494
|
<div class="method-source-code" id="find-source">
|
417
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
495
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 210</span>
|
418
496
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-comment"># yields: element</span>
|
419
497
|
<span class="ruby-identifier">with_timeout</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">NoSuchElementError</span> <span class="ruby-keyword">do</span>
|
420
|
-
<span class="ruby-constant">Selector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>).<span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
498
|
+
<span class="ruby-constant">Selector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__SELECTOR__'</span>]).<span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
421
499
|
<span class="ruby-keyword">end</span>
|
422
500
|
<span class="ruby-keyword">end</span></pre>
|
423
501
|
</div>
|
@@ -464,7 +542,7 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
464
542
|
|
465
543
|
|
466
544
|
<div class="method-source-code" id="get_value-source">
|
467
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
545
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 240</span>
|
468
546
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>)
|
469
547
|
<span class="ruby-keyword">if</span> [<span class="ruby-string">'input'</span>,<span class="ruby-string">'select'</span>,<span class="ruby-string">'textarea'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">tag_name</span>.<span class="ruby-identifier">downcase</span>
|
470
548
|
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">'value'</span>)
|
@@ -507,7 +585,7 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
507
585
|
|
508
586
|
|
509
587
|
<div class="method-source-code" id="reset_driver-source">
|
510
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
588
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 165</span>
|
511
589
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span>
|
512
590
|
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span>
|
513
591
|
<span class="ruby-identifier">_load_driver</span>
|
@@ -556,7 +634,7 @@ href="Context.html#method-i-stop">stop</a>).</p>
|
|
556
634
|
|
557
635
|
|
558
636
|
<div class="method-source-code" id="start-source">
|
559
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
637
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 147</span>
|
560
638
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = [])
|
561
639
|
<span class="ruby-identifier">_load_driver</span>
|
562
640
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
@@ -615,7 +693,7 @@ href="Context.html#method-i-stop">stop</a> pattern.</p>
|
|
615
693
|
|
616
694
|
|
617
695
|
<div class="method-source-code" id="stop-source">
|
618
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
696
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 185</span>
|
619
697
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span>
|
620
698
|
<span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">wait</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:wait</span>]
|
621
699
|
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span>
|
@@ -681,7 +759,7 @@ logger type.</p>
|
|
681
759
|
|
682
760
|
|
683
761
|
<div class="method-source-code" id="load_logger-source">
|
684
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
762
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 383</span>
|
685
763
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
|
686
764
|
<span class="ruby-identifier">log_name</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-string">'null'</span>).<span class="ruby-identifier">downcase</span>
|
687
765
|
|
@@ -723,7 +801,7 @@ logger type.</p>
|
|
723
801
|
|
724
802
|
|
725
803
|
<div class="method-source-code" id="parse_action_default-source">
|
726
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
804
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 405</span>
|
727
805
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span> = <span class="ruby-string">'<unknown>'</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value">0</span>)
|
728
806
|
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">' '</span>, <span class="ruby-value">2</span>)
|
729
807
|
<span class="ruby-keyword">begin</span>
|
@@ -791,7 +869,7 @@ logger type.</p>
|
|
791
869
|
|
792
870
|
|
793
871
|
<div class="method-source-code" id="wait-source">
|
794
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
872
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 376</span>
|
795
873
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span>
|
796
874
|
<span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">"Press ENTER to continue\n"</span>)
|
797
875
|
<span class="ruby-keyword">end</span></pre>
|
@@ -833,7 +911,7 @@ with the arguments specified in <code>args</code>.</p>
|
|
833
911
|
|
834
912
|
|
835
913
|
<div class="method-source-code" id="add_alias-source">
|
836
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
914
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 399</span>
|
837
915
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_alias</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>)
|
838
916
|
<span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">name</span>] = { <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">action</span>, <span class="ruby-value">:args</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span> }
|
839
917
|
<span class="ruby-keyword">end</span></pre>
|
@@ -876,7 +954,7 @@ behavior).</p>
|
|
876
954
|
|
877
955
|
|
878
956
|
<div class="method-source-code" id="exec_action-source">
|
879
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
957
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 261</span>
|
880
958
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">log</span> = <span class="ruby-keyword">true</span>, <span class="ruby-identifier">file</span> = <span class="ruby-string">'<unknown>'</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value">0</span>)
|
881
959
|
<span class="ruby-identifier">data</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
882
960
|
<span class="ruby-identifier">_exec_parsed_action</span>(<span class="ruby-identifier">data</span>[<span class="ruby-value">:action</span>], <span class="ruby-identifier">data</span>[<span class="ruby-value">:args</span>], <span class="ruby-identifier">text</span>, <span class="ruby-identifier">log</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
@@ -916,7 +994,7 @@ behavior).</p>
|
|
916
994
|
|
917
995
|
|
918
996
|
<div class="method-source-code" id="exec_file-source">
|
919
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
997
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 272</span>
|
920
998
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>)
|
921
999
|
<span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
922
1000
|
<span class="ruby-identifier">_exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
@@ -971,7 +1049,7 @@ handler will not exit after printing the error message.</p>
|
|
971
1049
|
|
972
1050
|
|
973
1051
|
<div class="method-source-code" id="handle_errors-source">
|
974
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1052
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 297</span>
|
975
1053
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">handle_errors</span>(<span class="ruby-identifier">break_into_debug</span> = <span class="ruby-keyword">false</span>, <span class="ruby-identifier">exit_on_error</span> = <span class="ruby-keyword">true</span>)
|
976
1054
|
<span class="ruby-keyword">yield</span>
|
977
1055
|
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
@@ -1003,6 +1081,57 @@ handler will not exit after printing the error message.</p>
|
|
1003
1081
|
|
1004
1082
|
|
1005
1083
|
|
1084
|
+
</div>
|
1085
|
+
|
1086
|
+
|
1087
|
+
<div id="method-i-with_driver_timeout" class="method-detail ">
|
1088
|
+
|
1089
|
+
<div class="method-heading">
|
1090
|
+
<span class="method-name">with_driver_timeout</span><span
|
1091
|
+
class="method-args">(timeout) { || ... }</span>
|
1092
|
+
|
1093
|
+
<span class="method-click-advice">click to toggle source</span>
|
1094
|
+
|
1095
|
+
</div>
|
1096
|
+
|
1097
|
+
|
1098
|
+
<div class="method-description">
|
1099
|
+
|
1100
|
+
<p>Executes the given block using the specified driver <code>timeout</code>.</p>
|
1101
|
+
|
1102
|
+
<p>Note that the driver <code>timeout</code> is the time (in seconds) Selenium
|
1103
|
+
will wait for a specific element to appear in the page (using any of the
|
1104
|
+
available <a href="Selector.html">Selector</a> strategies).</p>
|
1105
|
+
|
1106
|
+
<p>For example</p>
|
1107
|
+
|
1108
|
+
<pre class="ruby"><span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">with_driver_timeout</span> <span class="ruby-value">0.5</span> <span class="ruby-keyword">do</span>
|
1109
|
+
<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">find</span> (<span class="ruby-string">'find_me_quickly'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
1110
|
+
<span class="ruby-comment"># do something with e</span>
|
1111
|
+
<span class="ruby-keyword">end</span>
|
1112
|
+
<span class="ruby-keyword">end</span>
|
1113
|
+
</pre>
|
1114
|
+
|
1115
|
+
|
1116
|
+
|
1117
|
+
|
1118
|
+
<div class="method-source-code" id="with_driver_timeout-source">
|
1119
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 361</span>
|
1120
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>)
|
1121
|
+
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span>
|
1122
|
+
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">timeout</span>
|
1123
|
+
<span class="ruby-keyword">yield</span>
|
1124
|
+
<span class="ruby-keyword">ensure</span>
|
1125
|
+
<span class="ruby-ivar">@driver_timeout</span> = <span class="ruby-identifier">current</span>
|
1126
|
+
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">current</span>
|
1127
|
+
<span class="ruby-keyword">end</span></pre>
|
1128
|
+
</div>
|
1129
|
+
|
1130
|
+
</div>
|
1131
|
+
|
1132
|
+
|
1133
|
+
|
1134
|
+
|
1006
1135
|
</div>
|
1007
1136
|
|
1008
1137
|
|
@@ -1036,7 +1165,7 @@ to execute the block itself.</p>
|
|
1036
1165
|
|
1037
1166
|
|
1038
1167
|
<div class="method-source-code" id="with_timeout-source">
|
1039
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1168
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 333</span>
|
1040
1169
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_timeout</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span>)
|
1041
1170
|
<span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1042
1171
|
<span class="ruby-identifier">timeout</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">stime</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__TIMEOUT__'</span>]
|
@@ -1117,7 +1246,7 @@ to execute the block itself.</p>
|
|
1117
1246
|
|
1118
1247
|
|
1119
1248
|
<div class="method-source-code" id="action_args-source">
|
1120
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1249
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 458</span>
|
1121
1250
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">action_args</span>(<span class="ruby-identifier">action</span>)
|
1122
1251
|
<span class="ruby-identifier">action</span> <span class="ruby-operator">+=</span> <span class="ruby-string">'_action'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">action</span>
|
1123
1252
|
<span class="ruby-constant">Action</span>.<span class="ruby-identifier">public_instance_method</span>(<span class="ruby-identifier">action</span>).<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">att</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> }
|
@@ -1157,7 +1286,7 @@ to execute the block itself.</p>
|
|
1157
1286
|
|
1158
1287
|
|
1159
1288
|
<div class="method-source-code" id="actions-source">
|
1160
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1289
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 448</span>
|
1161
1290
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span>
|
1162
1291
|
<span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_action$/</span>, <span class="ruby-string">''</span>) }
|
1163
1292
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1196,7 +1325,7 @@ to execute the block itself.</p>
|
|
1196
1325
|
|
1197
1326
|
|
1198
1327
|
<div class="method-source-code" id="loggers-source">
|
1199
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1328
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 487</span>
|
1200
1329
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span>
|
1201
1330
|
<span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/logger$/</span>, <span class="ruby-string">''</span>) }
|
1202
1331
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1238,7 +1367,7 @@ to execute the block itself.</p>
|
|
1238
1367
|
|
1239
1368
|
|
1240
1369
|
<div class="method-source-code" id="max_action_name_size-source">
|
1241
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1370
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 511</span>
|
1242
1371
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span>
|
1243
1372
|
<span class="ruby-identifier">actions</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">s</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> }
|
1244
1373
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1277,7 +1406,7 @@ to execute the block itself.</p>
|
|
1277
1406
|
|
1278
1407
|
|
1279
1408
|
<div class="method-source-code" id="parsers-source">
|
1280
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1409
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 497</span>
|
1281
1410
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span>
|
1282
1411
|
(<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>) <span class="ruby-operator">-</span> <span class="ruby-constant">ParserModule</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>))
|
1283
1412
|
.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_s</span> }
|
@@ -1321,7 +1450,7 @@ custom selectors are returned.</p>
|
|
1321
1450
|
|
1322
1451
|
|
1323
1452
|
<div class="method-source-code" id="selectors-source">
|
1324
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1453
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 473</span>
|
1325
1454
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">selectors</span>(<span class="ruby-identifier">include_standard_selectors</span> = <span class="ruby-keyword">true</span>)
|
1326
1455
|
<span class="ruby-identifier">ret</span> = <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_selector$/</span>, <span class="ruby-string">''</span>) }
|
1327
1456
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span>
|
@@ -1403,7 +1532,7 @@ with the corresponding variable value.</p>
|
|
1403
1532
|
|
1404
1533
|
|
1405
1534
|
<div class="method-source-code" id="expand-source">
|
1406
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1535
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 532</span>
|
1407
1536
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>)
|
1408
1537
|
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
|
1409
1538
|
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/\$\{#{kv[0]}\}/</span>, <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>)
|
@@ -1456,7 +1585,7 @@ variables is restored.</p>
|
|
1456
1585
|
|
1457
1586
|
|
1458
1587
|
<div class="method-source-code" id="with_vars-source">
|
1459
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1588
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 555</span>
|
1460
1589
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>)
|
1461
1590
|
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span>
|
1462
1591
|
<span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>)
|
@@ -1482,7 +1611,7 @@ variables is restored.</p>
|
|
1482
1611
|
|
1483
1612
|
<footer id="validator-badges" role="contentinfo">
|
1484
1613
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1485
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
1614
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1486
1615
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1487
1616
|
</footer>
|
1488
1617
|
|