site_prism 2.9.1 → 2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +12 -7
- data/lib/site_prism.rb +2 -0
- data/lib/site_prism/addressable_url_matcher.rb +2 -0
- data/lib/site_prism/element_checker.rb +3 -3
- data/lib/site_prism/element_container.rb +2 -0
- data/lib/site_prism/exceptions.rb +2 -0
- data/lib/site_prism/loadable.rb +2 -0
- data/lib/site_prism/page.rb +10 -6
- data/lib/site_prism/section.rb +2 -0
- data/lib/site_prism/version.rb +1 -1
- data/lib/site_prism/waiter.rb +2 -0
- metadata +110 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d0e146e413da0daaf6ce3b682e8cb73c9d62b41
|
4
|
+
data.tar.gz: 821f1fbecffb6478ba986770647182e0e1028031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e7ce96a05714bf6f59a927534456d77adfa31d718846dd076ef2d8c57e19a526cab45cb6377dc50649f32b295fe7eb86352046ee4bff9cd887664ee39d48287
|
7
|
+
data.tar.gz: 43bd714f1846ca69256cda3655187dd5443311329fe78a9ee2f8eb118fa0d9693fa3214758c6ea819a20669ddc7c8c3ce7ccf77b88398abb812550b70d7f8300
|
data/{LICENSE → LICENSE.md}
RENAMED
data/README.md
CHANGED
@@ -599,11 +599,16 @@ You can access the element collection like this:
|
|
599
599
|
With that you can do all the normal things that are possible with
|
600
600
|
arrays:
|
601
601
|
|
602
|
+
```ruby
|
603
|
+
@friends_page.names.each { |name| puts name.text }
|
604
|
+
@friends_page.names.map { |name| name.text }
|
605
|
+
```
|
606
|
+
|
607
|
+
Or even run some tests...
|
602
608
|
|
603
609
|
```ruby
|
604
|
-
@friends_page.names.
|
605
|
-
expect(@friends_page.names.
|
606
|
-
expect(@friends_page.names.size).to eq 3
|
610
|
+
expect(@friends_page.names.map { |name| name.text }).to eq(["Alice", "Bob", "Fred"])
|
611
|
+
expect(@friends_page.names.size).to eq(3)
|
607
612
|
expect(@friends_page).to have(3).names
|
608
613
|
```
|
609
614
|
|
@@ -612,16 +617,16 @@ expect(@friends_page).to have(3).names
|
|
612
617
|
Just like the `element` method, the `elements` method adds a method to
|
613
618
|
the page that will allow you to check for the existence of the
|
614
619
|
collection, called `has_<element collection name>?`. As long as there is
|
615
|
-
at least 1 element in the array, the method will return true
|
616
|
-
false
|
620
|
+
at least 1 element in the array, the method will return `true`, otherwise
|
621
|
+
it wil return `false`. For example, with the following page:
|
617
622
|
|
618
623
|
```ruby
|
619
624
|
class Friends < SitePrism::Page
|
620
|
-
elements
|
625
|
+
elements(:names, 'ul#names li a')
|
621
626
|
end
|
622
627
|
```
|
623
628
|
|
624
|
-
... the following method is available:
|
629
|
+
... then the following method is available:
|
625
630
|
|
626
631
|
```ruby
|
627
632
|
@friends_page.has_names? #=> returns true if at least one element is found using the relevant selector
|
data/lib/site_prism.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SitePrism
|
2
4
|
module ElementChecker
|
3
5
|
def all_there?
|
4
|
-
|
5
|
-
self.class.mapped_items.all? { |element| send "has_#{element}?" }
|
6
|
-
end
|
6
|
+
self.class.mapped_items.all? { |element| send "has_#{element}?" }
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/lib/site_prism/loadable.rb
CHANGED
data/lib/site_prism/page.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'site_prism/loadable'
|
2
4
|
|
3
5
|
module SitePrism
|
@@ -16,22 +18,24 @@ module SitePrism
|
|
16
18
|
end
|
17
19
|
|
18
20
|
# Loads the page.
|
19
|
-
# Executes the block, if given, after running load validations on the page.
|
20
|
-
#
|
21
21
|
# @param expansion_or_html
|
22
|
-
# @param block [&block]
|
22
|
+
# @param block [&block] An optional block to run once the page is loaded.
|
23
|
+
# The page will yield the block if defined.
|
24
|
+
#
|
25
|
+
# Executes the block, if given.
|
26
|
+
# Runs load validations on the page, unless input is a string
|
23
27
|
def load(expansion_or_html = {}, &block)
|
24
28
|
self.loaded = false
|
25
29
|
|
26
|
-
if expansion_or_html.is_a?
|
30
|
+
if expansion_or_html.is_a?(String)
|
27
31
|
@page = Capybara.string(expansion_or_html)
|
32
|
+
yield self if block_given?
|
28
33
|
else
|
29
34
|
expanded_url = url(expansion_or_html)
|
30
35
|
raise SitePrism::NoUrlForPage if expanded_url.nil?
|
31
36
|
visit expanded_url
|
37
|
+
when_loaded(&block) if block_given?
|
32
38
|
end
|
33
|
-
|
34
|
-
when_loaded(&block) if block_given?
|
35
39
|
end
|
36
40
|
|
37
41
|
def displayed?(*args)
|
data/lib/site_prism/section.rb
CHANGED
data/lib/site_prism/version.rb
CHANGED
data/lib/site_prism/waiter.rb
CHANGED
metadata
CHANGED
@@ -1,51 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_prism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: '2.10'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Ritmeyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: addressable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
20
|
-
|
19
|
+
version: '2.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
21
25
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
26
|
+
version: '2.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: capybara
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.3'
|
23
34
|
type: :runtime
|
24
35
|
prerelease: false
|
25
36
|
version_requirements: !ruby/object:Gem::Requirement
|
26
37
|
requirements:
|
27
|
-
- -
|
38
|
+
- - ~>
|
28
39
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
30
|
-
|
40
|
+
version: '2.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cucumber
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
31
46
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
47
|
+
version: 2.4.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.4.0
|
33
55
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
56
|
+
name: rake
|
35
57
|
requirement: !ruby/object:Gem::Requirement
|
36
58
|
requirements:
|
37
59
|
- - ~>
|
38
60
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
type: :
|
61
|
+
version: '11.0'
|
62
|
+
type: :development
|
41
63
|
prerelease: false
|
42
64
|
version_requirements: !ruby/object:Gem::Requirement
|
43
65
|
requirements:
|
44
66
|
- - ~>
|
45
67
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
68
|
+
version: '11.0'
|
47
69
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
70
|
+
name: redcarpet
|
49
71
|
requirement: !ruby/object:Gem::Requirement
|
50
72
|
requirements:
|
51
73
|
- - ~>
|
@@ -58,6 +80,76 @@ dependencies:
|
|
58
80
|
- - ~>
|
59
81
|
- !ruby/object:Gem::Version
|
60
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.50.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.50.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: selenium-webdriver
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.4.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.4.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.10'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
61
153
|
description: SitePrism gives you a simple, clean and semantic DSL for describing your
|
62
154
|
site using the Page Object Model pattern, for use with Capybara
|
63
155
|
email: nat@natontesting.com
|
@@ -65,7 +157,7 @@ executables: []
|
|
65
157
|
extensions: []
|
66
158
|
extra_rdoc_files: []
|
67
159
|
files:
|
68
|
-
- LICENSE
|
160
|
+
- LICENSE.md
|
69
161
|
- README.md
|
70
162
|
- lib/site_prism.rb
|
71
163
|
- lib/site_prism/addressable_url_matcher.rb
|
@@ -89,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
181
|
requirements:
|
90
182
|
- - '>='
|
91
183
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
184
|
+
version: '2.0'
|
93
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
186
|
requirements:
|
95
187
|
- - '>='
|