site_prism 3.3 → 3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +145 -50
- data/lib/site_prism.rb +15 -2
- data/lib/site_prism/addressable_url_matcher.rb +1 -1
- data/lib/site_prism/dsl.rb +48 -21
- data/lib/site_prism/element_checker.rb +13 -1
- data/lib/site_prism/error.rb +0 -8
- data/lib/site_prism/page.rb +4 -33
- data/lib/site_prism/recursion_checker.rb +1 -1
- data/lib/site_prism/rspec_matchers.rb +50 -0
- data/lib/site_prism/section.rb +6 -22
- data/lib/site_prism/timer.rb +47 -0
- data/lib/site_prism/version.rb +1 -1
- data/lib/site_prism/waiter.rb +7 -20
- metadata +82 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ec5104247e3512bd7ebf0a48c579cc92041ef21b9c130531ef0cb4ff5a52f88
|
4
|
+
data.tar.gz: a44ff822766bb37ff023048349037c0467ae47333d4b421bc53d8a59cb2af087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6991ecd0110bb53533fb848c40753a13067aed17913f2dd261a5d0b4c8c1747f9f54d1be83d954856037e6cbd24abd665d498b74ff0ad835ab1bea1e0a084a
|
7
|
+
data.tar.gz: bcfe1f63bcaf2b20c64241c03b1c9c718628609fa0bdaa67c01a78b02964b809135aa815e6b0073d4272235226eda5ad802b8b6852d8b118d0806d96e09e2068
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SitePrism
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/site_prism.svg)](https://badge.fury.io/rb/site_prism)
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/site-prism/site_prism.png)](https://travis-ci.com/site-prism/site_prism)
|
4
4
|
|
5
5
|
_A Page Object Model DSL for Capybara_
|
6
6
|
|
@@ -9,19 +9,19 @@ for use with Capybara in automated acceptance testing.
|
|
9
9
|
|
10
10
|
Find the pretty documentation here: http://rdoc.info/gems/site_prism/frames
|
11
11
|
|
12
|
-
Make sure to add your project/company to https://github.com/
|
12
|
+
Make sure to add your project/company to https://github.com/site-prism/site_prism/wiki/Who-is-using-SitePrism
|
13
13
|
|
14
14
|
## Developing / Contributing to SitePrism
|
15
15
|
|
16
16
|
We love it when people want to get involved with our Open Source Project.
|
17
17
|
|
18
|
-
We have a brief set of setup docs [HERE](https://github.com/site-prism/site_prism/blob/master/
|
18
|
+
We have a brief set of setup docs [HERE](https://github.com/site-prism/site_prism/blob/master/HACKING.md)
|
19
19
|
|
20
20
|
## Supported Rubies / Browsers
|
21
21
|
|
22
22
|
SitePrism is built and tested to work on Ruby 2.4 - 2.6. Ruby 2.3 (Now EOL), is supported but not tested against.
|
23
23
|
If you are using SitePrism with Ruby 2.3 it is highly advisable to upgrade to a more modern Ruby
|
24
|
-
such as 2.
|
24
|
+
such as 2.6 or 2.7, if for any other reason, to get a noticeable speed boost!
|
25
25
|
|
26
26
|
SitePrism should run on all major browsers. The gem's integration tests are ran on Chrome and Firefox.
|
27
27
|
|
@@ -42,14 +42,14 @@ class Home < SitePrism::Page
|
|
42
42
|
element :search_field, 'input[name="q"]'
|
43
43
|
element :search_button, 'button[name="btnK"]'
|
44
44
|
elements :footer_links, '#footer a'
|
45
|
-
section :menu,
|
45
|
+
section :menu, Menu, '#gbx3'
|
46
46
|
end
|
47
47
|
|
48
48
|
class SearchResults < SitePrism::Page
|
49
49
|
set_url_matcher(/google.com\/results\?.*/)
|
50
50
|
|
51
|
-
section :menu,
|
52
|
-
sections :search_results,
|
51
|
+
section :menu, Menu, '#gbx3'
|
52
|
+
sections :search_results, SearchResults, '#results li'
|
53
53
|
|
54
54
|
def search_result_links
|
55
55
|
search_results.map { |result| result.title['href'] }
|
@@ -58,13 +58,13 @@ end
|
|
58
58
|
|
59
59
|
# define sections used on multiple pages or multiple times on one page
|
60
60
|
|
61
|
-
class
|
61
|
+
class Menu < SitePrism::Section
|
62
62
|
element :search, 'a.search'
|
63
63
|
element :images, 'a.image-search'
|
64
64
|
element :maps, 'a.map-search'
|
65
65
|
end
|
66
66
|
|
67
|
-
class
|
67
|
+
class SearchResults < SitePrism::Section
|
68
68
|
element :title, 'a.title'
|
69
69
|
element :blurb, 'span.result-description'
|
70
70
|
end
|
@@ -124,6 +124,22 @@ require 'capybara'
|
|
124
124
|
require 'capybara/cucumber'
|
125
125
|
require 'selenium-webdriver'
|
126
126
|
require 'site_prism'
|
127
|
+
require 'site_prism/all_there' # Optional but needed to perform more complex matching
|
128
|
+
```
|
129
|
+
|
130
|
+
The driver creation is identical to how you would normally create a Capybara driver,
|
131
|
+
a sample Selenium one could look something like this...
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
Capybara.register_driver :site_prism do |app|
|
135
|
+
browser = ENV.fetch('browser', 'firefox').to_sym
|
136
|
+
Capybara::Selenium::Driver.new(app, browser: browser, desired_capabilities: capabilities)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Then tell Capybara to use the Driver you've just defined as its default driver
|
140
|
+
Capybara.configure do |config|
|
141
|
+
config.default_driver = :site_prism
|
142
|
+
end
|
127
143
|
```
|
128
144
|
|
129
145
|
### Using SitePrism with RSpec
|
@@ -135,8 +151,11 @@ require 'capybara'
|
|
135
151
|
require 'capybara/rspec'
|
136
152
|
require 'selenium-webdriver'
|
137
153
|
require 'site_prism'
|
154
|
+
require 'site_prism/all_there' # Optional but needed to perform more complex matching
|
138
155
|
```
|
139
156
|
|
157
|
+
And again, as above, a sample driver is no different to a normal driver instantiation in Capybara.
|
158
|
+
|
140
159
|
## Introduction to the Page Object Model
|
141
160
|
|
142
161
|
The Page Object Model is a test automation pattern that aims to create
|
@@ -158,7 +177,7 @@ multiple pages, or many times on a page using the concept of sections.
|
|
158
177
|
As you might be able to guess from the name, pages are fairly central to
|
159
178
|
the Page Object Model. Here's how SitePrism models them:
|
160
179
|
|
161
|
-
### Creating
|
180
|
+
### Creating your first Page using the Page Object Model
|
162
181
|
|
163
182
|
The simplest page is one that has nothing defined in it. Here's an
|
164
183
|
example of how to begin modelling a home page:
|
@@ -168,7 +187,7 @@ class Home < SitePrism::Page
|
|
168
187
|
end
|
169
188
|
```
|
170
189
|
|
171
|
-
The above has nothing useful defined,
|
190
|
+
The above has nothing useful defined, so to start with lets give it some properties.
|
172
191
|
|
173
192
|
### Adding a URL
|
174
193
|
|
@@ -177,7 +196,7 @@ you'll need to set its URL. Here's how:
|
|
177
196
|
|
178
197
|
```ruby
|
179
198
|
class Home < SitePrism::Page
|
180
|
-
set_url 'http://www.
|
199
|
+
set_url 'http://www.mysite.com/home.htm'
|
181
200
|
end
|
182
201
|
```
|
183
202
|
|
@@ -332,7 +351,7 @@ end
|
|
332
351
|
SitePrism's `#displayed?` predicate method allows for semantic code in your tests:
|
333
352
|
|
334
353
|
```ruby
|
335
|
-
Then
|
354
|
+
Then(/^the account page is displayed$/) do
|
336
355
|
expect(@account_page).to be_displayed
|
337
356
|
expect(@some_other_page).not_to be_displayed
|
338
357
|
end
|
@@ -431,7 +450,7 @@ end
|
|
431
450
|
#### Testing for the existence of the element
|
432
451
|
|
433
452
|
Another method added to the Page class by the `element` method is the
|
434
|
-
`has_<
|
453
|
+
`has_<element_name>?` method. Using the same example as above:
|
435
454
|
|
436
455
|
```ruby
|
437
456
|
class Home < SitePrism::Page
|
@@ -452,7 +471,7 @@ end
|
|
452
471
|
...which makes for nice test code:
|
453
472
|
|
454
473
|
```ruby
|
455
|
-
Then
|
474
|
+
Then(/^the search field exists$/) do
|
456
475
|
expect(@home).to have_search_field
|
457
476
|
end
|
458
477
|
```
|
@@ -472,14 +491,14 @@ that should be used to test for non-existence. Using the above example:
|
|
472
491
|
...which makes for nice test code:
|
473
492
|
|
474
493
|
```ruby
|
475
|
-
Then
|
494
|
+
Then(/^the search field exists$/)do
|
476
495
|
expect(@home).to have_no_search_field #NB: NOT => expect(@home).not_to have_search_field
|
477
496
|
end
|
478
497
|
```
|
479
498
|
|
480
499
|
#### Waiting for an element to become visible
|
481
500
|
|
482
|
-
A method that gets added by calling `element` is the
|
501
|
+
A method that gets added by calling `element` is the
|
483
502
|
`wait_until_<element_name>_visible` method. Calling this method will
|
484
503
|
cause the test to wait for Capybara's default wait time for the element
|
485
504
|
to become visible. You can customise the wait time by supplying a number
|
@@ -619,7 +638,7 @@ Then the following method is available:
|
|
619
638
|
This in turn allows the following nice test code
|
620
639
|
|
621
640
|
```ruby
|
622
|
-
Then
|
641
|
+
Then(/^there should be some names listed on the page$/) do
|
623
642
|
expect(@friends_page).to have_names #=> This only passes if there is at least one `name`
|
624
643
|
end
|
625
644
|
```
|
@@ -660,7 +679,7 @@ are present in the browser and `false` if they're not all there.
|
|
660
679
|
|
661
680
|
# and...
|
662
681
|
|
663
|
-
Then
|
682
|
+
Then(/^the friends page contains all the expected elements$/) do
|
664
683
|
expect(@friends_page).to be_all_there
|
665
684
|
end
|
666
685
|
```
|
@@ -695,6 +714,50 @@ end
|
|
695
714
|
@test_page.elements_present #=> [:address_field]
|
696
715
|
```
|
697
716
|
|
717
|
+
If you are specifying a highly nested set of sections inside a Page and need to recurse
|
718
|
+
through them to find out if all of your items are present then you can also do this.
|
719
|
+
|
720
|
+
Simply pass a recursion parameter to the `#all_there?` check. Note that the only valid values
|
721
|
+
for this at the moment are `:none` and `:one`
|
722
|
+
|
723
|
+
Passing `:none` (default), will not change the functionality. However passing in `:one` will cause
|
724
|
+
`site_prism` to recurse through all `section` / `sections` items defined in your present scope.
|
725
|
+
|
726
|
+
Work alongside developing this functionality further is being continued in the
|
727
|
+
[site_prism-all_there](http://www.github.com/site-prism/site_prism-all_there) repo. So head on over
|
728
|
+
there if you're interested in how this feature will work going forwards
|
729
|
+
|
730
|
+
NB: At the moment a "primitive" but working copy of this is hosted inside this gem. But if you wish to
|
731
|
+
use the bleeding edge version of the logic. Then simply set the following configuration parameter
|
732
|
+
|
733
|
+
```ruby
|
734
|
+
`require 'site_prism/all_there'`
|
735
|
+
|
736
|
+
SitePrism.use_all_there_gem = true
|
737
|
+
```
|
738
|
+
|
739
|
+
### Getting the list of missing elements
|
740
|
+
|
741
|
+
If `#all_there?` returns false and you wish to get the list of missing elements for debugging purposes
|
742
|
+
you may want to use `#elements_missing` method. It will return all missing elements from the expected_elements list
|
743
|
+
|
744
|
+
If you do not provide a list of `expected_elements` this method will return all elements that are missing on the page;
|
745
|
+
from those which are defined.
|
746
|
+
|
747
|
+
```ruby
|
748
|
+
class Home < SitePrism::Page
|
749
|
+
element :name, '#name'
|
750
|
+
element :address, '#address'
|
751
|
+
element :success_message, 'span.alert-success'
|
752
|
+
|
753
|
+
expected_elements :name, :address
|
754
|
+
end
|
755
|
+
|
756
|
+
# and... Only `address` is on the page
|
757
|
+
|
758
|
+
@test_page.elements_missing #=> [:name]
|
759
|
+
```
|
760
|
+
|
698
761
|
## Sections
|
699
762
|
|
700
763
|
SitePrism allows you to model sections of a page that appear on multiple
|
@@ -750,7 +813,7 @@ class People < SitePrism::Section
|
|
750
813
|
element :footer, 'h4'
|
751
814
|
end
|
752
815
|
|
753
|
-
class
|
816
|
+
class Home < SitePrism::Page
|
754
817
|
# section people_with_block will have `headline` and
|
755
818
|
# `footer` elements in it
|
756
819
|
section :people_with_block, People do
|
@@ -870,7 +933,7 @@ end
|
|
870
933
|
This then leads to some pretty test code ...
|
871
934
|
|
872
935
|
```ruby
|
873
|
-
Then
|
936
|
+
Then(/^the home page menu contains a link to the various search functions$/) do
|
874
937
|
expect(@home.menu).to have_search
|
875
938
|
expect(@home.menu.search['href']).to include('google.com')
|
876
939
|
expect(@home.menu).to have_images
|
@@ -880,14 +943,13 @@ end
|
|
880
943
|
|
881
944
|
##### Accessing section elements using a block
|
882
945
|
|
883
|
-
|
946
|
+
You can execute a block within the context of a Section. This is
|
884
947
|
similar to Capybara's `within` method and allows for shorter test code
|
885
|
-
particularly with nested sections.
|
886
|
-
made a little prettier by simply passing a block in.
|
948
|
+
particularly with nested sections. Test code that might have to repeat the block name can be shortened up this way.
|
887
949
|
|
888
950
|
```ruby
|
889
|
-
Then
|
890
|
-
@home.menu do |menu|
|
951
|
+
Then(/^the home page menu contains a link to the various search functions$/) do
|
952
|
+
@home.menu.within do |menu|
|
891
953
|
expect(menu).to have_search
|
892
954
|
expect(menu.search['href']).to include('google.com')
|
893
955
|
expect(menu).to have_images
|
@@ -896,33 +958,43 @@ Then /^the home page menu contains a link to the various search functions$/ do
|
|
896
958
|
end
|
897
959
|
```
|
898
960
|
|
961
|
+
Note that on an individual section it's possible to pass a block directly to the section without using `within`. Because the block is executed only during `Section` initialization this won't work when accessing a single Section from an array of Sections. For that reason we recommend using `within` which works in either case.
|
962
|
+
|
963
|
+
```ruby
|
964
|
+
Then(/^the home page menu contains a link to the various search functions$/) do
|
965
|
+
@home.menu do |menu| # possible, but prefer: `@home.menu.within`
|
966
|
+
expect(menu).to have_search
|
967
|
+
end
|
968
|
+
end
|
969
|
+
```
|
970
|
+
|
899
971
|
#### Getting a section's parent
|
900
972
|
|
901
973
|
It is possible to ask a section for its parent (page, or section if this
|
902
974
|
section is a subsection). For example, given the following setup:
|
903
975
|
|
904
976
|
```ruby
|
905
|
-
class
|
906
|
-
element :
|
977
|
+
class DestinationFilters < SitePrism::Section
|
978
|
+
element :morocco, 'abc'
|
907
979
|
end
|
908
980
|
|
909
|
-
class
|
910
|
-
section :
|
981
|
+
class FilterPanel < SitePrism::Section
|
982
|
+
section :destination_filters, DestinationFilters, 'def'
|
911
983
|
end
|
912
984
|
|
913
|
-
class
|
914
|
-
section :
|
985
|
+
class Home < SitePrism::Page
|
986
|
+
section :filter_panel, FilterPanel, 'ghi'
|
915
987
|
end
|
916
988
|
```
|
917
989
|
|
918
990
|
Then calling `#parent` will return the following:
|
919
991
|
|
920
992
|
```ruby
|
921
|
-
@
|
922
|
-
@
|
993
|
+
@home = Home.new
|
994
|
+
@home.load
|
923
995
|
|
924
|
-
@
|
925
|
-
@
|
996
|
+
@home.filter_panel.parent #=> returns @home
|
997
|
+
@home.filter_panel.destination_filters.parent #=> returns @home.filter_panel
|
926
998
|
```
|
927
999
|
|
928
1000
|
#### Getting a section's parent page
|
@@ -1043,7 +1115,7 @@ end
|
|
1043
1115
|
|
1044
1116
|
# how to login (fatuous, but demonstrates the point):
|
1045
1117
|
|
1046
|
-
Then
|
1118
|
+
Then(/^I sign in$/) do
|
1047
1119
|
@home = Home.new
|
1048
1120
|
@home.load
|
1049
1121
|
expect(@home).to have_login_and_registration
|
@@ -1055,7 +1127,7 @@ end
|
|
1055
1127
|
|
1056
1128
|
# how to sign up:
|
1057
1129
|
|
1058
|
-
When
|
1130
|
+
When(/^I enter my name into the home page's registration form$/) do
|
1059
1131
|
@home = Home.new
|
1060
1132
|
@home.load
|
1061
1133
|
expect(@home.login_and_registration).to have_first_name
|
@@ -1132,9 +1204,9 @@ end
|
|
1132
1204
|
This allows for pretty tests ...
|
1133
1205
|
|
1134
1206
|
```ruby
|
1135
|
-
Then
|
1207
|
+
Then(/^there are lots of search_results$/) do
|
1136
1208
|
expect(@results_page.search_results.size).to eq(10)
|
1137
|
-
|
1209
|
+
|
1138
1210
|
@home.search_results.each do |result|
|
1139
1211
|
expect(result).to have_title
|
1140
1212
|
expect(result.blurb.text).not_to be_empty
|
@@ -1143,13 +1215,33 @@ end
|
|
1143
1215
|
```
|
1144
1216
|
|
1145
1217
|
The css selector that is passed as the 3rd argument to the
|
1146
|
-
`sections` method (
|
1218
|
+
`sections` method (`#results li`) is used to find a number of capybara
|
1147
1219
|
elements. Each capybara element found using the css selector is used to
|
1148
1220
|
create a new instance of `SearchResults` and becomes its root
|
1149
1221
|
element. So if the css selector finds 3 `li` elements, calling
|
1150
1222
|
`search_results` will return an array containing 3 instances of
|
1151
1223
|
`SearchResults`, each with one of the `li` elements as it's root element.
|
1152
1224
|
|
1225
|
+
##### Accessing Within a Collection of Sections
|
1226
|
+
|
1227
|
+
When using an iterator such as `each` to pass a block through to a collection of sections it is possible to skip using `within`. However some caution is warranted when accessing the Sections directly from an array, as the block can only be executed when the section is being initialized. The following does not work:
|
1228
|
+
|
1229
|
+
```rb
|
1230
|
+
@home.search_results.first do |result|
|
1231
|
+
# This block is silently ignored.
|
1232
|
+
expect(result).to have_title
|
1233
|
+
end
|
1234
|
+
```
|
1235
|
+
Instead use `within` to access the inner-context of the Section.
|
1236
|
+
|
1237
|
+
```rb
|
1238
|
+
@home.search_results.first.within do |result|
|
1239
|
+
# This block is run within the context of the Section.
|
1240
|
+
expect(result).to have_title
|
1241
|
+
end
|
1242
|
+
```
|
1243
|
+
|
1244
|
+
|
1153
1245
|
#### Anonymous Section Collections
|
1154
1246
|
|
1155
1247
|
You can define collections of anonymous sections the same way you would
|
@@ -1196,7 +1288,7 @@ Here's how to test for the existence of the section:
|
|
1196
1288
|
This allows for some pretty tests ...
|
1197
1289
|
|
1198
1290
|
```ruby
|
1199
|
-
Then
|
1291
|
+
Then(/^there are search results on the page$/) do
|
1200
1292
|
expect(@home).to have_search_results
|
1201
1293
|
end
|
1202
1294
|
```
|
@@ -1346,7 +1438,7 @@ instance of the class when created.
|
|
1346
1438
|
|
1347
1439
|
### Skipping load Validations
|
1348
1440
|
|
1349
|
-
Defined load validations can be skipped for one `load` call by
|
1441
|
+
Defined load validations can be skipped for one `load` call by
|
1350
1442
|
passing in `with_validations: false`.
|
1351
1443
|
|
1352
1444
|
```ruby
|
@@ -1397,7 +1489,7 @@ the validations will be performed in the following order:
|
|
1397
1489
|
**NB:** `SitePrism::Page` **used to** include a default load validation on
|
1398
1490
|
`page.displayed?` however for v3 this has been removed. It is therefore
|
1399
1491
|
necessary to re-define this if you want to retain the behaviour
|
1400
|
-
from site_prism v2. See [UPGRADING.md](https://github.com/
|
1492
|
+
from site_prism v2. See [UPGRADING.md](https://github.com/site-prism/site_prism/blob/master/UPGRADING.md#default-load-validations)
|
1401
1493
|
for more info on this.
|
1402
1494
|
|
1403
1495
|
## Using Capybara Query Options
|
@@ -1447,7 +1539,7 @@ Now we can write pretty, non-failing tests without hard coding these options
|
|
1447
1539
|
into our page and section classes:
|
1448
1540
|
|
1449
1541
|
```ruby
|
1450
|
-
Then
|
1542
|
+
Then(/^there are search results on the page$/) do
|
1451
1543
|
expect(@results_page).to have_search_results(count: 25)
|
1452
1544
|
end
|
1453
1545
|
```
|
@@ -1580,7 +1672,7 @@ class Home < SitePrism::Page
|
|
1580
1672
|
end
|
1581
1673
|
|
1582
1674
|
# cucumber step that performs login
|
1583
|
-
When
|
1675
|
+
When(/^I log in$/) do
|
1584
1676
|
@home = Home.new
|
1585
1677
|
@home.load
|
1586
1678
|
|
@@ -1611,14 +1703,14 @@ as per the code below
|
|
1611
1703
|
|
1612
1704
|
```ruby
|
1613
1705
|
Capybara.configure do |config|
|
1614
|
-
config.default_max_wait_time = 11 #=> Wait up to 11 seconds for all
|
1615
|
-
# or
|
1616
|
-
config.default_max_wait_time = 0 #=> Don't ever wait!
|
1706
|
+
config.default_max_wait_time = 11 #=> Wait up to 11 seconds for all queries to fail
|
1707
|
+
# or if you don't want to ever wait
|
1708
|
+
config.default_max_wait_time = 0 #=> Don't ever wait!
|
1617
1709
|
end
|
1618
1710
|
```
|
1619
1711
|
|
1620
1712
|
Note that even with implicit waits on you can dynamically modify the wait times
|
1621
|
-
in any SitePrism method to help work-around special circumstances.
|
1713
|
+
in any SitePrism method to help work-around special circumstances.
|
1622
1714
|
|
1623
1715
|
```ruby
|
1624
1716
|
# Option 1: using wait key assignment
|
@@ -1635,6 +1727,9 @@ end
|
|
1635
1727
|
There's a SitePrism plugin called `site_prism.vcr` that lets you use
|
1636
1728
|
SitePrism with the VCR gem. Check it out [HERE](https://github.com/dnesteryuk/site_prism.vcr)
|
1637
1729
|
|
1730
|
+
Note that as of 2016 this plugin doesn't appear to have been under active development. Also it is
|
1731
|
+
still pinned to the `2.x` series of site_prism so use it of your own accord.
|
1732
|
+
|
1638
1733
|
# Epilogue
|
1639
1734
|
|
1640
1735
|
So, we've seen how to use SitePrism to put together page objects made up
|
data/lib/site_prism.rb
CHANGED
@@ -5,16 +5,21 @@ require 'addressable/template'
|
|
5
5
|
|
6
6
|
module SitePrism
|
7
7
|
autoload :AddressableUrlMatcher, 'site_prism/addressable_url_matcher'
|
8
|
-
autoload :Deprecator, 'site_prism/deprecator'
|
9
8
|
autoload :DSL, 'site_prism/dsl'
|
9
|
+
autoload :Deprecator, 'site_prism/deprecator'
|
10
10
|
autoload :ElementChecker, 'site_prism/element_checker'
|
11
|
-
autoload :
|
11
|
+
autoload :Loadable, 'site_prism/loadable'
|
12
12
|
autoload :Logger, 'site_prism/logger'
|
13
13
|
autoload :Page, 'site_prism/page'
|
14
|
+
autoload :RecursionChecker, 'site_prism/recursion_checker'
|
15
|
+
autoload :RspecMatchers, 'site_prism/rspec_matchers'
|
14
16
|
autoload :Section, 'site_prism/section'
|
17
|
+
autoload :Timer, 'site_prism/timer'
|
15
18
|
autoload :Waiter, 'site_prism/waiter'
|
16
19
|
|
17
20
|
class << self
|
21
|
+
attr_reader :use_all_there_gem
|
22
|
+
|
18
23
|
def configure
|
19
24
|
yield self
|
20
25
|
end
|
@@ -65,5 +70,13 @@ module SitePrism
|
|
65
70
|
def log_level
|
66
71
|
%i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]
|
67
72
|
end
|
73
|
+
|
74
|
+
# Whether you wish to use the new experimental all_there dependent gem
|
75
|
+
# This will be enforced from site_prism v4 onwards as this is where
|
76
|
+
# the development of this functionality will be focused
|
77
|
+
def use_all_there_gem=(value)
|
78
|
+
logger.debug("Setting use_all_there_gem to #{value}")
|
79
|
+
@use_all_there_gem = value
|
80
|
+
end
|
68
81
|
end
|
69
82
|
end
|
@@ -98,7 +98,7 @@ module SitePrism
|
|
98
98
|
begin
|
99
99
|
Addressable::URI.parse(url)
|
100
100
|
rescue Addressable::URI::InvalidURIError
|
101
|
-
SitePrism.logger.
|
101
|
+
SitePrism.logger.fatal("Ensure you don't use templated port numbers.")
|
102
102
|
raise SitePrism::InvalidUrlMatcherError
|
103
103
|
end
|
104
104
|
end
|
data/lib/site_prism/dsl.rb
CHANGED
@@ -8,6 +8,30 @@ module SitePrism
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
+
# Call `find` inside context set on page/section
|
12
|
+
def _find(*find_args)
|
13
|
+
kwargs = find_args.pop
|
14
|
+
page.find(*find_args, **kwargs)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Call `all` inside context set on page/section
|
18
|
+
def _all(*find_args)
|
19
|
+
kwargs = find_args.pop
|
20
|
+
page.all(*find_args, **kwargs)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Call `has_selector?` inside context set on page/section
|
24
|
+
def element_exists?(*find_args)
|
25
|
+
kwargs = find_args.pop
|
26
|
+
page.has_selector?(*find_args, **kwargs)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Call `has_no_selector?` inside context set on page/section
|
30
|
+
def element_does_not_exist?(*find_args)
|
31
|
+
kwargs = find_args.pop
|
32
|
+
page.has_no_selector?(*find_args, **kwargs)
|
33
|
+
end
|
34
|
+
|
11
35
|
# The default waiting time set by Capybara's configuration settings.
|
12
36
|
def wait_time
|
13
37
|
Capybara.default_max_wait_time
|
@@ -36,6 +60,14 @@ module SitePrism
|
|
36
60
|
raise SitePrism::UnsupportedBlockError
|
37
61
|
end
|
38
62
|
|
63
|
+
# Warn users from naming the elements starting with no_
|
64
|
+
def warn_if_dsl_collision(obj, name)
|
65
|
+
return unless name.to_s.start_with?('no_')
|
66
|
+
|
67
|
+
SitePrism.logger.warn("#{obj.class}##{name} should not start with no_")
|
68
|
+
SitePrism::Deprecator.deprecate('Using no_ prefix in DSL definition')
|
69
|
+
end
|
70
|
+
|
39
71
|
# Sanitize method called before calling any SitePrism DSL method or
|
40
72
|
# meta-programmed method. This ensures that the Capybara query is correct.
|
41
73
|
#
|
@@ -49,7 +81,7 @@ module SitePrism
|
|
49
81
|
|
50
82
|
recombine_args(find_args, runtime_args, options)
|
51
83
|
|
52
|
-
return [*find_args, *runtime_args] if options.empty?
|
84
|
+
return [*find_args, *runtime_args, {}] if options.empty?
|
53
85
|
|
54
86
|
[*find_args, *runtime_args, options]
|
55
87
|
end
|
@@ -76,8 +108,10 @@ module SitePrism
|
|
76
108
|
attr_reader :expected_items
|
77
109
|
|
78
110
|
def element(name, *find_args)
|
111
|
+
SitePrism::Deprecator.deprecate('Passing a block to :element') if block_given?
|
79
112
|
build(:element, name, *find_args) do
|
80
113
|
define_method(name) do |*runtime_args, &element_block|
|
114
|
+
warn_if_dsl_collision(self, name)
|
81
115
|
raise_if_block(self, name, !element_block.nil?, :element)
|
82
116
|
_find(*merge_args(find_args, runtime_args))
|
83
117
|
end
|
@@ -85,8 +119,10 @@ module SitePrism
|
|
85
119
|
end
|
86
120
|
|
87
121
|
def elements(name, *find_args)
|
122
|
+
SitePrism::Deprecator.deprecate('Passing a block to :elements') if block_given?
|
88
123
|
build(:elements, name, *find_args) do
|
89
124
|
define_method(name) do |*runtime_args, &element_block|
|
125
|
+
warn_if_dsl_collision(self, name)
|
90
126
|
raise_if_block(self, name, !element_block.nil?, :elements)
|
91
127
|
_all(*merge_args(find_args, runtime_args))
|
92
128
|
end
|
@@ -101,6 +137,7 @@ module SitePrism
|
|
101
137
|
section_class, find_args = extract_section_options(args, &block)
|
102
138
|
build(:section, name, *find_args) do
|
103
139
|
define_method(name) do |*runtime_args, &runtime_block|
|
140
|
+
warn_if_dsl_collision(self, name)
|
104
141
|
section_element = _find(*merge_args(find_args, runtime_args))
|
105
142
|
section_class.new(self, section_element, &runtime_block)
|
106
143
|
end
|
@@ -120,6 +157,7 @@ module SitePrism
|
|
120
157
|
end
|
121
158
|
|
122
159
|
def iframe(name, klass, *args)
|
160
|
+
SitePrism.logger.debug('Block passed into iFrame construct at build time') if block_given?
|
123
161
|
element_find_args = deduce_iframe_element_find_args(args)
|
124
162
|
scope_find_args = deduce_iframe_scope_find_args(args)
|
125
163
|
build(:iframe, name, *element_find_args) do
|
@@ -142,10 +180,11 @@ module SitePrism
|
|
142
180
|
private
|
143
181
|
|
144
182
|
def old_mapped_items
|
145
|
-
SitePrism.
|
146
|
-
|
147
|
-
|
148
|
-
|
183
|
+
SitePrism::Deprecator.soft_deprecate(
|
184
|
+
'.mapped_items on a class',
|
185
|
+
'To allow easier recursion through the items in conjunction with #all_there?',
|
186
|
+
'.mapped_items(legacy: false)'
|
187
|
+
)
|
149
188
|
@old_mapped_items ||= []
|
150
189
|
end
|
151
190
|
|
@@ -155,7 +194,7 @@ until a v5 has been released (And will be deprecated in v4 of site_prism")
|
|
155
194
|
elements: [],
|
156
195
|
section: [],
|
157
196
|
sections: [],
|
158
|
-
iframe: []
|
197
|
+
iframe: []
|
159
198
|
}
|
160
199
|
end
|
161
200
|
|
@@ -177,7 +216,7 @@ until a v5 has been released (And will be deprecated in v4 of site_prism")
|
|
177
216
|
def add_helper_methods(name, *find_args)
|
178
217
|
create_existence_checker(name, *find_args)
|
179
218
|
create_nonexistence_checker(name, *find_args)
|
180
|
-
|
219
|
+
SitePrism::RspecMatchers.new(name)._create_rspec_existence_matchers if defined?(RSpec)
|
181
220
|
create_visibility_waiter(name, *find_args)
|
182
221
|
create_invisibility_waiter(name, *find_args)
|
183
222
|
end
|
@@ -190,18 +229,6 @@ until a v5 has been released (And will be deprecated in v4 of site_prism")
|
|
190
229
|
end
|
191
230
|
end
|
192
231
|
|
193
|
-
def create_rspec_existence_matchers(element_name)
|
194
|
-
matcher = "has_#{element_name}?"
|
195
|
-
negated_matcher = "has_no_#{element_name}?"
|
196
|
-
|
197
|
-
RSpec::Matchers.define "have_#{element_name}" do |*args|
|
198
|
-
match { |actual| actual.public_send(matcher, *args) }
|
199
|
-
match_when_negated do |actual|
|
200
|
-
actual.public_send(negated_matcher, *args)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
232
|
def create_existence_checker(element_name, *find_args)
|
206
233
|
method_name = "has_#{element_name}?"
|
207
234
|
create_helper_method(method_name, *find_args) do
|
@@ -247,7 +274,7 @@ until a v5 has been released (And will be deprecated in v4 of site_prism")
|
|
247
274
|
end
|
248
275
|
|
249
276
|
def create_error_method(name)
|
250
|
-
SitePrism.logger.error("#{name} has come from an item with
|
277
|
+
SitePrism.logger.error("#{name} has come from an item with no locators.")
|
251
278
|
define_method(name) { raise SitePrism::InvalidElementError }
|
252
279
|
end
|
253
280
|
|
@@ -273,7 +300,7 @@ until a v5 has been released (And will be deprecated in v4 of site_prism")
|
|
273
300
|
return unless looks_like_xpath?(args[0])
|
274
301
|
|
275
302
|
SitePrism.logger.warn('The arguments passed in look like xpath. Check your locators.')
|
276
|
-
SitePrism.logger.debug("Default locator: #{Capybara.default_selector}")
|
303
|
+
SitePrism.logger.debug("Default locator strategy: #{Capybara.default_selector}")
|
277
304
|
end
|
278
305
|
|
279
306
|
def looks_like_xpath?(arg)
|
@@ -24,7 +24,7 @@ module SitePrism
|
|
24
24
|
if recursion == :none
|
25
25
|
elements_to_check.all? { |name| there?(name) }
|
26
26
|
elsif recursion == :one
|
27
|
-
|
27
|
+
all_there_with_recursion
|
28
28
|
else
|
29
29
|
SitePrism.logger.debug("Input value '#{recursion}'. Valid values are :none or :one.")
|
30
30
|
SitePrism.logger.error('Invalid recursion setting, Will not run #all_there?.')
|
@@ -35,8 +35,20 @@ module SitePrism
|
|
35
35
|
_mapped_items.select { |name| there?(name) }
|
36
36
|
end
|
37
37
|
|
38
|
+
def elements_missing
|
39
|
+
elements_to_check.reject { |name| there?(name) }
|
40
|
+
end
|
41
|
+
|
38
42
|
private
|
39
43
|
|
44
|
+
def all_there_with_recursion
|
45
|
+
if SitePrism.use_all_there_gem
|
46
|
+
SitePrism::AllThere::RecursionChecker.new(self).all_there?
|
47
|
+
else
|
48
|
+
RecursionChecker.new(self).all_there?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
40
52
|
# If the page or section has expected_items set, return expected_items that are mapped
|
41
53
|
# otherwise just return the list of all mapped_items
|
42
54
|
def elements_to_check
|
data/lib/site_prism/error.rb
CHANGED
@@ -25,14 +25,6 @@ module SitePrism
|
|
25
25
|
# Formerly known as `NoSelectorForElement`
|
26
26
|
class InvalidElementError < SitePrismError; end
|
27
27
|
|
28
|
-
# A tool like Timecop is being used to "freeze time" by overriding Time.now
|
29
|
-
# and similar methods. In this case, our waiter functions won't work, because
|
30
|
-
# Time.now does not change.
|
31
|
-
# If you encounter this issue, check that you are not doing Timecop.freeze without
|
32
|
-
# an accompanying Timecop.return.
|
33
|
-
# Also check out Timecop.safe_mode https://github.com/travisjeffery/timecop#timecopsafe_mode
|
34
|
-
class FrozenInTimeError < SitePrismError; end
|
35
|
-
|
36
28
|
# The condition that was being evaluated inside the block did not evaluate
|
37
29
|
# to true within the time limit
|
38
30
|
# Formerly known as `TimeoutException`
|
data/lib/site_prism/page.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'site_prism/loadable'
|
4
|
-
|
5
3
|
module SitePrism
|
6
|
-
# rubocop:disable Metrics/ClassLength
|
7
4
|
class Page
|
8
5
|
include Capybara::DSL
|
9
6
|
include ElementChecker
|
@@ -27,11 +24,7 @@ module SitePrism
|
|
27
24
|
end
|
28
25
|
|
29
26
|
def page
|
30
|
-
|
31
|
-
@page
|
32
|
-
else
|
33
|
-
Capybara.current_session
|
34
|
-
end
|
27
|
+
(defined?(@page) && @page) || Capybara.current_session
|
35
28
|
end
|
36
29
|
|
37
30
|
# Loads the page.
|
@@ -79,18 +72,13 @@ module SitePrism
|
|
79
72
|
|
80
73
|
def url_matches(seconds = wait_time)
|
81
74
|
return unless displayed?(seconds)
|
75
|
+
return regexp_backed_matches if url_matcher.is_a?(Regexp)
|
82
76
|
|
83
|
-
|
84
|
-
regexp_backed_matches
|
85
|
-
else
|
86
|
-
template_backed_matches
|
87
|
-
end
|
77
|
+
template_backed_matches
|
88
78
|
end
|
89
79
|
|
90
80
|
def url(expansion = {})
|
91
|
-
|
92
|
-
|
93
|
-
Addressable::Template.new(self.class.url).expand(expansion).to_s
|
81
|
+
self.class.url && Addressable::Template.new(self.class.url).expand(expansion).to_s
|
94
82
|
end
|
95
83
|
|
96
84
|
def url_matcher
|
@@ -103,22 +91,6 @@ module SitePrism
|
|
103
91
|
|
104
92
|
private
|
105
93
|
|
106
|
-
def _find(*find_args)
|
107
|
-
page.find(*find_args)
|
108
|
-
end
|
109
|
-
|
110
|
-
def _all(*find_args)
|
111
|
-
page.all(*find_args)
|
112
|
-
end
|
113
|
-
|
114
|
-
def element_exists?(*find_args)
|
115
|
-
page.has_selector?(*find_args)
|
116
|
-
end
|
117
|
-
|
118
|
-
def element_does_not_exist?(*find_args)
|
119
|
-
page.has_no_selector?(*find_args)
|
120
|
-
end
|
121
|
-
|
122
94
|
def regexp_backed_matches
|
123
95
|
url_matcher.match(page.current_url)
|
124
96
|
end
|
@@ -167,5 +139,4 @@ module SitePrism
|
|
167
139
|
end
|
168
140
|
end
|
169
141
|
end
|
170
|
-
# rubocop:enable Metrics/ClassLength
|
171
142
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SitePrism
|
4
|
+
class RspecMatchers
|
5
|
+
attr_reader :element_name
|
6
|
+
|
7
|
+
def initialize(element_name)
|
8
|
+
@element_name = element_name
|
9
|
+
end
|
10
|
+
|
11
|
+
def _create_rspec_existence_matchers
|
12
|
+
SitePrism.logger.debug('Including all relevant matcher names / warnings in RSpec scope.')
|
13
|
+
create_rspec_existence_matchers(matcher, object_method, negated_object_method, warning)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def create_rspec_existence_matchers(matcher, object_method, negated_object_method, warning)
|
19
|
+
RSpec::Matchers.define(matcher) do |*args|
|
20
|
+
match { |actual| actual.public_send(object_method, *args) }
|
21
|
+
match_when_negated do |actual|
|
22
|
+
if actual.respond_to?(negated_object_method)
|
23
|
+
return actual.public_send(negated_object_method, *args)
|
24
|
+
end
|
25
|
+
|
26
|
+
SitePrism.logger.debug(warning)
|
27
|
+
!actual.public_send(object_method, *args)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def matcher
|
33
|
+
"have_#{element_name}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def object_method
|
37
|
+
"has_#{element_name}?"
|
38
|
+
end
|
39
|
+
|
40
|
+
def negated_object_method
|
41
|
+
"has_no_#{element_name}?"
|
42
|
+
end
|
43
|
+
|
44
|
+
def warning
|
45
|
+
"The RSpec matcher '#{matcher}' was added by SitePrism, but the object under test "\
|
46
|
+
"does not respond to '#{negated_object_method}' and is probably not a SitePrism object. "\
|
47
|
+
'Falling back to the default RSpec matcher.'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/site_prism/section.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'site_prism/loadable'
|
4
|
-
|
5
3
|
module SitePrism
|
6
4
|
class Section
|
7
5
|
include Capybara::DSL
|
@@ -25,10 +23,14 @@ module SitePrism
|
|
25
23
|
nil
|
26
24
|
end
|
27
25
|
|
28
|
-
def initialize(parent, root_element)
|
26
|
+
def initialize(parent, root_element, &block)
|
29
27
|
@parent = parent
|
30
28
|
@root_element = root_element
|
31
|
-
|
29
|
+
within(&block) if block_given?
|
30
|
+
end
|
31
|
+
|
32
|
+
def within
|
33
|
+
Capybara.within(@root_element) { yield(self) }
|
32
34
|
end
|
33
35
|
|
34
36
|
# Capybara::DSL module "delegates" Capybara methods to the "page" method
|
@@ -64,23 +66,5 @@ module SitePrism
|
|
64
66
|
def native
|
65
67
|
root_element.native
|
66
68
|
end
|
67
|
-
|
68
|
-
private
|
69
|
-
|
70
|
-
def _find(*find_args)
|
71
|
-
page.find(*find_args)
|
72
|
-
end
|
73
|
-
|
74
|
-
def _all(*find_args)
|
75
|
-
page.all(*find_args)
|
76
|
-
end
|
77
|
-
|
78
|
-
def element_exists?(*find_args)
|
79
|
-
page.has_selector?(*find_args)
|
80
|
-
end
|
81
|
-
|
82
|
-
def element_does_not_exist?(*find_args)
|
83
|
-
page.has_no_selector?(*find_args)
|
84
|
-
end
|
85
69
|
end
|
86
70
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SitePrism
|
4
|
+
class Timer
|
5
|
+
attr_reader :wait_time
|
6
|
+
|
7
|
+
def self.run(wait_time, &block)
|
8
|
+
new(wait_time).run(&block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(wait_time)
|
12
|
+
@wait_time = wait_time
|
13
|
+
@done = false
|
14
|
+
end
|
15
|
+
|
16
|
+
def done?
|
17
|
+
@done == true
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
start
|
22
|
+
yield self
|
23
|
+
ensure
|
24
|
+
stop
|
25
|
+
end
|
26
|
+
|
27
|
+
def start
|
28
|
+
stop
|
29
|
+
return if wait_time.zero?
|
30
|
+
|
31
|
+
@done = false
|
32
|
+
@thread = Thread.start do
|
33
|
+
sleep wait_time
|
34
|
+
@done = true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def stop
|
39
|
+
if @thread
|
40
|
+
@thread.kill
|
41
|
+
@thread.join
|
42
|
+
@thread = nil
|
43
|
+
end
|
44
|
+
@done = true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/site_prism/version.rb
CHANGED
data/lib/site_prism/waiter.rb
CHANGED
@@ -2,33 +2,20 @@
|
|
2
2
|
|
3
3
|
module SitePrism
|
4
4
|
class Waiter
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def self.sleep_duration
|
6
|
+
0.05
|
7
|
+
end
|
8
8
|
|
9
|
+
def self.wait_until_true(wait_time = Capybara.default_max_wait_time)
|
10
|
+
Timer.run(wait_time) do |timer|
|
9
11
|
loop do
|
10
12
|
return true if yield
|
11
|
-
break if
|
12
|
-
|
13
|
-
sleep(0.05)
|
13
|
+
break if timer.done?
|
14
14
|
|
15
|
-
|
15
|
+
sleep(sleep_duration)
|
16
16
|
end
|
17
|
-
|
18
17
|
raise SitePrism::TimeoutError, "Timed out after #{wait_time}s."
|
19
18
|
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def check_for_time_stopped!(start_time)
|
24
|
-
return unless start_time == Time.now
|
25
|
-
|
26
|
-
raise(
|
27
|
-
SitePrism::FrozenInTimeError,
|
28
|
-
'Time appears to be frozen. For more info, see ' \
|
29
|
-
'https://github.com/natritmeyer/site_prism/blob/master/lib/site_prism/error.rb'
|
30
|
-
)
|
31
|
-
end
|
32
19
|
end
|
33
20
|
end
|
34
21
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: site_prism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '3.
|
4
|
+
version: '3.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Nat Ritmeyer
|
8
7
|
- Luke Hill
|
8
|
+
- Nat Ritmeyer
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -29,30 +29,42 @@ dependencies:
|
|
29
29
|
name: capybara
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '3.8'
|
35
|
+
- - "<="
|
33
36
|
- !ruby/object:Gem::Version
|
34
|
-
version: '3.
|
37
|
+
version: '3.29'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3.8'
|
45
|
+
- - "<="
|
40
46
|
- !ruby/object:Gem::Version
|
41
|
-
version: '3.
|
47
|
+
version: '3.29'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: site_prism-all_there
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
|
-
- - "
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.1
|
55
|
+
- - "<"
|
47
56
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
57
|
+
version: '1.0'
|
49
58
|
type: :runtime
|
50
59
|
prerelease: false
|
51
60
|
version_requirements: !ruby/object:Gem::Requirement
|
52
61
|
requirements:
|
53
|
-
- - "
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.3.1
|
65
|
+
- - "<"
|
54
66
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
67
|
+
version: '1.0'
|
56
68
|
- !ruby/object:Gem::Dependency
|
57
69
|
name: cucumber
|
58
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,18 +79,32 @@ dependencies:
|
|
67
79
|
- - "~>"
|
68
80
|
- !ruby/object:Gem::Version
|
69
81
|
version: '3.1'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: pry-byebug
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
70
96
|
- !ruby/object:Gem::Dependency
|
71
97
|
name: rake
|
72
98
|
requirement: !ruby/object:Gem::Requirement
|
73
99
|
requirements:
|
74
|
-
- - "
|
100
|
+
- - ">="
|
75
101
|
- !ruby/object:Gem::Version
|
76
102
|
version: '12.3'
|
77
103
|
type: :development
|
78
104
|
prerelease: false
|
79
105
|
version_requirements: !ruby/object:Gem::Requirement
|
80
106
|
requirements:
|
81
|
-
- - "
|
107
|
+
- - ">="
|
82
108
|
- !ruby/object:Gem::Version
|
83
109
|
version: '12.3'
|
84
110
|
- !ruby/object:Gem::Dependency
|
@@ -101,77 +127,95 @@ dependencies:
|
|
101
127
|
requirements:
|
102
128
|
- - "~>"
|
103
129
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.
|
130
|
+
version: 0.81.0
|
105
131
|
type: :development
|
106
132
|
prerelease: false
|
107
133
|
version_requirements: !ruby/object:Gem::Requirement
|
108
134
|
requirements:
|
109
135
|
- - "~>"
|
110
136
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.
|
137
|
+
version: 0.81.0
|
112
138
|
- !ruby/object:Gem::Dependency
|
113
139
|
name: rubocop-performance
|
114
140
|
requirement: !ruby/object:Gem::Requirement
|
115
141
|
requirements:
|
116
142
|
- - "~>"
|
117
143
|
- !ruby/object:Gem::Version
|
118
|
-
version: 1.
|
144
|
+
version: 1.5.1
|
119
145
|
type: :development
|
120
146
|
prerelease: false
|
121
147
|
version_requirements: !ruby/object:Gem::Requirement
|
122
148
|
requirements:
|
123
149
|
- - "~>"
|
124
150
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.
|
151
|
+
version: 1.5.1
|
126
152
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
153
|
+
name: rubocop-rspec
|
128
154
|
requirement: !ruby/object:Gem::Requirement
|
129
155
|
requirements:
|
130
156
|
- - "~>"
|
131
157
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
158
|
+
version: 1.33.0
|
133
159
|
type: :development
|
134
160
|
prerelease: false
|
135
161
|
version_requirements: !ruby/object:Gem::Requirement
|
136
162
|
requirements:
|
137
163
|
- - "~>"
|
138
164
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
165
|
+
version: 1.33.0
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: selenium-webdriver
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '3.9'
|
173
|
+
- - "<"
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '4.1'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '3.9'
|
183
|
+
- - "<"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '4.1'
|
140
186
|
- !ruby/object:Gem::Dependency
|
141
187
|
name: simplecov
|
142
188
|
requirement: !ruby/object:Gem::Requirement
|
143
189
|
requirements:
|
144
190
|
- - "~>"
|
145
191
|
- !ruby/object:Gem::Version
|
146
|
-
version: '0.
|
192
|
+
version: '0.17'
|
147
193
|
type: :development
|
148
194
|
prerelease: false
|
149
195
|
version_requirements: !ruby/object:Gem::Requirement
|
150
196
|
requirements:
|
151
197
|
- - "~>"
|
152
198
|
- !ruby/object:Gem::Version
|
153
|
-
version: '0.
|
199
|
+
version: '0.17'
|
154
200
|
- !ruby/object:Gem::Dependency
|
155
201
|
name: webdrivers
|
156
202
|
requirement: !ruby/object:Gem::Requirement
|
157
203
|
requirements:
|
158
204
|
- - "~>"
|
159
205
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
206
|
+
version: '4.1'
|
161
207
|
type: :development
|
162
208
|
prerelease: false
|
163
209
|
version_requirements: !ruby/object:Gem::Requirement
|
164
210
|
requirements:
|
165
211
|
- - "~>"
|
166
212
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
168
|
-
description:
|
169
|
-
SitePrism
|
170
|
-
clean and semantic DSL for describing your site.
|
171
|
-
SitePrism implements the Page Object Model pattern on top of Capybara.
|
213
|
+
version: '4.1'
|
214
|
+
description: SitePrism gives you a simple, clean and semantic DSL for describing your
|
215
|
+
site. SitePrism implements the Page Object Model pattern on top of Capybara.
|
172
216
|
email:
|
173
|
-
- nat@natontesting.com
|
174
217
|
- lukehill_uk@hotmail.com
|
218
|
+
- nat@natontesting.com
|
175
219
|
executables: []
|
176
220
|
extensions: []
|
177
221
|
extra_rdoc_files: []
|
@@ -188,20 +232,19 @@ files:
|
|
188
232
|
- lib/site_prism/logger.rb
|
189
233
|
- lib/site_prism/page.rb
|
190
234
|
- lib/site_prism/recursion_checker.rb
|
235
|
+
- lib/site_prism/rspec_matchers.rb
|
191
236
|
- lib/site_prism/section.rb
|
237
|
+
- lib/site_prism/timer.rb
|
192
238
|
- lib/site_prism/version.rb
|
193
239
|
- lib/site_prism/waiter.rb
|
194
|
-
homepage: https://github.com/
|
240
|
+
homepage: https://github.com/site-prism/site_prism
|
195
241
|
licenses:
|
196
242
|
- BSD-3-Clause
|
197
243
|
metadata:
|
198
|
-
bug_tracker_uri: https://github.com/
|
199
|
-
changelog_uri: https://github.com/
|
200
|
-
source_code_uri: https://github.com/
|
201
|
-
post_install_message:
|
202
|
-
site_prism has now moved to a new organisation to facilitate better
|
203
|
-
management of the codebase. The new organisation link is available at www.github.com/site-prism
|
204
|
-
and will house the site_prism gem plus new associated co-dependent gems.
|
244
|
+
bug_tracker_uri: https://github.com/site-prism/site_prism/issues
|
245
|
+
changelog_uri: https://github.com/site-prism/site_prism/blob/master/CHANGELOG.md
|
246
|
+
source_code_uri: https://github.com/site-prism/site_prism
|
247
|
+
post_install_message:
|
205
248
|
rdoc_options: []
|
206
249
|
require_paths:
|
207
250
|
- lib
|
@@ -209,15 +252,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
252
|
requirements:
|
210
253
|
- - ">="
|
211
254
|
- !ruby/object:Gem::Version
|
212
|
-
version: '2.
|
255
|
+
version: '2.4'
|
213
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
257
|
requirements:
|
215
258
|
- - ">="
|
216
259
|
- !ruby/object:Gem::Version
|
217
260
|
version: '0'
|
218
261
|
requirements: []
|
219
|
-
|
220
|
-
rubygems_version: 2.7.8
|
262
|
+
rubygems_version: 3.0.6
|
221
263
|
signing_key:
|
222
264
|
specification_version: 4
|
223
265
|
summary: A Page Object Model DSL for Capybara
|