page_object_wrapper 1.4.3 → 1.4.4
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/lib/page_object_wrapper/PageObject.rb +13 -14
- data/lib/page_object_wrapper/version.rb +1 -1
- data/spec/define_page_object_spec.rb +10 -10
- data/spec/feed_xxx_spec.rb +3 -3
- data/spec/fire_xxx_and_validate_xxx_spec.rb +1 -1
- data/spec/generate_spec.rb +1 -1
- data/spec/open_page_spec.rb +4 -4
- data/spec/xxx_each.rb +2 -2
- data/spec/xxx_open.rb +2 -2
- metadata +11 -11
@@ -1,17 +1,16 @@
|
|
1
1
|
require 'active_support/inflector'
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
require 'ElementsSet'
|
7
|
-
require 'Element'
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require '
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
require 'known_elements'
|
2
|
+
pwd = File.dirname(__FILE__)
|
3
|
+
require pwd + '/Action'
|
4
|
+
require pwd + '/Dsl'
|
5
|
+
require pwd + '/Exceptions'
|
6
|
+
require pwd + '/ElementsSet'
|
7
|
+
require pwd + '/Element'
|
8
|
+
require pwd + '/Alias'
|
9
|
+
require pwd + '/Validator'
|
10
|
+
require pwd + '/Table'
|
11
|
+
require pwd + '/Pagination'
|
12
|
+
require pwd + '/Element'
|
13
|
+
require pwd + '/known_elements'
|
15
14
|
|
16
15
|
module PageObjectWrapper
|
17
16
|
class PageObject < DslElementWithLocator
|
@@ -167,7 +166,7 @@ module PageObjectWrapper
|
|
167
166
|
raise PageObjectWrapper::UnknownPageObject, label.inspect if not @@pages.collect(&:label_value).include?(label)
|
168
167
|
page_object = PageObject.find_page_object(label)
|
169
168
|
url = ''
|
170
|
-
url +=
|
169
|
+
url += PageObjectWrapper.domain if page_object.locator_value[0]=='/'
|
171
170
|
url += page_object.locator_value
|
172
171
|
if not (optional_hash.nil? or optional_hash.empty?)
|
173
172
|
optional_hash.each{|k,v|
|
@@ -9,7 +9,7 @@ describe "define_page_object" do
|
|
9
9
|
|
10
10
|
context "page_object" do
|
11
11
|
subject { page_object }
|
12
|
-
it { should be_a(PageObject)}
|
12
|
+
it { should be_a(PageObjectWrapper::PageObject)}
|
13
13
|
specify {page_object.class.pages.should include(subject)}
|
14
14
|
|
15
15
|
describe "page_object label" do
|
@@ -29,7 +29,7 @@ describe "define_page_object" do
|
|
29
29
|
|
30
30
|
describe "page_object element" do
|
31
31
|
it "can contain known elements" do
|
32
|
-
KNOWN_ELEMENTS.each{ |known|
|
32
|
+
PageObjectWrapper::KNOWN_ELEMENTS.each{ |known|
|
33
33
|
subject.should respond_to known
|
34
34
|
}
|
35
35
|
end
|
@@ -70,7 +70,7 @@ describe "define_page_object" do
|
|
70
70
|
context "element outside elements_set" do
|
71
71
|
subject { page_object.elements[page_object.elements.collect(&:label_value).index(:tf_standalone)] }
|
72
72
|
|
73
|
-
it { should be_a(Element) }
|
73
|
+
it { should be_a(PageObjectWrapper::Element) }
|
74
74
|
|
75
75
|
describe "element label" do
|
76
76
|
it_should_behave_like "a label"
|
@@ -97,7 +97,7 @@ describe "define_page_object" do
|
|
97
97
|
context "elements_set" do
|
98
98
|
subject { page_object.esets[page_object.esets.collect(&:label_value).index(:test_elements)] }
|
99
99
|
|
100
|
-
it { should be_a(ElementsSet) }
|
100
|
+
it { should be_a(PageObjectWrapper::ElementsSet) }
|
101
101
|
|
102
102
|
describe "elements_set label" do
|
103
103
|
it_should_behave_like "a label"
|
@@ -107,7 +107,7 @@ describe "define_page_object" do
|
|
107
107
|
context "element inside elements_set" do
|
108
108
|
subject { page_object.elements[page_object.elements.collect(&:label_value).index(:tf)] }
|
109
109
|
|
110
|
-
it { should be_a(Element) }
|
110
|
+
it { should be_a(PageObjectWrapper::Element) }
|
111
111
|
|
112
112
|
describe "element label" do
|
113
113
|
it_should_behave_like "a label"
|
@@ -134,7 +134,7 @@ describe "define_page_object" do
|
|
134
134
|
context "action" do
|
135
135
|
subject { page_object.actions[page_object.actions.collect(&:label_value).index(:press_cool_button)] }
|
136
136
|
|
137
|
-
it { should be_a(Action) }
|
137
|
+
it { should be_a(PageObjectWrapper::Action) }
|
138
138
|
|
139
139
|
describe "action label" do
|
140
140
|
it_should_behave_like "a label"
|
@@ -152,7 +152,7 @@ describe "define_page_object" do
|
|
152
152
|
context "action alias" do
|
153
153
|
subject { page_object.aliases[page_object.aliases.collect(&:label_value).index(:fill_textarea_alias)] }
|
154
154
|
|
155
|
-
it { should be_a(Alias) }
|
155
|
+
it { should be_a(PageObjectWrapper::Alias) }
|
156
156
|
|
157
157
|
describe "alias label" do
|
158
158
|
it_should_behave_like "a label"
|
@@ -170,7 +170,7 @@ describe "define_page_object" do
|
|
170
170
|
context "validator" do
|
171
171
|
subject { page_object.validators[page_object.validators.collect(&:label_value).index(:textarea_value)] }
|
172
172
|
|
173
|
-
it { should be_a(Validator) }
|
173
|
+
it { should be_a(PageObjectWrapper::Validator) }
|
174
174
|
|
175
175
|
describe "validator label" do
|
176
176
|
it_should_behave_like "a label"
|
@@ -185,7 +185,7 @@ describe "define_page_object" do
|
|
185
185
|
context "table" do
|
186
186
|
subject { page_object.tables[page_object.tables.collect(&:label_value).index(:table_without_header)] }
|
187
187
|
|
188
|
-
it { should be_a(Table) }
|
188
|
+
it { should be_a(PageObjectWrapper::Table) }
|
189
189
|
|
190
190
|
describe "table label" do
|
191
191
|
it_should_behave_like "a label"
|
@@ -220,7 +220,7 @@ describe "define_page_object" do
|
|
220
220
|
describe "pagination" do
|
221
221
|
subject { page_object.paginations[page_object.paginations.collect(&:label_value).index(:some_pagination)] }
|
222
222
|
|
223
|
-
it { should be_a(Pagination) }
|
223
|
+
it { should be_a(PageObjectWrapper::Pagination) }
|
224
224
|
|
225
225
|
describe "pagination label" do
|
226
226
|
it_should_behave_like "a label"
|
data/spec/feed_xxx_spec.rb
CHANGED
@@ -24,9 +24,9 @@ describe "page_object.feed_xxx" do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns current page object" do
|
27
|
-
@tp.feed_tf_standalone(:quite).should be_a PageObject
|
28
|
-
@tp.feed_test_elements(:quite).should be_a PageObject
|
29
|
-
@tp.feed_all(:quite).should be_a PageObject
|
27
|
+
@tp.feed_tf_standalone(:quite).should be_a PageObjectWrapper::PageObject
|
28
|
+
@tp.feed_test_elements(:quite).should be_a PageObjectWrapper::PageObject
|
29
|
+
@tp.feed_all(:quite).should be_a PageObjectWrapper::PageObject
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "feed_standalone_element" do
|
@@ -46,7 +46,7 @@ describe "page_object.fire_xxx" do
|
|
46
46
|
it "returns next_page" do
|
47
47
|
tp = PageObjectWrapper.current_page
|
48
48
|
np = tp.fire_press_cool_button
|
49
|
-
np.should be_a(PageObject)
|
49
|
+
np.should be_a(PageObjectWrapper::PageObject)
|
50
50
|
np.label_value.should eq(:test_page_with_table)
|
51
51
|
end
|
52
52
|
end
|
data/spec/generate_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe "PageObjectWrapper.generate" do
|
|
4
4
|
it "accepts two arguments - a path_to_an_html file and an optional array which defines what types of elements to generate" do
|
5
5
|
end
|
6
6
|
|
7
|
-
describe "generation of a PageObject definition" do
|
7
|
+
describe "generation of a PageObjectWrapper::PageObject definition" do
|
8
8
|
it "generates element_sets for the forms on the page" do
|
9
9
|
end
|
10
10
|
|
data/spec/open_page_spec.rb
CHANGED
@@ -22,9 +22,9 @@ describe "PageObjectWrapper.open_page" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
context "no optional arguments" do
|
25
|
-
it "returns opened PageObject instance" do
|
25
|
+
it "returns opened PageObjectWrapper::PageObject instance" do
|
26
26
|
p = PageObjectWrapper.open_page(:google_page)
|
27
|
-
p.should be_an_instance_of(PageObject)
|
27
|
+
p.should be_an_instance_of(PageObjectWrapper::PageObject)
|
28
28
|
p.label_value.should eq(:google_page)
|
29
29
|
end
|
30
30
|
end
|
@@ -50,14 +50,14 @@ describe "PageObjectWrapper.open_page" do
|
|
50
50
|
begin
|
51
51
|
PageObjectWrapper.open_page(:dynamic_url_page, :domain => 'google.com')
|
52
52
|
rescue PageObjectWrapper::UnmappedPageObject
|
53
|
-
PageObject.browser.url.should =~ /google.\w+\/:path/
|
53
|
+
PageObjectWrapper::PageObject.browser.url.should =~ /google.\w+\/:path/
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
context "all dynamic parameters specified" do
|
58
58
|
it "opens page with all parameters replaced with specified" do
|
59
59
|
PageObjectWrapper.open_page(:dynamic_url_page, :domain => 'google.com', :path => 'advanced_search')
|
60
|
-
PageObject.browser.url.should =~ /google.\w+\/advanced_search/
|
60
|
+
PageObjectWrapper::PageObject.browser.url.should =~ /google.\w+\/advanced_search/
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/spec/xxx_each.rb
CHANGED
@@ -35,14 +35,14 @@ describe 'page_object.each_xxx' do
|
|
35
35
|
counter = 0
|
36
36
|
gp.pagination_each( :limit => 3 ){ |subpage|
|
37
37
|
counter += 1
|
38
|
-
subpage.should be_a PageObject
|
38
|
+
subpage.should be_a PageObjectWrapper::PageObject
|
39
39
|
subpage.validate_current_number?(counter).should be_true
|
40
40
|
}
|
41
41
|
yp = PageObjectWrapper.open_page(:yandex_pagination)
|
42
42
|
counter = 0
|
43
43
|
yp.pagination_each( :limit => 3 ){ |subpage|
|
44
44
|
counter += 1
|
45
|
-
subpage.should be_a PageObject
|
45
|
+
subpage.should be_a PageObjectWrapper::PageObject
|
46
46
|
subpage.validate_current_number?(counter).should be_true
|
47
47
|
}
|
48
48
|
end
|
data/spec/xxx_open.rb
CHANGED
@@ -33,10 +33,10 @@ describe 'page_object.open_xxx' do
|
|
33
33
|
it "opens browser on provided subpage returns corresponding page_object" do
|
34
34
|
n = 10
|
35
35
|
yp = PageObjectWrapper.open_page(:yandex_pagination)
|
36
|
-
yp.pagination_open(n).should be_a PageObject
|
36
|
+
yp.pagination_open(n).should be_a PageObjectWrapper::PageObject
|
37
37
|
yp.validate_current_number?(n).should be_true
|
38
38
|
gp = PageObjectWrapper.open_page(:google_pagination)
|
39
|
-
gp.pagination_open(n).should be_a PageObject
|
39
|
+
gp.pagination_open(n).should be_a PageObjectWrapper::PageObject
|
40
40
|
gp.validate_current_number?(n).should be_true
|
41
41
|
end
|
42
42
|
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.4.
|
4
|
+
version: 1.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-03-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir-webdriver
|
16
|
-
requirement: &
|
16
|
+
requirement: &12482140 !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: *12482140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &12481580 !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: *12481580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: babosa
|
38
|
-
requirement: &
|
38
|
+
requirement: &12480840 !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: *12480840
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &12479800 !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: *12479800
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: debugger
|
60
|
-
requirement: &
|
60
|
+
requirement: &12479360 !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: *12479360
|
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:
|