bauxite 0.4.5 → 0.4.6
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 +3 -3
- data/Rakefile +1 -1
- data/doc/Bauxite/Context.html +60 -26
- data/doc/Bauxite/Selector.html +9 -2
- data/doc/README_md.html +7 -6
- data/doc/created.rid +4 -4
- data/doc/index.html +7 -6
- data/doc/table_of_contents.html +1 -0
- data/lib/bauxite/core/context.rb +32 -5
- data/lib/bauxite/selectors/smart.rb +9 -2
- data/lib/bauxite.rb +1 -1
- data/test/smart_selector/page.html +5 -0
- data/test/smart_selector.bxt +6 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d2de14a5ada49ae2a057af9b513f46c2a2916f2
|
4
|
+
data.tar.gz: 0743f340ef2e0d1030af41db4aebdc731bcbd8c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdeeab574ae065d77a2804aff4a0821c535ecbd07b3da0db488e5c2681f26e34ea6d31620a9567967106f710186cebefde3580ad68bc4b4aad1b5efcbe5fb3b2
|
7
|
+
data.tar.gz: f4020a1a39e42018318d125154ab8909d1ad012bdabbb6b8af293023c3fd0e28411595de2736a3c56d603b4fd6161cb6c917831654c22a02cd1c79b4bff23a5f
|
data/README.md
CHANGED
@@ -96,7 +96,7 @@ For example, in this HTML fragment:
|
|
96
96
|
|
97
97
|
<input type="text" name="q" />
|
98
98
|
|
99
|
-
If we want to type the text "Hello WebDriver!" in textbox we can do the following:
|
99
|
+
If we want to type the text "Hello WebDriver!" in the textbox we can do the following:
|
100
100
|
|
101
101
|
write "name=q" "Hello WebDriver!"
|
102
102
|
|
@@ -273,11 +273,11 @@ Assuming you have Selenium Server running on localhost and your workspace (e.g.
|
|
273
273
|
# === suite.bxt === #
|
274
274
|
test login.bxt
|
275
275
|
test register.bxt
|
276
|
-
test
|
276
|
+
test browse_around.bxt
|
277
277
|
test purchase_something.bxt
|
278
278
|
# more tests here...
|
279
279
|
|
280
|
-
Note the `--csv-summary` option in the configuration above. That option generates a single-
|
280
|
+
Note the `--csv-summary` option in the configuration above. That option generates a single-line CSV file ideal to feed into the `Plot` Jenkins plugin. I won't go into the details of configuring the Plot plugin, but instead here is a fragment of a possible Jenkins `config.xml` plotting the Bauxite test results:
|
281
281
|
|
282
282
|
<publishers>
|
283
283
|
...
|
data/Rakefile
CHANGED
@@ -9,7 +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
|
+
s.description = 'Bauxite is a façade over Selenium intended for non-developers. 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.'
|
13
13
|
s.author = 'Patricio Zavolinsky'
|
14
14
|
s.email = 'pzavolinsky at yahoo dot com dot ar'
|
15
15
|
s.homepage = 'https://github.com/pzavolinsky/bauxite'
|
data/doc/Bauxite/Context.html
CHANGED
@@ -60,6 +60,7 @@
|
|
60
60
|
<ul class="link-list" role="directory">
|
61
61
|
<li><a href="#class-Bauxite::Context-label-Context+variables">Context variables</a>
|
62
62
|
<li><a href="#class-Bauxite::Context-label-Variable+scope">Variable scope</a>
|
63
|
+
<li><a href="#class-Bauxite::Context-label-Built-in+variable">Built-in variable</a>
|
63
64
|
</ul>
|
64
65
|
</div>
|
65
66
|
|
@@ -232,6 +233,39 @@ action:</p>
|
|
232
233
|
href="Action.html#method-i-return_action">Bauxite::Action#return_action</a></p>
|
233
234
|
</li></ul>
|
234
235
|
|
236
|
+
<h3 id="class-Bauxite::Context-label-Built-in+variable">Built-in variable<span><a href="#class-Bauxite::Context-label-Built-in+variable">¶</a> <a href="#documentation">↑</a></span></h3>
|
237
|
+
|
238
|
+
<p><a href="../Bauxite.html">Bauxite</a> has a series of built-in variables
|
239
|
+
that provide information of the current test context and allow dynamic
|
240
|
+
constomizations of the test behavior.</p>
|
241
|
+
|
242
|
+
<p>The built-in variables are:</p>
|
243
|
+
<dl class="rdoc-list label-list"><dt><code>__FILE__</code>
|
244
|
+
<dd>
|
245
|
+
<p>The file where the current action is defined.</p>
|
246
|
+
</dd><dt><code>__DIR__</code>
|
247
|
+
<dd>
|
248
|
+
<p>The directory where <code>__FILE__</code> is.</p>
|
249
|
+
</dd><dt><code>__SELECTOR__</code>
|
250
|
+
<dd>
|
251
|
+
<p>The default selector used when the selector specified does not contain an
|
252
|
+
<code>=</code> character.</p>
|
253
|
+
</dd><dt><code>__DEBUG__</code>
|
254
|
+
<dd>
|
255
|
+
<p>Set to true if the current action is being executed by the debug console.</p>
|
256
|
+
</dd><dt><code>__RETURN__</code>
|
257
|
+
<dd>
|
258
|
+
<p>Used internally by <a
|
259
|
+
href="Action.html#method-i-return_action">Bauxite::Action#return_action</a>
|
260
|
+
to indicate which variables should be returned to the parent scope.</p>
|
261
|
+
</dd></dl>
|
262
|
+
|
263
|
+
<p>In general, variables surrounded by double underscores and variables whose
|
264
|
+
names are only numbers are reserved for <a
|
265
|
+
href="../Bauxite.html">Bauxite</a> and should not be used as part of a
|
266
|
+
functional test. The obvious exception is when trying to change the test
|
267
|
+
behavior by changing the built-in variables.</p>
|
268
|
+
|
235
269
|
</section>
|
236
270
|
|
237
271
|
|
@@ -376,7 +410,7 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
376
410
|
|
377
411
|
|
378
412
|
<div class="method-source-code" id="new-source">
|
379
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
413
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 140</span>
|
380
414
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
|
381
415
|
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
382
416
|
<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>
|
@@ -444,7 +478,7 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
444
478
|
|
445
479
|
|
446
480
|
<div class="method-source-code" id="debug-source">
|
447
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
481
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 253</span>
|
448
482
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span>
|
449
483
|
<span class="ruby-identifier">exec_action</span>(<span class="ruby-string">'debug'</span>, <span class="ruby-keyword">false</span>)
|
450
484
|
<span class="ruby-keyword">end</span></pre>
|
@@ -501,7 +535,7 @@ applies if no <code>block</code> was given).</p>
|
|
501
535
|
|
502
536
|
|
503
537
|
<div class="method-source-code" id="find-source">
|
504
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
538
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 242</span>
|
505
539
|
<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>
|
506
540
|
<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>
|
507
541
|
<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>)
|
@@ -551,7 +585,7 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
551
585
|
|
552
586
|
|
553
587
|
<div class="method-source-code" id="get_value-source">
|
554
|
-
<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 272</span>
|
555
589
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>)
|
556
590
|
<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>
|
557
591
|
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">'value'</span>)
|
@@ -594,7 +628,7 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
594
628
|
|
595
629
|
|
596
630
|
<div class="method-source-code" id="reset_driver-source">
|
597
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
631
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 197</span>
|
598
632
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span>
|
599
633
|
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span>
|
600
634
|
<span class="ruby-identifier">_load_driver</span>
|
@@ -643,7 +677,7 @@ href="Context.html#method-i-stop">stop</a>).</p>
|
|
643
677
|
|
644
678
|
|
645
679
|
<div class="method-source-code" id="start-source">
|
646
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
680
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 179</span>
|
647
681
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = [])
|
648
682
|
<span class="ruby-identifier">_load_driver</span>
|
649
683
|
<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>
|
@@ -702,7 +736,7 @@ href="Context.html#method-i-stop">stop</a> pattern.</p>
|
|
702
736
|
|
703
737
|
|
704
738
|
<div class="method-source-code" id="stop-source">
|
705
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
739
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 217</span>
|
706
740
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span>
|
707
741
|
<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>]
|
708
742
|
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span>
|
@@ -768,7 +802,7 @@ logger type.</p>
|
|
768
802
|
|
769
803
|
|
770
804
|
<div class="method-source-code" id="load_logger-source">
|
771
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
805
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 415</span>
|
772
806
|
<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>)
|
773
807
|
<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>
|
774
808
|
|
@@ -810,7 +844,7 @@ logger type.</p>
|
|
810
844
|
|
811
845
|
|
812
846
|
<div class="method-source-code" id="parse_action_default-source">
|
813
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
847
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 437</span>
|
814
848
|
<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>)
|
815
849
|
<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>)
|
816
850
|
<span class="ruby-keyword">begin</span>
|
@@ -878,7 +912,7 @@ logger type.</p>
|
|
878
912
|
|
879
913
|
|
880
914
|
<div class="method-source-code" id="wait-source">
|
881
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
915
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 408</span>
|
882
916
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span>
|
883
917
|
<span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">"Press ENTER to continue\n"</span>)
|
884
918
|
<span class="ruby-keyword">end</span></pre>
|
@@ -920,7 +954,7 @@ with the arguments specified in <code>args</code>.</p>
|
|
920
954
|
|
921
955
|
|
922
956
|
<div class="method-source-code" id="add_alias-source">
|
923
|
-
<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 431</span>
|
924
958
|
<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>)
|
925
959
|
<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> }
|
926
960
|
<span class="ruby-keyword">end</span></pre>
|
@@ -963,7 +997,7 @@ behavior).</p>
|
|
963
997
|
|
964
998
|
|
965
999
|
<div class="method-source-code" id="exec_action-source">
|
966
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1000
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 293</span>
|
967
1001
|
<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>)
|
968
1002
|
<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>)
|
969
1003
|
<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>)
|
@@ -1011,7 +1045,7 @@ ret.call if ret.respond_to? :call</pre>
|
|
1011
1045
|
|
1012
1046
|
|
1013
1047
|
<div class="method-source-code" id="exec_action_object-source">
|
1014
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1048
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 515</span>
|
1015
1049
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1016
1050
|
<span class="ruby-comment"># Inject built-in variables</span>
|
1017
1051
|
<span class="ruby-identifier">file</span> = <span class="ruby-identifier">action</span>.<span class="ruby-identifier">file</span>
|
@@ -1055,7 +1089,7 @@ ret.call if ret.respond_to? :call</pre>
|
|
1055
1089
|
|
1056
1090
|
|
1057
1091
|
<div class="method-source-code" id="exec_file-source">
|
1058
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1092
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 304</span>
|
1059
1093
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>)
|
1060
1094
|
<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>
|
1061
1095
|
<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>)
|
@@ -1097,7 +1131,7 @@ preferred.</p>
|
|
1097
1131
|
|
1098
1132
|
|
1099
1133
|
<div class="method-source-code" id="get_action-source">
|
1100
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1134
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 477</span>
|
1101
1135
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_action</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>)
|
1102
1136
|
<span class="ruby-keyword">while</span> (<span class="ruby-identifier">alias_action</span> = <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">action</span>])
|
1103
1137
|
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>]
|
@@ -1171,7 +1205,7 @@ handler will not exit after printing the error message.</p>
|
|
1171
1205
|
|
1172
1206
|
|
1173
1207
|
<div class="method-source-code" id="handle_errors-source">
|
1174
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1208
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 329</span>
|
1175
1209
|
<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>)
|
1176
1210
|
<span class="ruby-keyword">yield</span>
|
1177
1211
|
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
@@ -1238,7 +1272,7 @@ available <a href="Selector.html">Selector</a> strategies).</p>
|
|
1238
1272
|
|
1239
1273
|
|
1240
1274
|
<div class="method-source-code" id="with_driver_timeout-source">
|
1241
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1275
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 393</span>
|
1242
1276
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>)
|
1243
1277
|
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span>
|
1244
1278
|
<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>
|
@@ -1287,7 +1321,7 @@ to execute the block itself.</p>
|
|
1287
1321
|
|
1288
1322
|
|
1289
1323
|
<div class="method-source-code" id="with_timeout-source">
|
1290
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1324
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 365</span>
|
1291
1325
|
<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>)
|
1292
1326
|
<span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1293
1327
|
<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>]
|
@@ -1368,7 +1402,7 @@ to execute the block itself.</p>
|
|
1368
1402
|
|
1369
1403
|
|
1370
1404
|
<div class="method-source-code" id="action_args-source">
|
1371
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1405
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 545</span>
|
1372
1406
|
<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>)
|
1373
1407
|
<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>
|
1374
1408
|
<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> }
|
@@ -1408,7 +1442,7 @@ to execute the block itself.</p>
|
|
1408
1442
|
|
1409
1443
|
|
1410
1444
|
<div class="method-source-code" id="actions-source">
|
1411
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1445
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 535</span>
|
1412
1446
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span>
|
1413
1447
|
<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>) }
|
1414
1448
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1447,7 +1481,7 @@ to execute the block itself.</p>
|
|
1447
1481
|
|
1448
1482
|
|
1449
1483
|
<div class="method-source-code" id="loggers-source">
|
1450
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1484
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 574</span>
|
1451
1485
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span>
|
1452
1486
|
<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>) }
|
1453
1487
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1489,7 +1523,7 @@ to execute the block itself.</p>
|
|
1489
1523
|
|
1490
1524
|
|
1491
1525
|
<div class="method-source-code" id="max_action_name_size-source">
|
1492
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1526
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 598</span>
|
1493
1527
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span>
|
1494
1528
|
<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> }
|
1495
1529
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1528,7 +1562,7 @@ to execute the block itself.</p>
|
|
1528
1562
|
|
1529
1563
|
|
1530
1564
|
<div class="method-source-code" id="parsers-source">
|
1531
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1565
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 584</span>
|
1532
1566
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span>
|
1533
1567
|
(<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>))
|
1534
1568
|
.<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> }
|
@@ -1572,7 +1606,7 @@ custom selectors are returned.</p>
|
|
1572
1606
|
|
1573
1607
|
|
1574
1608
|
<div class="method-source-code" id="selectors-source">
|
1575
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1609
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 560</span>
|
1576
1610
|
<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>)
|
1577
1611
|
<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>) }
|
1578
1612
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span>
|
@@ -1654,7 +1688,7 @@ with the corresponding variable value.</p>
|
|
1654
1688
|
|
1655
1689
|
|
1656
1690
|
<div class="method-source-code" id="expand-source">
|
1657
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1691
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 619</span>
|
1658
1692
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>)
|
1659
1693
|
<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>
|
1660
1694
|
<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>)
|
@@ -1707,7 +1741,7 @@ variables is restored.</p>
|
|
1707
1741
|
|
1708
1742
|
|
1709
1743
|
<div class="method-source-code" id="with_vars-source">
|
1710
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1744
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 642</span>
|
1711
1745
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>)
|
1712
1746
|
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span>
|
1713
1747
|
<span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>)
|
data/doc/Bauxite/Selector.html
CHANGED
@@ -443,7 +443,7 @@ specified)</p>
|
|
443
443
|
</li><li>
|
444
444
|
<p>by text content (unless the element is a label)</p>
|
445
445
|
</li><li>
|
446
|
-
<p>by radio/checkbox
|
446
|
+
<p>by radio/checkbox/button/submit value</p>
|
447
447
|
</li><li>
|
448
448
|
<p>by referenced element (find a label by its text, then find the element
|
449
449
|
pointed by the label's <code>for</code> attribute)</p>
|
@@ -472,7 +472,14 @@ child control element, including input, select, textarea and button).</p>
|
|
472
472
|
<span class="ruby-identifier">target</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">_smart_try_find</span> { <span class="ruby-identifier">attr</span>(<span class="ruby-string">"id*:"</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>) }
|
473
473
|
<span class="ruby-identifier">target</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">_smart_try_find</span> { <span class="ruby-identifier">attr</span>(<span class="ruby-string">"placeholder:"</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>) }
|
474
474
|
<span class="ruby-identifier">quoted_arg</span> = <span class="ruby-string">"'"</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">"'"</span>, <span class="ruby-string">"\\'"</span>)<span class="ruby-operator">+</span><span class="ruby-string">"'"</span>
|
475
|
-
<span class="ruby-identifier">target</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">_smart_try_find</span>
|
475
|
+
<span class="ruby-identifier">target</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">_smart_try_find</span> <span class="ruby-keyword">do</span>
|
476
|
+
<span class="ruby-identifier">selenium_find</span>(<span class="ruby-value">:css</span>, [<span class="ruby-node">"input[type='checkbox'][value=#{quoted_arg}]"</span>,
|
477
|
+
<span class="ruby-node">"input[type='radio'][value=#{quoted_arg}]"</span>,
|
478
|
+
<span class="ruby-node">"input[type='button'][value=#{quoted_arg}]"</span>,
|
479
|
+
<span class="ruby-node">"input[type='submit'][value=#{quoted_arg}]"</span>
|
480
|
+
].<span class="ruby-identifier">join</span>(<span class="ruby-string">','</span>)
|
481
|
+
)
|
482
|
+
<span class="ruby-keyword">end</span>
|
476
483
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">target</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">target</span>
|
477
484
|
|
478
485
|
<span class="ruby-identifier">target</span> = <span class="ruby-identifier">selenium_find</span>(<span class="ruby-value">:xpath</span>, <span class="ruby-node">"//*[contains(text(), '#{arg.gsub("'", "\\'")}')]"</span>)
|
data/doc/README_md.html
CHANGED
@@ -213,7 +213,7 @@ the <code>=</code> sign.</p>
|
|
213
213
|
|
214
214
|
<pre><input type="text" name="q" /></pre>
|
215
215
|
|
216
|
-
<p>If we want to type the text “Hello WebDriver!” in textbox we can do the
|
216
|
+
<p>If we want to type the text “Hello WebDriver!” in the textbox we can do the
|
217
217
|
following:</p>
|
218
218
|
|
219
219
|
<pre>write "name=q" "Hello WebDriver!"</pre>
|
@@ -457,15 +457,16 @@ bauxite -l echo -u http://localhost:4444/wd/hub \
|
|
457
457
|
<pre># === suite.bxt === #
|
458
458
|
test login.bxt
|
459
459
|
test register.bxt
|
460
|
-
test
|
460
|
+
test browse_around.bxt
|
461
461
|
test purchase_something.bxt
|
462
462
|
# more tests here...</pre>
|
463
463
|
|
464
464
|
<p>Note the <code>--csv-summary</code> option in the configuration above. That
|
465
|
-
option generates a single-
|
466
|
-
Jenkins plugin. I won't go into the details of
|
467
|
-
plugin, but instead here is a fragment of a possible
|
468
|
-
|
465
|
+
option generates a single-line CSV file ideal to feed into the
|
466
|
+
<code>Plot</code> Jenkins plugin. I won't go into the details of
|
467
|
+
configuring the Plot plugin, but instead here is a fragment of a possible
|
468
|
+
Jenkins <code>config.xml</code> plotting the <a
|
469
|
+
href="Bauxite.html">Bauxite</a> test results:</p>
|
469
470
|
|
470
471
|
<pre><publishers>
|
471
472
|
...
|
data/doc/created.rid
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
README.md
|
1
|
+
Fri, 31 Jan 2014 20:58:25 -0300
|
2
|
+
README.md Fri, 31 Jan 2014 08:21:19 -0300
|
3
3
|
lib/bauxite/actions/break.rb Mon, 27 Jan 2014 20:58:50 -0300
|
4
4
|
lib/bauxite/actions/assert.rb Mon, 27 Jan 2014 20:58:50 -0300
|
5
5
|
lib/bauxite/actions/wait.rb Mon, 27 Jan 2014 20:58:50 -0300
|
@@ -32,13 +32,13 @@ lib/bauxite/parsers/default.rb Mon, 27 Jan 2014 20:58:50 -0300
|
|
32
32
|
lib/bauxite/application.rb Thu, 30 Jan 2014 20:35:05 -0300
|
33
33
|
lib/bauxite/core/errors.rb Mon, 27 Jan 2014 20:58:50 -0300
|
34
34
|
lib/bauxite/core/selector.rb Tue, 28 Jan 2014 21:05:35 -0300
|
35
|
-
lib/bauxite/core/context.rb
|
35
|
+
lib/bauxite/core/context.rb Fri, 31 Jan 2014 20:56:57 -0300
|
36
36
|
lib/bauxite/core/logger.rb Mon, 27 Jan 2014 20:58:50 -0300
|
37
37
|
lib/bauxite/core/action.rb Mon, 27 Jan 2014 20:58:50 -0300
|
38
38
|
lib/bauxite/core/parser.rb Mon, 27 Jan 2014 20:58:50 -0300
|
39
39
|
lib/bauxite/selectors/sid.rb Tue, 28 Jan 2014 19:32:32 -0300
|
40
40
|
lib/bauxite/selectors/attr.rb Mon, 27 Jan 2014 20:58:50 -0300
|
41
|
-
lib/bauxite/selectors/smart.rb
|
41
|
+
lib/bauxite/selectors/smart.rb Fri, 31 Jan 2014 20:43:53 -0300
|
42
42
|
lib/bauxite/selectors/frame.rb Tue, 28 Jan 2014 19:38:40 -0300
|
43
43
|
lib/bauxite/loggers/terminal.rb Mon, 27 Jan 2014 20:58:50 -0300
|
44
44
|
lib/bauxite/loggers/file.rb Mon, 27 Jan 2014 20:58:50 -0300
|
data/doc/index.html
CHANGED
@@ -243,7 +243,7 @@ the <code>=</code> sign.</p>
|
|
243
243
|
|
244
244
|
<pre><input type="text" name="q" /></pre>
|
245
245
|
|
246
|
-
<p>If we want to type the text “Hello WebDriver!” in textbox we can do the
|
246
|
+
<p>If we want to type the text “Hello WebDriver!” in the textbox we can do the
|
247
247
|
following:</p>
|
248
248
|
|
249
249
|
<pre>write "name=q" "Hello WebDriver!"</pre>
|
@@ -487,15 +487,16 @@ bauxite -l echo -u http://localhost:4444/wd/hub \
|
|
487
487
|
<pre># === suite.bxt === #
|
488
488
|
test login.bxt
|
489
489
|
test register.bxt
|
490
|
-
test
|
490
|
+
test browse_around.bxt
|
491
491
|
test purchase_something.bxt
|
492
492
|
# more tests here...</pre>
|
493
493
|
|
494
494
|
<p>Note the <code>--csv-summary</code> option in the configuration above. That
|
495
|
-
option generates a single-
|
496
|
-
Jenkins plugin. I won't go into the details of
|
497
|
-
plugin, but instead here is a fragment of a possible
|
498
|
-
|
495
|
+
option generates a single-line CSV file ideal to feed into the
|
496
|
+
<code>Plot</code> Jenkins plugin. I won't go into the details of
|
497
|
+
configuring the Plot plugin, but instead here is a fragment of a possible
|
498
|
+
Jenkins <code>config.xml</code> plotting the <a
|
499
|
+
href="Bauxite.html">Bauxite</a> test results:</p>
|
499
500
|
|
500
501
|
<pre><publishers>
|
501
502
|
...
|
data/doc/table_of_contents.html
CHANGED
@@ -77,6 +77,7 @@
|
|
77
77
|
<ul>
|
78
78
|
<li><a href="Bauxite/Context.html#label-Context+variables">Context variables</a>
|
79
79
|
<li><a href="Bauxite/Context.html#label-Variable+scope">Variable scope</a>
|
80
|
+
<li><a href="Bauxite/Context.html#label-Built-in+variable">Built-in variable</a>
|
80
81
|
<li><a href="Bauxite/Context.html#5Buntitled-5D">Top Section</a>
|
81
82
|
<li><a href="Bauxite/Context.html#Advanced+Helpers">Advanced Helpers</a>
|
82
83
|
<li><a href="Bauxite/Context.html#Metadata">Metadata</a>
|
data/lib/bauxite/core/context.rb
CHANGED
@@ -83,6 +83,28 @@ module Bauxite
|
|
83
83
|
# action:
|
84
84
|
# - Action#return_action
|
85
85
|
#
|
86
|
+
# === Built-in variable
|
87
|
+
# Bauxite has a series of built-in variables that provide information of
|
88
|
+
# the current test context and allow dynamic constomizations of the test
|
89
|
+
# behavior.
|
90
|
+
#
|
91
|
+
# The built-in variables are:
|
92
|
+
# [<tt>__FILE__</tt>] The file where the current action is defined.
|
93
|
+
# [<tt>__DIR__</tt>] The directory where <tt>__FILE__</tt> is.
|
94
|
+
# [<tt>__SELECTOR__</tt>] The default selector used when the selector
|
95
|
+
# specified does not contain an <tt>=</tt>
|
96
|
+
# character.
|
97
|
+
# [<tt>__DEBUG__</tt>] Set to true if the current action is being executed
|
98
|
+
# by the debug console.
|
99
|
+
# [<tt>__RETURN__</tt>] Used internally by Action#return_action to indicate
|
100
|
+
# which variables should be returned to the parent
|
101
|
+
# scope.
|
102
|
+
#
|
103
|
+
# In general, variables surrounded by double underscores and variables
|
104
|
+
# whose names are only numbers are reserved for Bauxite and should not be
|
105
|
+
# used as part of a functional test. The obvious exception is when trying
|
106
|
+
# to change the test behavior by changing the built-in variables.
|
107
|
+
#
|
86
108
|
class Context
|
87
109
|
# Test engine driver instance (Selenium WebDriver).
|
88
110
|
attr_reader :driver
|
@@ -104,11 +126,16 @@ module Bauxite
|
|
104
126
|
# +options+ is a hash with the following values:
|
105
127
|
# [:driver] selenium driver symbol (defaults to +:firefox+)
|
106
128
|
# [:timeout] selector timeout in seconds (defaults to +10s+)
|
107
|
-
# [:logger] logger implementation name without the 'Logger' suffix
|
108
|
-
#
|
109
|
-
# [:
|
110
|
-
#
|
111
|
-
# [:
|
129
|
+
# [:logger] logger implementation name without the 'Logger' suffix
|
130
|
+
# (defaults to 'null' for Loggers::NullLogger).
|
131
|
+
# [:verbose] if +true+, show verbose error information (e.g.
|
132
|
+
# backtraces) if an error occurs (defaults to +false+)
|
133
|
+
# [:debug] if +true+, break into the #debug console if an error occurs
|
134
|
+
# (defaults to +false+)
|
135
|
+
# [:wait] if +true+, call ::wait before stopping the test engine with
|
136
|
+
# #stop (defaults to +false+)
|
137
|
+
# [:extensions] an array of directories that contain extensions to be
|
138
|
+
# loaded
|
112
139
|
#
|
113
140
|
def initialize(options)
|
114
141
|
@options = options
|
@@ -30,7 +30,7 @@ class Bauxite::Selector
|
|
30
30
|
# 4. by +id+ fragment (the +id+ contains the text specified)
|
31
31
|
# 5. by +placeholder+ attribute
|
32
32
|
# 6. by text content (unless the element is a label)
|
33
|
-
# 7. by radio/checkbox
|
33
|
+
# 7. by radio/checkbox/button/submit value
|
34
34
|
# 8. by referenced element (find a label by its text, then find the element
|
35
35
|
# pointed by the label's +for+ attribute)
|
36
36
|
# 9. by child element (find a label by its text, then find the first
|
@@ -51,7 +51,14 @@ class Bauxite::Selector
|
|
51
51
|
target ||= _smart_try_find { attr("id*:"+arg, &b) }
|
52
52
|
target ||= _smart_try_find { attr("placeholder:"+arg, &b) }
|
53
53
|
quoted_arg = "'"+arg.gsub("'", "\\'")+"'"
|
54
|
-
target ||= _smart_try_find
|
54
|
+
target ||= _smart_try_find do
|
55
|
+
selenium_find(:css, ["input[type='checkbox'][value=#{quoted_arg}]",
|
56
|
+
"input[type='radio'][value=#{quoted_arg}]",
|
57
|
+
"input[type='button'][value=#{quoted_arg}]",
|
58
|
+
"input[type='submit'][value=#{quoted_arg}]"
|
59
|
+
].join(',')
|
60
|
+
)
|
61
|
+
end
|
55
62
|
return yield target if target
|
56
63
|
|
57
64
|
target = selenium_find(:xpath, "//*[contains(text(), '#{arg.gsub("'", "\\'")}')]")
|
data/lib/bauxite.rb
CHANGED
@@ -9,5 +9,10 @@
|
|
9
9
|
<div><label for="my_input">By label sibling</label><input id="my_input" type="text" value="By label sibling"/></div>
|
10
10
|
<input type="radio" name="radio" value="By radio value"/>
|
11
11
|
<input type="checkbox" name="checkbox" value="By checkbox value"/>
|
12
|
+
<input type="submit" value="By submit text" onclick="document.getElementById('btn_text').setAttribute('value', this.getAttribute('value'));"/>
|
13
|
+
<input type="button" value="By input button text" onclick="document.getElementById('btn_text').setAttribute('value', this.getAttribute('value'));"/>
|
14
|
+
<button onclick="document.getElementById('btn_text').setAttribute('value', this.innerHTML);">By button text</button>
|
15
|
+
|
16
|
+
<input type="text" id="btn_text"/>
|
12
17
|
</body>
|
13
18
|
</html>
|
data/test/smart_selector.bxt
CHANGED
@@ -9,3 +9,9 @@ assert "smart=By label sibling" "By label sibling"
|
|
9
9
|
assert "smart=By label parent" "By label parent"
|
10
10
|
assert "smart=By radio value" "By radio value"
|
11
11
|
assert "smart=By checkbox value" "By checkbox value"
|
12
|
+
click "smart=By submit text"
|
13
|
+
assert btn_text "By submit text"
|
14
|
+
click "smart=By input button text"
|
15
|
+
assert btn_text "By input button text"
|
16
|
+
click "smart=By button text"
|
17
|
+
assert btn_text "By button text"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bauxite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patricio Zavolinsky
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.1'
|
41
|
-
description:
|
42
|
-
|
43
|
-
|
44
|
-
technical details.
|
41
|
+
description: Bauxite is a façade over Selenium intended for non-developers. The idea
|
42
|
+
behind this project was to create a tool that allows non-developers to write web
|
43
|
+
tests in a human-readable language. Another major requirement is to be able to easily
|
44
|
+
extend the test language to create functional abstractions over technical details.
|
45
45
|
email: pzavolinsky at yahoo dot com dot ar
|
46
46
|
executables:
|
47
47
|
- bauxite
|