capybara-page-object 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/Gemfile +8 -9
- data/Gemfile.lock +27 -17
- data/README.markdown +32 -12
- data/Rakefile +0 -7
- data/VERSION +1 -1
- data/capybara-page-object.gemspec +41 -34
- data/lib/capybara-page-object.rb +12 -11
- data/lib/capybara-page-object/collections.rb +4 -0
- data/lib/capybara-page-object/component.rb +5 -0
- data/lib/{delegators.rb → capybara-page-object/delegators.rb} +0 -0
- data/lib/capybara-page-object/element.rb +6 -0
- data/lib/capybara-page-object/elements.rb +15 -0
- data/lib/capybara-page-object/elements/anchor.rb +6 -0
- data/lib/{element → capybara-page-object/elements}/form.rb +8 -16
- data/lib/capybara-page-object/elements/form_field.rb +10 -0
- data/lib/capybara-page-object/elements/head.rb +7 -0
- data/lib/capybara-page-object/elements/image.rb +7 -0
- data/lib/{element → capybara-page-object/elements}/input.rb +5 -2
- data/lib/{element → capybara-page-object/elements}/list.rb +1 -1
- data/lib/{element → capybara-page-object/elements}/list_item.rb +1 -1
- data/lib/capybara-page-object/elements/meta.rb +6 -0
- data/lib/{element → capybara-page-object/elements}/select.rb +0 -0
- data/lib/{element → capybara-page-object/elements}/table.rb +1 -1
- data/lib/capybara-page-object/elements/table_header.rb +4 -0
- data/lib/{element → capybara-page-object/elements}/table_row.rb +1 -1
- data/lib/{element → capybara-page-object/elements}/text_based_input.rb +0 -0
- data/lib/{element → capybara-page-object/elements}/textarea.rb +1 -3
- data/lib/capybara-page-object/extensions/capybara.rb +7 -0
- data/lib/capybara-page-object/extensions/enumerable.rb +10 -0
- data/lib/{html5_data.rb → capybara-page-object/html5_data.rb} +0 -0
- data/lib/{key_value.rb → capybara-page-object/key_value.rb} +0 -0
- data/lib/{node.rb → capybara-page-object/node.rb} +14 -10
- data/lib/capybara-page-object/page.rb +77 -0
- data/spec/common_spec.rb +6 -6
- data/spec/element/anchor_spec.rb +8 -3
- data/spec/element/form_field_spec.rb +7 -1
- data/spec/element/form_spec.rb +27 -17
- data/spec/helper.rb +13 -0
- data/spec/node_spec.rb +9 -0
- data/spec/page_spec.rb +90 -30
- metadata +58 -43
- data/lib/collections.rb +0 -17
- data/lib/element.rb +0 -14
- data/lib/element/TODO.md +0 -11
- data/lib/element/anchor.rb +0 -7
- data/lib/element/form_field.rb +0 -15
- data/lib/element/head.rb +0 -15
- data/lib/element/image.rb +0 -15
- data/lib/element/meta.rb +0 -11
- data/lib/element/table_header.rb +0 -4
- data/lib/page.rb +0 -40
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-page-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: &2170430100 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2170430100
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: capybara
|
16
|
-
requirement: &
|
27
|
+
requirement: &2170421860 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - ! '>='
|
@@ -21,32 +32,32 @@ dependencies:
|
|
21
32
|
version: '0'
|
22
33
|
type: :runtime
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *2170421860
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: bundler
|
27
|
-
requirement: &
|
38
|
+
requirement: &2170421320 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ~>
|
31
42
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
43
|
+
version: 1.1.0
|
33
44
|
type: :development
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *2170421320
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: jeweler
|
38
|
-
requirement: &
|
49
|
+
requirement: &2170420800 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
42
53
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.
|
54
|
+
version: 1.8.3
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *2170420800
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
59
|
+
name: simplecov
|
60
|
+
requirement: &2170420200 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *2170420200
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: rspec
|
60
|
-
requirement: &
|
71
|
+
requirement: &2170419660 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ! '>='
|
@@ -65,10 +76,10 @@ dependencies:
|
|
65
76
|
version: '0'
|
66
77
|
type: :development
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *2170419660
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
81
|
name: rake
|
71
|
-
requirement: &
|
82
|
+
requirement: &2170419140 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ~>
|
@@ -76,10 +87,10 @@ dependencies:
|
|
76
87
|
version: 0.9.2.2
|
77
88
|
type: :development
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *2170419140
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
92
|
name: rdoc
|
82
|
-
requirement: &
|
93
|
+
requirement: &2170418620 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
96
|
- - ~>
|
@@ -87,7 +98,7 @@ dependencies:
|
|
87
98
|
version: '3.12'
|
88
99
|
type: :development
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *2170418620
|
91
102
|
description: Page Objects for Capybara
|
92
103
|
email: andy@andywaite.com
|
93
104
|
executables: []
|
@@ -97,6 +108,7 @@ extra_rdoc_files:
|
|
97
108
|
- README.markdown
|
98
109
|
files:
|
99
110
|
- .document
|
111
|
+
- .travis.yml
|
100
112
|
- Gemfile
|
101
113
|
- Gemfile.lock
|
102
114
|
- LICENSE.txt
|
@@ -105,29 +117,32 @@ files:
|
|
105
117
|
- VERSION
|
106
118
|
- capybara-page-object.gemspec
|
107
119
|
- lib/capybara-page-object.rb
|
108
|
-
- lib/collections.rb
|
109
|
-
- lib/
|
110
|
-
- lib/
|
111
|
-
- lib/element
|
112
|
-
- lib/
|
113
|
-
- lib/
|
114
|
-
- lib/
|
115
|
-
- lib/
|
116
|
-
- lib/
|
117
|
-
- lib/
|
118
|
-
- lib/
|
119
|
-
- lib/
|
120
|
-
- lib/
|
121
|
-
- lib/
|
122
|
-
- lib/
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/page.rb
|
120
|
+
- lib/capybara-page-object/collections.rb
|
121
|
+
- lib/capybara-page-object/component.rb
|
122
|
+
- lib/capybara-page-object/delegators.rb
|
123
|
+
- lib/capybara-page-object/element.rb
|
124
|
+
- lib/capybara-page-object/elements.rb
|
125
|
+
- lib/capybara-page-object/elements/anchor.rb
|
126
|
+
- lib/capybara-page-object/elements/form.rb
|
127
|
+
- lib/capybara-page-object/elements/form_field.rb
|
128
|
+
- lib/capybara-page-object/elements/head.rb
|
129
|
+
- lib/capybara-page-object/elements/image.rb
|
130
|
+
- lib/capybara-page-object/elements/input.rb
|
131
|
+
- lib/capybara-page-object/elements/list.rb
|
132
|
+
- lib/capybara-page-object/elements/list_item.rb
|
133
|
+
- lib/capybara-page-object/elements/meta.rb
|
134
|
+
- lib/capybara-page-object/elements/select.rb
|
135
|
+
- lib/capybara-page-object/elements/table.rb
|
136
|
+
- lib/capybara-page-object/elements/table_header.rb
|
137
|
+
- lib/capybara-page-object/elements/table_row.rb
|
138
|
+
- lib/capybara-page-object/elements/text_based_input.rb
|
139
|
+
- lib/capybara-page-object/elements/textarea.rb
|
140
|
+
- lib/capybara-page-object/extensions/capybara.rb
|
141
|
+
- lib/capybara-page-object/extensions/enumerable.rb
|
142
|
+
- lib/capybara-page-object/html5_data.rb
|
143
|
+
- lib/capybara-page-object/key_value.rb
|
144
|
+
- lib/capybara-page-object/node.rb
|
145
|
+
- lib/capybara-page-object/page.rb
|
131
146
|
- spec/common_spec.rb
|
132
147
|
- spec/element/anchor_spec.rb
|
133
148
|
- spec/element/base_spec.rb
|
@@ -162,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
177
|
version: '0'
|
163
178
|
segments:
|
164
179
|
- 0
|
165
|
-
hash:
|
180
|
+
hash: 2995033654392698381
|
166
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
182
|
none: false
|
168
183
|
requirements:
|
data/lib/collections.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module CapybaraPageObject
|
2
|
-
module Collections
|
3
|
-
def tables
|
4
|
-
all('table').each_with_object({}) do |e, hash|
|
5
|
-
t = CapybaraPageObject::Table.new(e)
|
6
|
-
hash[t.key] = t
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def forms
|
11
|
-
all('form').each_with_object({}) do |e, hash|
|
12
|
-
f = CapybaraPageObject::Form.new(e)
|
13
|
-
hash[f.key] = f
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/element.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'element/anchor'
|
2
|
-
require 'element/form'
|
3
|
-
require 'element/image'
|
4
|
-
require 'element/form_field'
|
5
|
-
require 'element/head'
|
6
|
-
require 'element/input'
|
7
|
-
require 'element/list'
|
8
|
-
require 'element/list_item'
|
9
|
-
require 'element/meta'
|
10
|
-
require 'element/select'
|
11
|
-
require 'element/table'
|
12
|
-
require 'element/table_row'
|
13
|
-
require 'element/table_header'
|
14
|
-
require 'element/textarea'
|
data/lib/element/TODO.md
DELETED
data/lib/element/anchor.rb
DELETED
data/lib/element/form_field.rb
DELETED
data/lib/element/head.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module CapybaraPageObject
|
2
|
-
class Head < CapybaraPageObject::Node
|
3
|
-
def title
|
4
|
-
find('title').text
|
5
|
-
end
|
6
|
-
|
7
|
-
def meta_description
|
8
|
-
find('meta[@name="description"]')['content']
|
9
|
-
end
|
10
|
-
|
11
|
-
def meta_keywords
|
12
|
-
find('meta[@name="keywords"]')['content'].split(',').collect(&:strip)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/element/image.rb
DELETED
data/lib/element/meta.rb
DELETED
data/lib/element/table_header.rb
DELETED
data/lib/page.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module CapybaraPageObject
|
2
|
-
class Page < CapybaraPageObject::Node
|
3
|
-
|
4
|
-
def initialize(attr={}, source=nil)
|
5
|
-
super(source)
|
6
|
-
@attr = attr
|
7
|
-
visit
|
8
|
-
self
|
9
|
-
end
|
10
|
-
|
11
|
-
def path(*args)
|
12
|
-
raise MissingPath, "You need to override #path in #{self.class}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def refresh
|
16
|
-
visit
|
17
|
-
end
|
18
|
-
|
19
|
-
def prefix
|
20
|
-
''
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def visit
|
26
|
-
target = prefix + path
|
27
|
-
if @attr
|
28
|
-
pairs = []
|
29
|
-
@attr.each do |k, v|
|
30
|
-
pairs << "#{k}=#{v}"
|
31
|
-
end
|
32
|
-
target += '?' + pairs.join('&') if pairs.any?
|
33
|
-
end
|
34
|
-
if target == source.current_path
|
35
|
-
raise "Detected repeat of page load - use #reload instead"
|
36
|
-
end
|
37
|
-
source.visit target
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|