page_object_wrapper 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -2
- data/good_pages/some_test_page.html +279 -0
- data/good_pages/some_test_page.rb +2 -1
- data/img/scheme.png +0 -0
- data/lib/page_object_wrapper/PageObject.rb +36 -13
- data/lib/page_object_wrapper/version.rb +1 -1
- data/spec/select_from_xxx_spec.rb +25 -4
- metadata +11 -10
data/README.md
CHANGED
@@ -36,7 +36,9 @@ Or install it yourself as:
|
|
36
36
|
Here in the structure of PageObjectWrapper:
|
37
37
|
![PageObjectWrapper scheme](https://raw.github.com/evgeniy-khatko/page_object_wrapper/master/img/scheme.png)
|
38
38
|
|
39
|
-
where required attributes are marked with (
|
39
|
+
where required attributes are marked with (\*)
|
40
|
+
optional arguments are enclosed with [ ]
|
41
|
+
|
40
42
|
|
41
43
|
### Examples
|
42
44
|
|
@@ -181,7 +183,7 @@ current\_page
|
|
181
183
|
|
182
184
|
#### xxx\_menu
|
183
185
|
*parameters*
|
184
|
-
:food\_type
|
186
|
+
:food\_type
|
185
187
|
*returns*
|
186
188
|
food value for this type which is defined in page\_object
|
187
189
|
|
@@ -0,0 +1,279 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
<html lang="en-US">
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<title>
|
7
|
+
Test display of HTML elements
|
8
|
+
</title>
|
9
|
+
<link rel="alternate stylesheet" type="text/css" title=
|
10
|
+
"A cool style sheet" href="../styles/cool.css">
|
11
|
+
<link rel="alternate stylesheet" type="text/css" title=
|
12
|
+
"Yucca's basic style sheet" href="../basic.css">
|
13
|
+
<link rel="alternate stylesheet" type="text/css" title=
|
14
|
+
"Style sheet for fixing some IE oddities" href="test-ie.css">
|
15
|
+
</head>
|
16
|
+
|
17
|
+
<body>
|
18
|
+
|
19
|
+
<h1>Testing display of HTML elements</h1>
|
20
|
+
<h2>This is 2nd level heading</h2>
|
21
|
+
<p>This is a test paragraph.</p>
|
22
|
+
<h3>This is 3rd level heading</h3>
|
23
|
+
<p>This is a test paragraph.</p>
|
24
|
+
<h4>This is 4th level heading</h4>
|
25
|
+
<p>This is a test paragraph.</p>
|
26
|
+
<h5>This is 5th level heading</h5>
|
27
|
+
<p>This is a test paragraph.</p>
|
28
|
+
<h6>This is 6th level heading</h6>
|
29
|
+
<p>This is a test paragraph.</p>
|
30
|
+
|
31
|
+
<h2>Basic block level elements</h2>
|
32
|
+
|
33
|
+
<p>This is a normal paragraph (<code>p</code> element).
|
34
|
+
To add some length to it, let us mention that this page was
|
35
|
+
primarily written for testing the effect of <strong>user style sheets</strong>.
|
36
|
+
You can use it for various other purposes as well, like just checking how
|
37
|
+
your browser displays various HTML elements.</p>
|
38
|
+
<p>This is another paragraph. I think it needs to be added that
|
39
|
+
the set of elements tested is not exhaustive in any sense. I have selected
|
40
|
+
those elements for which it can make sense to write user style sheet rules,
|
41
|
+
in my opionion.</p>
|
42
|
+
<div>This is a <code>div</code> element. Authors may use such elements instead
|
43
|
+
of paragraph markup for various reasons. (End of <code>div</code>.)</div>
|
44
|
+
<blockquote><p>This is a block quotation containing a single
|
45
|
+
paragraph. Well, not quite, since this is not <em>really</em>
|
46
|
+
quoted text, but I hope you understand the point. After all, this
|
47
|
+
page does not use HTML markup very normally anyway.</p></blockquote>
|
48
|
+
<p>The following contains address information about the author, in an <code>address</code>
|
49
|
+
element.</p>
|
50
|
+
<address>
|
51
|
+
<a href="../personal.html" lang="fi" hreflang="en">Jukka Korpela</a>,
|
52
|
+
<a href="mailto:jkorpela@cs.tut.fi">jkorpela@cs.tut.fi</A>
|
53
|
+
</address>
|
54
|
+
|
55
|
+
<h2>Lists</h2>
|
56
|
+
|
57
|
+
<p>This is a paragraph before an <strong>unnumbered</strong> list (<code>ul</code>). Note that
|
58
|
+
the spacing between a paragraph and a list before or after that is hard
|
59
|
+
to tune in a user style sheet. You can't guess which paragraphs are
|
60
|
+
logically related to a list, e.g. as a "list header".</p>
|
61
|
+
<ul>
|
62
|
+
<li> One.
|
63
|
+
<li> Two.
|
64
|
+
<li> Three. Well, probably this list item should be longer. Note that
|
65
|
+
for short items lists look better if they are compactly presented,
|
66
|
+
whereas for long items, it would be better to have more vertical spacing between items.
|
67
|
+
<li> Four. This is the last item in this list.
|
68
|
+
Let us terminate the list now without making any more fuss about it.
|
69
|
+
</ul>
|
70
|
+
<p>The following is a <code>menu</code> list:</p>
|
71
|
+
<menu>
|
72
|
+
<li> One.
|
73
|
+
<li> Two.
|
74
|
+
<li> Three. Well, probably this list item should be longer so that it will
|
75
|
+
probably wrap to the next line in rendering.
|
76
|
+
</menu>
|
77
|
+
<p>The following is a <code>dir</code> list:</p>
|
78
|
+
<dir>
|
79
|
+
<li> One.
|
80
|
+
<li> Two.
|
81
|
+
<li> Three. Well, probably this list item should be longer so that it will
|
82
|
+
probably wrap to the next line in rendering.
|
83
|
+
</dir>
|
84
|
+
|
85
|
+
<p>This is a paragraph before a <strong>numbered</strong> list (<code>ol</code>). Note that
|
86
|
+
the spacing between a paragraph and a list before or after that is hard
|
87
|
+
to tune in a user style sheet. You can't guess which paragraphs are
|
88
|
+
logically related to a list, e.g. as a "list header".</p>
|
89
|
+
<ol>
|
90
|
+
<li> One.
|
91
|
+
<li> Two.
|
92
|
+
<li> Three. Well, probably this list item should be longer. Note that if
|
93
|
+
items are short, lists look better if they are compactly presented,
|
94
|
+
whereas for long items, it would be better to have more vertical spacing between items.
|
95
|
+
<li> Four. This is the last item in this list.
|
96
|
+
Let us terminate the list now without making any more fuss about it.
|
97
|
+
</ol>
|
98
|
+
|
99
|
+
<p>This is a paragraph before a <strong>definition</strong> list (<code>dl</code>).
|
100
|
+
In principle, such a list should consist of <em>terms</em> and associated
|
101
|
+
definitions.
|
102
|
+
But many authors use <code>dl</code> elements for fancy "layout" things. Usually the
|
103
|
+
effect is not <em>too</em> bad, if you design user style sheet rules for <code>dl</code>
|
104
|
+
which are suitable
|
105
|
+
for real definition lists.
|
106
|
+
<dl>
|
107
|
+
<dt> recursion
|
108
|
+
<dd> see recursion
|
109
|
+
<dt> recursion, indirect
|
110
|
+
<dd> see indirect recursion
|
111
|
+
<dt> indirect recursion
|
112
|
+
<dd> see recursion, indirect
|
113
|
+
<dt> term
|
114
|
+
<dd> a word or other expression taken into specific use in
|
115
|
+
a well-defined meaning, which is often defined rather rigorously, even
|
116
|
+
formally, and may differ quite a lot from an everyday meaning
|
117
|
+
</dl>
|
118
|
+
|
119
|
+
<h2>Text-level markup</h2>
|
120
|
+
|
121
|
+
<ul>
|
122
|
+
<li> <abbr title="Cascading Style Sheets">CSS</abbr> (an abbreviation;
|
123
|
+
<code>abbr</code> markup used)
|
124
|
+
<li> <acronym title="radio detecting and ranging">radar</acronym> (an acronym; <code>acronym</code> markup used)
|
125
|
+
<li> <b>bolded</b> (<code>b</code> markup used - just bolding with unspecified
|
126
|
+
semantics)
|
127
|
+
<li> <big>big thing</big> (<code>big</code> markup used)
|
128
|
+
<li> <font size=6>large size</font> (<code>font size=6</code> markup used)
|
129
|
+
<li> <font face=Courier>Courier font</font> (<code>font face=Courier</code> markup used)
|
130
|
+
<li> <font color=red>red text</font> (<code>font color=red</code> markup used)
|
131
|
+
<li> <cite>Origin of Species</cite> (a book title;
|
132
|
+
<code>cite</code> markup used)
|
133
|
+
<li> <code>a[i] = b[i] + c[i);</code> (computer code; <code>code</code> markup used)
|
134
|
+
<li> here we have some <del>deleted</del> text (<code>del</code> markup used)
|
135
|
+
<li> an <dfn>octet</dfn> is an entity consisting of eight bits
|
136
|
+
(<code>dfn</code> markup used for the term being defined)
|
137
|
+
<li> this is <em>very</em> simple (<code>em</code> markup used for emphasizing
|
138
|
+
a word)
|
139
|
+
<li> <i lang="la">Homo sapiens</i> (should appear in italics; <code>i</code> markup used)
|
140
|
+
<li> here we have some <ins>inserted</ins> text (<code>ins</code> markup used)
|
141
|
+
<li> type <kbd>yes</kbd> when prompted for an answer (<code>kbd</code> markup
|
142
|
+
used for text indicating keyboard input)
|
143
|
+
<li> <q>Hello!</q> (<code>q</code> markup used for quotation)
|
144
|
+
<li> He said: <q>She said <q>Hello!</q></q> (a quotation inside a quotation)
|
145
|
+
<li> you may get the message <samp>Core dumped</samp> at times
|
146
|
+
(<code>samp</code> markup used for sample output)
|
147
|
+
<li> <small>this is not that important</small> (<code>small</code> markup used)
|
148
|
+
<li> <strike>overstruck</strike> (<code>strike</code> markup used; note:
|
149
|
+
<code>s</code> is a nonstandard synonym for <code>strike</code>)
|
150
|
+
<li> <strong>this is highlighted text</strong> (<code>strong</code>
|
151
|
+
markup used)
|
152
|
+
<li> In order to test how subscripts and superscripts (<code>sub</code> and
|
153
|
+
<code>sup</code> markup) work inside running text, we need some
|
154
|
+
dummy text around constructs like x<sub>1</sub> and H<sub>2</sub>O
|
155
|
+
(where subscripts occur). So here is some fill so that
|
156
|
+
you will (hopefully) see whether and how badly the subscripts
|
157
|
+
and superscripts mess up vertical spacing between lines.
|
158
|
+
Now superscripts: M<sup>lle</sup>, 1<sup>st</sup>, and then some
|
159
|
+
mathematical notations: e<sup>x</sup>, sin<sup>2</sup> <i>x</i>,
|
160
|
+
and some nested superscripts (exponents) too:
|
161
|
+
e<sup>x<sup>2</sup></sup> and f(x)<sup>g(x)<sup>a+b+c</sup></sup>
|
162
|
+
(where 2 and a+b+c should appear as exponents of exponents).
|
163
|
+
<li> <tt>text in monospace font</tt> (<code>tt</code> markup used)
|
164
|
+
<li> <u>underlined</u> text (<code>u</code> markup used)
|
165
|
+
<li> the command <code>cat</code> <var>filename</var> displays the
|
166
|
+
file specified by the <var>filename</var> (<code>var</code> markup
|
167
|
+
used to indicate a word as a variable).
|
168
|
+
</ul>
|
169
|
+
|
170
|
+
<p>Some of the elements tested above are typically displayed in a monospace
|
171
|
+
font, often using the <em>same</em> presentation for all of them. This
|
172
|
+
tests whether that is the case on your browser:</p>
|
173
|
+
|
174
|
+
<ul>
|
175
|
+
<li> <code>This is sample text inside code markup</code>
|
176
|
+
<li> <kbd>This is sample text inside kbd markup</kbd>
|
177
|
+
<li> <samp>This is sample text inside samp markup</samp>
|
178
|
+
<li> <tt>This is sample text inside tt markup</tt>
|
179
|
+
</ul>
|
180
|
+
<h2>Links</h2>
|
181
|
+
<ul>
|
182
|
+
<li> <a href="../index.html">main page</a>
|
183
|
+
<li> <a href=
|
184
|
+
"http://www.unicode.org/versions/Unicode4.0.0/ch06.pdf"
|
185
|
+
title="Writing Systems and Punctuation"
|
186
|
+
type="application/pdf"
|
187
|
+
>Unicode Standard, chapter 6</a>
|
188
|
+
</ul>
|
189
|
+
|
190
|
+
<p>This is a text paragraph that contains some
|
191
|
+
inline links. Generally, inline links (as opposite to e.g. links
|
192
|
+
lists) are problematic
|
193
|
+
from the
|
194
|
+
<a href="http://www.useit.com">usability</a> perspective,
|
195
|
+
but they may have use as
|
196
|
+
“incidental”, less relevant links. See the document
|
197
|
+
<cite><a href="links.html">Links Want To Be Links</a></cite>.</p>
|
198
|
+
|
199
|
+
<h2>Forms</h2>
|
200
|
+
|
201
|
+
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi">
|
202
|
+
<div>
|
203
|
+
<input type="hidden" name="hidden field" value="42">
|
204
|
+
This is a form containing various fields (with some initial
|
205
|
+
values (defaults) set, so that you can see how input text looks
|
206
|
+
like without actually typing it):</div>
|
207
|
+
<div><label for="but">Button:
|
208
|
+
<button id="but" type="submit" name="foo" value="bar">A cool<br>button</button></label></div>
|
209
|
+
<div><label for="f0">Reset button:
|
210
|
+
<input id="f0" type="reset" name="reset" value="Reset"></label></div>
|
211
|
+
<div><label for="f1">Single-line text input field: <input id="f1" name="text" size="20" value="Default text."></label></div>
|
212
|
+
<div><label for="f2">Multi-line text input field (textarea):</label><br>
|
213
|
+
<textarea id="f2" name="textarea" rows="2" cols="20">
|
214
|
+
Default text.
|
215
|
+
</textarea></div>
|
216
|
+
<div>The following two radio buttons are inside
|
217
|
+
a <code>fieldset</code> element with a <code>legend</code>:</div>
|
218
|
+
<fieldset>
|
219
|
+
<legend>Legend</legend>
|
220
|
+
<div><label for="f3"><input id="f3" type="radio" name="radio" value="1"> Radio button 1</label></div>
|
221
|
+
<div><label for="f4"><input id="f4" type="radio" name="radio" value="2" checked> Radio button 2 (initially checked)</label></div>
|
222
|
+
</fieldset>
|
223
|
+
<fieldset>
|
224
|
+
<legend>Check those that apply</legend>
|
225
|
+
<div><label for="f5"><input id="f5" type="checkbox" name="checkbox"> Checkbox 1</label></div>
|
226
|
+
<div><label for="f6"><input id="f6" type="checkbox" name="checkbox2" checked> Checkbox 2 (initially checked)</label></div>
|
227
|
+
</fieldset>
|
228
|
+
<div><label for="f10">A <code>select</code> element with <code>size="1"</code>
|
229
|
+
(dropdown box):
|
230
|
+
<select id="f10" name="select1" size="1">
|
231
|
+
<option>one
|
232
|
+
<option selected>two (default)
|
233
|
+
<option>three
|
234
|
+
</select></label></div>
|
235
|
+
<div><label for="f11">A <code>select</code> element with <code>size="3"</code>
|
236
|
+
(listbox):</label><br>
|
237
|
+
<select id="f11" name="select2" size="3">
|
238
|
+
<option>one
|
239
|
+
<option selected>two (default)
|
240
|
+
<option>three
|
241
|
+
</select></div>
|
242
|
+
<div><label for="f99">Submit button:
|
243
|
+
<input id="f99" type="submit" name="submit" value="Just a test"></label></div>
|
244
|
+
</form>
|
245
|
+
|
246
|
+
<h2>Tables</h2>
|
247
|
+
|
248
|
+
<p>The following table has a caption. The first row and the first column
|
249
|
+
contain table header cells (<code>th</code> elements) only; other cells
|
250
|
+
are data cells (<code>td</code> elements), with <code>align="right"</code>
|
251
|
+
attributes:</p>
|
252
|
+
|
253
|
+
<TABLE summary=
|
254
|
+
"Each row names a Nordic country and specifies its total area and land area, in square kilometers">
|
255
|
+
<CAPTION>Sample table: Areas of the Nordic countries, in sq km</CAPTION>
|
256
|
+
<TR><th scope="col">Country</th> <th scope="col">Total area</TH> <th scope="col">Land area</TH>
|
257
|
+
<TR><th scope="row">Denmark</TH> <TD ALIGN=RIGHT> 43,070 </TD><TD ALIGN=RIGHT> 42,370</TR>
|
258
|
+
<TR><th scope="row">Finland</TH> <TD ALIGN=RIGHT>337,030 </TD><TD ALIGN=RIGHT>305,470</TR>
|
259
|
+
<TR><th scope="row">Iceland</TH> <TD ALIGN=RIGHT>103,000 </TD><TD ALIGN=RIGHT>100,250</TR>
|
260
|
+
<TR><th scope="row">Norway</TH> <TD ALIGN=RIGHT>324,220 </TD><TD ALIGN=RIGHT>307,860</TR>
|
261
|
+
<TR><th scope="row">Sweden</TH> <TD ALIGN=RIGHT>449,964 </TD><TD ALIGN=RIGHT>410,928</TR>
|
262
|
+
</TABLE>
|
263
|
+
|
264
|
+
<HR TITLE="Information about this document">
|
265
|
+
|
266
|
+
<address>
|
267
|
+
<a href="../personal.html" hreflang="en" lang="fi">Jukka Korpela</a>
|
268
|
+
</address>
|
269
|
+
<div>
|
270
|
+
<A TITLE=
|
271
|
+
"ISO 8601, the date and time representation standard"
|
272
|
+
HREF="../iso8601.html">
|
273
|
+
Date</A> of creation: 2000-09-15.
|
274
|
+
Last update: 2012-02-16.
|
275
|
+
</div>
|
276
|
+
|
277
|
+
</BODY>
|
278
|
+
|
279
|
+
</HTML>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
PageObjectWrapper.define_page(:some_test_page) do
|
2
|
-
locator 'http://www.cs.tut.fi/~jkorpela/www/testel.html'
|
2
|
+
#locator 'http://www.cs.tut.fi/~jkorpela/www/testel.html'
|
3
|
+
locator 'file://'+Dir.pwd+'/good_pages/some_test_page.html'
|
3
4
|
uniq_h1 :text => 'Testing display of HTML elements'
|
4
5
|
|
5
6
|
elements_set(:test_elements) do
|
data/img/scheme.png
CHANGED
Binary file
|
@@ -304,7 +304,9 @@ class PageObject < DslElementWithLocator
|
|
304
304
|
private
|
305
305
|
|
306
306
|
def self.find_page_object(l)
|
307
|
-
@@pages.select{|p| p.label_value == l}.first
|
307
|
+
p = @@pages.select{|p| p.label_value == l}.first
|
308
|
+
raise ArgumentError, "#{l.inspect} not known Page" if p.nil?
|
309
|
+
p
|
308
310
|
end
|
309
311
|
|
310
312
|
def return_watir_element(e)
|
@@ -385,21 +387,42 @@ private
|
|
385
387
|
raise ArgumentError, "#{where.inspect} not a meaningful Hash" if not where.is_a? Hash or where.empty?
|
386
388
|
raise ArgumentError, "#{where.inspect} has more than 1 keys" if not where.keys.length == 1
|
387
389
|
raise ArgumentError, "#{where.keys.first.inspect} not a Symbol" if not where.keys.first.is_a? Symbol
|
388
|
-
raise ArgumentError, "#{where.keys.first.inspect} not in table header" if not table.header_value.include? where.keys.first
|
389
|
-
raise ArgumentError, "#{where.values.first.inspect} not a String or Regexp" if not (where.values.first.is_a? String or where.values.first.is_a? Regexp)
|
390
|
-
search_in_index = table.header_value.index(where.keys.first)
|
390
|
+
raise ArgumentError, "#{where.keys.first.inspect} not in table header and not == :row" if not ( table.header_value.include? where.keys.first or where.keys.first == :row )
|
391
|
+
raise ArgumentError, "#{where.values.first.inspect} not a String or Regexp or Integer" if not ( where.values.first.is_a? String or where.values.first.is_a? Regexp or where.values.first.is_a? Integer)
|
391
392
|
search_value = where.values.first
|
392
|
-
|
393
|
-
if
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
raise ArgumentError, "#{search_value} not a Regexp or String"
|
393
|
+
if where.keys.first == :row # finding by row number
|
394
|
+
raise ArgumentError, "#{where.values.first.inspect} not Integer" if not ( where.values.first.is_a? Integer)
|
395
|
+
begin
|
396
|
+
found = t.rows[search_value+1].cells[search_for_index] # +1 because we want rows to start from 0 (similar to columns)
|
397
|
+
rescue Watir::Exception::UnknownObjectException
|
398
|
+
found = nil
|
399
399
|
end
|
400
|
-
|
400
|
+
else # finding by String or Regexp
|
401
|
+
search_in_index = table.header_value.index(where.keys.first)
|
402
|
+
t.rows.each{|r|
|
403
|
+
if search_value.is_a? String
|
404
|
+
begin
|
405
|
+
found = r.cells[search_for_index] if r.cells[search_in_index].text == search_value
|
406
|
+
rescue Watir::Exception::UnknownObjectException
|
407
|
+
found = nil
|
408
|
+
end
|
409
|
+
elsif search_value.is_a? Regexp
|
410
|
+
begin
|
411
|
+
found = r.cells[search_for_index] if search_value.match(r.cells[search_in_index].text)
|
412
|
+
rescue Watir::Exception::UnknownObjectException
|
413
|
+
found = nil
|
414
|
+
end
|
415
|
+
else
|
416
|
+
raise ArgumentError, "#{search_value} not a Regexp or String"
|
417
|
+
end
|
418
|
+
}
|
419
|
+
end
|
401
420
|
else # where == nil
|
402
|
-
|
421
|
+
begin
|
422
|
+
found = t.rows[t.rows.length/2].cells[search_for_index] # returning some "middle" row cell value
|
423
|
+
rescue Watir::Exception::UnknownObjectException
|
424
|
+
found = nil
|
425
|
+
end
|
403
426
|
end
|
404
427
|
|
405
428
|
if not next_page.nil?
|
@@ -31,10 +31,13 @@ describe "page_object.select_from_xxx" do
|
|
31
31
|
expect{ tp.select_from_table_without_header(:column_1, {:column_1 => 'foo', :column_2 => 'bar'})}.to raise_error ArgumentError, '{:column_1=>"foo", :column_2=>"bar"} has more than 1 keys'
|
32
32
|
end
|
33
33
|
it "raises ArgumentError if second_arg's key not included in table_header" do
|
34
|
-
expect{ tp.select_from_table_without_header(:column_1, { :nonexistent_column => 'some value' }) }.to raise_error ArgumentError, ":nonexistent_column not in table header"
|
34
|
+
expect{ tp.select_from_table_without_header(:column_1, { :nonexistent_column => 'some value' }) }.to raise_error ArgumentError, ":nonexistent_column not in table header and not == :row"
|
35
35
|
end
|
36
|
-
it "raises ArgumentError if second_arg's value not meaningful a String or Regexp" do
|
37
|
-
expect{ tp.select_from_table_without_header(:column_1, { :column_2 => Array.new }) }.to raise_error ArgumentError, "[] not a String or Regexp"
|
36
|
+
it "raises ArgumentError if second_arg's value not meaningful a String or Regexp or Integer" do
|
37
|
+
expect{ tp.select_from_table_without_header(:column_1, { :column_2 => Array.new }) }.to raise_error ArgumentError, "[] not a String or Regexp or Integer"
|
38
|
+
end
|
39
|
+
it "raises ArgumentError if second_arg's key is :row and second_arg's value not Integer" do
|
40
|
+
expect{ tp.select_from_table_without_header(:column_1, { :row => "a string" }) }.to raise_error ArgumentError, "\"a string\" not Integer"
|
38
41
|
end
|
39
42
|
it "raises Watir::Exception::UnknownObjectException if requested for non existing column" do
|
40
43
|
expect{ tp.select_from_table_without_header(:column_3).text }.to raise_error(Watir::Exception::UnknownObjectException)
|
@@ -66,7 +69,7 @@ describe "page_object.select_from_xxx" do
|
|
66
69
|
end
|
67
70
|
end
|
68
71
|
end
|
69
|
-
|
72
|
+
|
70
73
|
context "where not nil" do
|
71
74
|
context "next_page not specified" do
|
72
75
|
context "found by String" do
|
@@ -89,6 +92,15 @@ describe "page_object.select_from_xxx" do
|
|
89
92
|
tp.select_from_table_with_header(:country, :total_area => /123/).should eq nil
|
90
93
|
end
|
91
94
|
end
|
95
|
+
context "found by row number" do
|
96
|
+
it "returns found cells" do
|
97
|
+
tp.select_from_table_without_header(:column_0, :row => 2).text.should eq 'Iceland'
|
98
|
+
tp.select_from_table_with_header(:country, :row => 3).text.should eq 'Norway'
|
99
|
+
end
|
100
|
+
it "returns nil" do
|
101
|
+
tp.select_from_table_with_header(:country, :row => 123).should eq nil
|
102
|
+
end
|
103
|
+
end
|
92
104
|
end
|
93
105
|
context "next_page specified" do
|
94
106
|
context "found by String" do
|
@@ -107,6 +119,15 @@ describe "page_object.select_from_xxx" do
|
|
107
119
|
tp.select_from_table_without_header(:column_0, {:column_1 => /123/}, :some_test_page).should eq nil
|
108
120
|
end
|
109
121
|
end
|
122
|
+
context "found by row number" do
|
123
|
+
it "returns found cells" do
|
124
|
+
tp.select_from_table_without_header(:column_0, {:row => 2}, :some_test_page).should eq PageObjectWrapper.receive_page(:some_test_page)
|
125
|
+
tp.select_from_table_with_header(:country, {:row => 3}, :some_test_page).should eq PageObjectWrapper.receive_page(:some_test_page)
|
126
|
+
end
|
127
|
+
it "returns nil" do
|
128
|
+
tp.select_from_table_with_header(:country, {:row => 123}, :some_test_page).should eq nil
|
129
|
+
end
|
130
|
+
end
|
110
131
|
end
|
111
132
|
end
|
112
133
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_object_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &14274520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *14274520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &14221140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *14221140
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &14166080 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *14166080
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: debugger
|
49
|
-
requirement: &
|
49
|
+
requirement: &14146280 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *14146280
|
58
58
|
description: Wraps watir-webdriver with convenient testing interface, based on PageObjects
|
59
59
|
automation testing pattern. Simplifies resulting automated test understanding.
|
60
60
|
email:
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- good_pages/google_page.rb
|
75
75
|
- good_pages/google_wrong_uniq_page.rb
|
76
76
|
- good_pages/goole_as_page.rb
|
77
|
+
- good_pages/some_test_page.html
|
77
78
|
- good_pages/some_test_page.rb
|
78
79
|
- good_pages/test_table_page.rb
|
79
80
|
- img/scheme.png
|