page_object_wrapper 1.5.1 → 1.5.2
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.
- data/good_pages/pagination_example_page.rb +1 -1
- data/good_pages/some_test_page.html +6 -6
- data/good_pages/some_test_page.rb +1 -1
- data/lib/page_object_wrapper/PageObject.rb +23 -3
- data/lib/version.rb +1 -1
- data/spec/select_from_xxx_spec.rb +8 -4
- data/spec/{select_raw_from_xxx_spec.rb → select_row_from_xxx_spec.rb} +9 -0
- metadata +14 -14
@@ -29,6 +29,6 @@ PageObjectWrapper.define_page(:google_invalid_pagination) do
|
|
29
29
|
uniq_input :id => 'gbqfq'
|
30
30
|
|
31
31
|
pagination :invalid_pagination do
|
32
|
-
locator "table(:id => 'nav').tr.td.a(:text => '
|
32
|
+
locator "table(:id => 'nav').tr.td.a(:text => '10')", '10'
|
33
33
|
end
|
34
34
|
end
|
@@ -254,12 +254,12 @@ attributes:</p>
|
|
254
254
|
<TABLE summary=
|
255
255
|
"Each row names a Nordic country and specifies its total area and land area, in square kilometers">
|
256
256
|
<CAPTION>Sample table: Areas of the Nordic countries, in sq km</CAPTION>
|
257
|
-
<TR><th scope="col">Country</th> <th scope="col">Total area</TH> <th scope="col">Land area</TH>
|
258
|
-
<TR><th scope="row">Denmark</TH> <TD ALIGN=RIGHT> 43,070 </TD><TD ALIGN=RIGHT> 42,370</TR>
|
259
|
-
<TR><th scope="row">Finland</TH> <TD ALIGN=RIGHT>337,030 </TD><TD ALIGN=RIGHT>305,470</TR>
|
260
|
-
<TR><th scope="row">Iceland</TH> <TD ALIGN=RIGHT>103,000 </TD><TD ALIGN=RIGHT>100,250</TR>
|
261
|
-
<TR><th scope="row">Norway</TH> <TD ALIGN=RIGHT>324,220 </TD><TD ALIGN=RIGHT>307,860</TR>
|
262
|
-
<TR><th scope="row">Sweden</TH> <TD ALIGN=RIGHT>449,964 </TD><TD ALIGN=RIGHT>410,928</TR>
|
257
|
+
<TR><th scope="col">Country</th> <th scope="col">Total area</TH> <th scope="col">Land area</TH> <th scope="col">Link</TH><TH>Checkboxes</TH>
|
258
|
+
<TR><th scope="row">Denmark</TH> <TD ALIGN=RIGHT> 43,070 </TD><TD ALIGN=RIGHT> 42,370</TD> <TD ALIGN=RIGHT> <a href="http://denmark.dk/">D</a></TD> <TD><input type="checkbox"></TD></TR>
|
259
|
+
<TR><th scope="row">Finland</TH> <TD ALIGN=RIGHT>337,030 </TD><TD ALIGN=RIGHT>305,470</TD> <TD ALIGN=RIGHT> <a href="http://www.visitfinland.com/ru/">Finland</a></TD><TD><input type="checkbox"></TD></TR>
|
260
|
+
<TR><th scope="row">Iceland</TH> <TD ALIGN=RIGHT>103,000 </TD><TD ALIGN=RIGHT>100,250</TD> <TD ALIGN=RIGHT> No </TD><TD><input type="checkbox"></TD></TR>
|
261
|
+
<TR><th scope="row">Norway</TH> <TD ALIGN=RIGHT>324,220 </TD><TD ALIGN=RIGHT>307,860</TD> <TD ALIGN=RIGHT> No </TD><TD><input type="checkbox" checked></TD></TR>
|
262
|
+
<TR><th scope="row">Sweden</TH> <TD ALIGN=RIGHT>449,964 </TD><TD ALIGN=RIGHT>410,928</TD> <TD ALIGN=RIGHT> No </TD><TD><input type="checkbox"></TD></TR>
|
263
263
|
</TABLE>
|
264
264
|
|
265
265
|
<HR TITLE="Information about this document">
|
@@ -101,7 +101,7 @@ PageObjectWrapper.define_page(:some_test_page) do
|
|
101
101
|
|
102
102
|
table(:table_with_header) do
|
103
103
|
locator :summary => 'Each row names a Nordic country and specifies its total area and land area, in square kilometers'
|
104
|
-
header [:country, :total_area, :land_area]
|
104
|
+
header [:country, :total_area, :land_area, :link, :checkbox]
|
105
105
|
end
|
106
106
|
|
107
107
|
validator(:textarea_value) do |expected|
|
@@ -464,13 +464,25 @@ module PageObjectWrapper
|
|
464
464
|
t.rows.each{|r|
|
465
465
|
if search_value.is_a? String
|
466
466
|
begin
|
467
|
-
|
467
|
+
if r.cells[search_in_index].checkbox.present? and r.cells[search_in_index].checkbox.set?.to_s == search_value
|
468
|
+
found = r.cells[search_for_index]
|
469
|
+
break
|
470
|
+
elsif r.cells[search_in_index].radio.present? and r.cells[search_in_index].radio.set?.to_s == search_value
|
471
|
+
found = r.cells[search_for_index]
|
472
|
+
break
|
473
|
+
elsif r.cells[search_in_index].text == search_value
|
474
|
+
found = r.cells[search_for_index]
|
475
|
+
break
|
476
|
+
end
|
468
477
|
rescue Watir::Exception::UnknownObjectException
|
469
478
|
found = nil
|
470
479
|
end
|
471
480
|
elsif search_value.is_a? Regexp
|
472
481
|
begin
|
473
|
-
|
482
|
+
if search_value.match(r.cells[search_in_index].text)
|
483
|
+
found = r.cells[search_for_index]
|
484
|
+
break
|
485
|
+
end
|
474
486
|
rescue Watir::Exception::UnknownObjectException
|
475
487
|
found = nil
|
476
488
|
end
|
@@ -526,7 +538,15 @@ module PageObjectWrapper
|
|
526
538
|
query.each_key{ |column_name|
|
527
539
|
raise ArgumentError, "column #{column_name.inspect} not in table header and not == :number" if not table.header_value.include?(column_name)
|
528
540
|
column_index = table.header_value.index(column_name)
|
529
|
-
|
541
|
+
column_text = ''
|
542
|
+
if r[column_index].checkbox.present?
|
543
|
+
column_text = r[column_index].checkbox.set?.to_s
|
544
|
+
elsif r[column_index].radio.present?
|
545
|
+
column_text = r[column_index].radio.set?.to_s
|
546
|
+
else
|
547
|
+
column_text = r[column_index].text
|
548
|
+
end
|
549
|
+
conditions_met = false if column_text != query[column_name]
|
530
550
|
}
|
531
551
|
end
|
532
552
|
if conditions_met
|
data/lib/version.rb
CHANGED
@@ -39,8 +39,8 @@ describe "page_object.select_from_xxx" do
|
|
39
39
|
it "raises ArgumentError if second_arg's key is :row and second_arg's value not Integer" do
|
40
40
|
expect{ tp.select_from_table_without_header(:column_1, { :row => "a string" }) }.to raise_error ArgumentError, "\"a string\" not Integer"
|
41
41
|
end
|
42
|
-
it "raises Watir::Exception::UnknownObjectException if
|
43
|
-
expect{ tp.select_from_table_without_header(:
|
42
|
+
it "raises Watir::Exception::UnknownObjectException if column inside header but not present in table" do
|
43
|
+
expect{ tp.select_from_table_without_header(:column_99).text }.to raise_error(Watir::Exception::UnknownObjectException)
|
44
44
|
end
|
45
45
|
|
46
46
|
context "next_page specified" do
|
@@ -57,14 +57,14 @@ describe "page_object.select_from_xxx" do
|
|
57
57
|
|
58
58
|
context "where == nil" do
|
59
59
|
context "next_page not specified" do
|
60
|
-
it "returns
|
60
|
+
it "returns middle row value from provided column" do
|
61
61
|
tp.select_from_table_without_header(:column_0).text.should eq 'Iceland'
|
62
62
|
tp.select_from_table_without_header(:column_1).text.should eq '103,000'
|
63
63
|
tp.select_from_table_without_header(:column_2).text.should eq '100,250'
|
64
64
|
end
|
65
65
|
end
|
66
66
|
context "next_page specified" do
|
67
|
-
it "returns
|
67
|
+
it "returns middle row value from provided column" do
|
68
68
|
tp.select_from_table_without_header(:column_0, nil, :some_test_page).should eq PageObjectWrapper.receive_page(:some_test_page)
|
69
69
|
end
|
70
70
|
end
|
@@ -76,6 +76,8 @@ describe "page_object.select_from_xxx" do
|
|
76
76
|
it "returns found cells" do
|
77
77
|
tp.select_from_table_without_header(:column_0, :column_1 => '103,000').text.should eq 'Iceland'
|
78
78
|
tp.select_from_table_with_header(:country, :total_area => '337,030').text.should eq 'Finland'
|
79
|
+
tp.select_from_table_with_header(:country, :checkbox => 'false').text.should eq 'Denmark' # last found row
|
80
|
+
tp.select_from_table_with_header(:country, :checkbox => 'true').text.should eq 'Norway'
|
79
81
|
end
|
80
82
|
it "returns nil" do
|
81
83
|
tp.select_from_table_without_header(:column_0, :column_1 => '123').should eq nil
|
@@ -86,6 +88,8 @@ describe "page_object.select_from_xxx" do
|
|
86
88
|
it "returns found cells" do
|
87
89
|
tp.select_from_table_without_header(:column_0, :column_1 => /103/).text.should eq 'Iceland'
|
88
90
|
tp.select_from_table_with_header(:country, :total_area => /337/).text.should eq 'Finland'
|
91
|
+
tp.select_from_table_with_header(:country, :checkbox => 'fal').should eq nil
|
92
|
+
tp.select_from_table_with_header(:country, :checkbox => 'tr').should eq nil
|
89
93
|
end
|
90
94
|
it "returns nil" do
|
91
95
|
tp.select_from_table_without_header(:column_0, :column_1 => /123/).should eq nil
|
@@ -51,6 +51,12 @@ describe "page_object.select_from_xxx" do
|
|
51
51
|
t_row = tp.select_row_from_table_with_header(:number => 1, :country => 'Denmark')
|
52
52
|
t_row.should be_a Hash
|
53
53
|
t_row[:country].text.should eq 'Denmark'
|
54
|
+
t_row = tp.select_row_from_table_with_header(:checkbox => 'false')
|
55
|
+
t_row.should be_a Hash
|
56
|
+
t_row[:country].text.should eq 'Denmark'
|
57
|
+
t_row = tp.select_row_from_table_with_header(:checkbox => 'true')
|
58
|
+
t_row.should be_a Hash
|
59
|
+
t_row[:country].text.should eq 'Norway'
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
@@ -62,6 +68,9 @@ describe "page_object.select_from_xxx" do
|
|
62
68
|
t_row = tp.select_row_from_table_without_header(:column_0 => 'Denmark')
|
63
69
|
t_row.should be_a Hash
|
64
70
|
t_row[:column_0].text.should eq 'Denmark'
|
71
|
+
t_row = tp.select_row_from_table_without_header(:column_4 => 'false')
|
72
|
+
t_row.should be_a Hash
|
73
|
+
t_row[:column_0].text.should eq 'Denmark'
|
65
74
|
t_row = tp.select_row_from_table_without_header(:number => 1, :column_0 => 'Denmark')
|
66
75
|
t_row.should be_a Hash
|
67
76
|
t_row[:column_0].text.should eq 'Denmark'
|
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.5.
|
4
|
+
version: 1.5.2
|
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: 2013-
|
12
|
+
date: 2013-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &13697700 !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: *13697700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &13696620 !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: *13696620
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: babosa
|
38
|
-
requirement: &
|
38
|
+
requirement: &13695100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *13695100
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &13694220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *13694220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: debugger
|
60
|
-
requirement: &
|
60
|
+
requirement: &13709660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *13709660
|
69
69
|
description: Wraps watir-webdriver with convenient testing interface, based on PageObjects
|
70
70
|
automation testing pattern. Simplifies resulting automated test understanding.
|
71
71
|
email:
|
@@ -117,7 +117,7 @@ files:
|
|
117
117
|
- spec/press_xxx_spec.rb
|
118
118
|
- spec/required_elements_spec.rb
|
119
119
|
- spec/select_from_xxx_spec.rb
|
120
|
-
- spec/
|
120
|
+
- spec/select_row_from_xxx_spec.rb
|
121
121
|
- spec/shared_examples.rb
|
122
122
|
- spec/spec_helper.rb
|
123
123
|
- spec/xxx_each.rb
|
@@ -159,7 +159,7 @@ test_files:
|
|
159
159
|
- spec/press_xxx_spec.rb
|
160
160
|
- spec/required_elements_spec.rb
|
161
161
|
- spec/select_from_xxx_spec.rb
|
162
|
-
- spec/
|
162
|
+
- spec/select_row_from_xxx_spec.rb
|
163
163
|
- spec/shared_examples.rb
|
164
164
|
- spec/spec_helper.rb
|
165
165
|
- spec/xxx_each.rb
|