page_object_wrapper 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/good_pages/some_test_page.html +2 -1
- data/lib/page_object_wrapper/PageObject.rb +15 -6
- data/lib/version.rb +1 -1
- data/spec/select_from_xxx_spec.rb +9 -9
- data/spec/select_row_from_xxx_spec.rb +5 -5
- metadata +12 -12
@@ -254,7 +254,8 @@ 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</
|
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></TR>
|
258
|
+
<TR><th>One column row</th></TR>
|
258
259
|
<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
260
|
<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
261
|
<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>
|
@@ -477,6 +477,7 @@ module PageObjectWrapper
|
|
477
477
|
end
|
478
478
|
rescue Watir::Exception::UnknownObjectException
|
479
479
|
found = nil
|
480
|
+
next
|
480
481
|
end
|
481
482
|
elsif search_value.is_a? Regexp
|
482
483
|
begin
|
@@ -486,6 +487,7 @@ module PageObjectWrapper
|
|
486
487
|
end
|
487
488
|
rescue Watir::Exception::UnknownObjectException
|
488
489
|
found = nil
|
490
|
+
next
|
489
491
|
end
|
490
492
|
else
|
491
493
|
raise ArgumentError, "#{search_value} not a Regexp or String"
|
@@ -541,12 +543,19 @@ module PageObjectWrapper
|
|
541
543
|
raise ArgumentError, "column #{column_name.inspect} not in table header and not == :number" if not table.header_value.include?(column_name)
|
542
544
|
column_index = table.header_value.index(column_name)
|
543
545
|
column_text = ''
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
546
|
+
# workaround for rows with small number of columns
|
547
|
+
begin
|
548
|
+
if r[column_index].checkbox.present?
|
549
|
+
column_text = r[column_index].checkbox.set?.to_s
|
550
|
+
elsif r[column_index].radio.present?
|
551
|
+
column_text = r[column_index].radio.set?.to_s
|
552
|
+
else
|
553
|
+
column_text = r[column_index].text
|
554
|
+
end
|
555
|
+
rescue Watir::Exception::UnknownObjectException
|
556
|
+
# just moving to next row
|
557
|
+
conditions_met = false
|
558
|
+
break
|
550
559
|
end
|
551
560
|
conditions_met = false if column_text != query[column_name]
|
552
561
|
}
|
data/lib/version.rb
CHANGED
@@ -58,9 +58,9 @@ describe "page_object.select_from_xxx" do
|
|
58
58
|
context "where == nil" do
|
59
59
|
context "next_page not specified" do
|
60
60
|
it "returns middle row value from provided column" do
|
61
|
-
tp.select_from_table_without_header(:column_0).text.should eq '
|
62
|
-
tp.select_from_table_without_header(:column_1).text.should eq '
|
63
|
-
tp.select_from_table_without_header(:column_2).text.should eq '
|
61
|
+
tp.select_from_table_without_header(:column_0).text.should eq 'Finland'
|
62
|
+
tp.select_from_table_without_header(:column_1).text.should eq '337,030'
|
63
|
+
tp.select_from_table_without_header(:column_2).text.should eq '305,470'
|
64
64
|
end
|
65
65
|
end
|
66
66
|
context "next_page specified" do
|
@@ -74,8 +74,8 @@ describe "page_object.select_from_xxx" do
|
|
74
74
|
context "next_page not specified" do
|
75
75
|
context "found by String" do
|
76
76
|
it "returns found cells" do
|
77
|
-
tp.select_from_table_without_header(:
|
78
|
-
tp.select_from_table_with_header(:
|
77
|
+
tp.select_from_table_without_header(:column_1, :column_1 => '103,000').text.should eq '103,000'
|
78
|
+
tp.select_from_table_with_header(:checkbox, :total_area => '324,220').checkbox.should be_checked
|
79
79
|
tp.select_from_table_with_header(:country, :checkbox => 'false').text.should eq 'Denmark' # last found row
|
80
80
|
tp.select_from_table_with_header(:country, :checkbox => 'true').text.should eq 'Norway'
|
81
81
|
end
|
@@ -98,8 +98,8 @@ describe "page_object.select_from_xxx" do
|
|
98
98
|
end
|
99
99
|
context "found by row number" do
|
100
100
|
it "returns found cells" do
|
101
|
-
tp.select_from_table_without_header(:column_0, :row =>
|
102
|
-
tp.select_from_table_with_header(:country, :row =>
|
101
|
+
tp.select_from_table_without_header(:column_0, :row => 3).text.should eq 'Finland'
|
102
|
+
tp.select_from_table_with_header(:country, :row => 4).text.should eq 'Iceland'
|
103
103
|
end
|
104
104
|
it "returns nil" do
|
105
105
|
tp.select_from_table_with_header(:country, :row => 123).should eq nil
|
@@ -125,8 +125,8 @@ describe "page_object.select_from_xxx" do
|
|
125
125
|
end
|
126
126
|
context "found by row number" do
|
127
127
|
it "returns found cells" do
|
128
|
-
tp.select_from_table_without_header(:column_0, {:row =>
|
129
|
-
tp.select_from_table_with_header(:country, {:row =>
|
128
|
+
tp.select_from_table_without_header(:column_0, {:row => 3}, :some_test_page).should eq PageObjectWrapper.receive_page(:some_test_page)
|
129
|
+
tp.select_from_table_with_header(:country, {:row => 4}, :some_test_page).should eq PageObjectWrapper.receive_page(:some_test_page)
|
130
130
|
end
|
131
131
|
it "returns nil" do
|
132
132
|
tp.select_from_table_with_header(:country, {:row => 123}, :some_test_page).should eq nil
|
@@ -42,13 +42,13 @@ describe "page_object.select_from_xxx" do
|
|
42
42
|
|
43
43
|
context "table with header" do
|
44
44
|
it "returns first found row excluding table header" do
|
45
|
-
t_row = tp.select_row_from_table_with_header(:number =>
|
45
|
+
t_row = tp.select_row_from_table_with_header(:number => 2)
|
46
46
|
t_row.should be_a Hash
|
47
|
-
t_row[:
|
47
|
+
t_row[:land_area].text.should eq '42,370'
|
48
48
|
t_row = tp.select_row_from_table_with_header(:country => 'Denmark')
|
49
49
|
t_row.should be_a Hash
|
50
50
|
t_row[:country].text.should eq 'Denmark'
|
51
|
-
t_row = tp.select_row_from_table_with_header(:number =>
|
51
|
+
t_row = tp.select_row_from_table_with_header(:number => 2, :country => 'Denmark')
|
52
52
|
t_row.should be_a Hash
|
53
53
|
t_row[:country].text.should eq 'Denmark'
|
54
54
|
t_row = tp.select_row_from_table_with_header(:checkbox => 'false')
|
@@ -62,7 +62,7 @@ describe "page_object.select_from_xxx" do
|
|
62
62
|
|
63
63
|
context "table without header" do
|
64
64
|
it "returns first found row including table header" do
|
65
|
-
t_row = tp.select_row_from_table_without_header(:number =>
|
65
|
+
t_row = tp.select_row_from_table_without_header(:number => 2)
|
66
66
|
t_row.should be_a Hash
|
67
67
|
t_row[:column_0].text.should eq 'Denmark'
|
68
68
|
t_row = tp.select_row_from_table_without_header(:column_0 => 'Denmark')
|
@@ -71,7 +71,7 @@ describe "page_object.select_from_xxx" do
|
|
71
71
|
t_row = tp.select_row_from_table_without_header(:column_4 => 'false')
|
72
72
|
t_row.should be_a Hash
|
73
73
|
t_row[:column_0].text.should eq 'Denmark'
|
74
|
-
t_row = tp.select_row_from_table_without_header(:number =>
|
74
|
+
t_row = tp.select_row_from_table_without_header(:number => 2, :column_0 => 'Denmark')
|
75
75
|
t_row.should be_a Hash
|
76
76
|
t_row[:column_0].text.should eq 'Denmark'
|
77
77
|
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.5.
|
4
|
+
version: 1.5.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: 2013-
|
12
|
+
date: 2013-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &20960480 !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: *20960480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &20959820 !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: *20959820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: babosa
|
38
|
-
requirement: &
|
38
|
+
requirement: &20959380 !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: *20959380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &20958840 !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: *20958840
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: debugger
|
60
|
-
requirement: &
|
60
|
+
requirement: &20974600 !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: *20974600
|
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:
|