site_prism 2.17.1 → 3.0.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 498b5babeeb0e3bff046caaf0772e9f70c9bed419b63684de4c9387c70fd8a44
4
- data.tar.gz: 8353b09572ca801b240831a2c9e3913a548304edc3fb08034029c8f3dcb78c77
3
+ metadata.gz: c72504b3ebac7b0209d022bfe8851bc1cedfebfae96b1647ae5fdb043282c49e
4
+ data.tar.gz: c6432642fb9b5ec2a7a3405a5011e66c8f76c673b5eb14971a3117ef48eda3b4
5
5
  SHA512:
6
- metadata.gz: c9dc27463e54f34cba97b8ae715fdfe3730bfc8c4ab89cd10246af05451d00659403db2523664c94e8f857a1f92cc70435937496a713c3bbc1bc7349718c562b
7
- data.tar.gz: 5a6d9beb3a2104569df8f0c2b4d2b59cf3b3ba73b50d1fc176777f6f39016a7c520ec819fea32b6cd50187864c7bfcaddb4c54014b017e1b288c56459df5b4e2
6
+ metadata.gz: 75baa0fcc7a0844bc8eda684fcb7943bf67421e30f30b8e9d200c26021f7f6d303fae4d7b43355a89784e19578916113effc5fceb1ce9a1678b5b77ce3ccff50
7
+ data.tar.gz: bf020114f3bb95a330dcfb05d056f39bb299a7135ea80c75896bda135c5dd67058fe60549a624de6dc8da91cc2ee834b759556163c40ecf33e856045cbcca72b
data/README.md CHANGED
@@ -472,57 +472,18 @@ Then /^the search field exists$/ do
472
472
  end
473
473
  ```
474
474
 
475
- #### Waiting for an element to exist on a page
476
-
477
- Another method added by calling `element` is the `wait_for_<element_name>` method.
478
- Calling the method will cause the test to wait for the Capybara's
479
- default wait time for the element to exist. It is also possible to use a
480
- custom amount of time to wait. Using the same example as above:
481
-
482
- ```ruby
483
- class Home < SitePrism::Page
484
- set_url 'http://www.google.com'
485
-
486
- element :search_field, 'input[name="q"]'
487
- end
488
- ```
489
-
490
- ... you can wait for the search field to exist like this:
491
-
492
- ```ruby
493
- @home = Home.new
494
- @home.load
495
- @home.wait_for_search_field
496
- # or...
497
- @home.wait_for_search_field(10) #will wait for 10 seconds for the search field to appear
498
- ```
499
-
500
- #### Waiting for an element to not exist on a page
501
-
502
- Another method added by calling `element` is the `wait_for_no_<element_name>` method.
503
- Calling the method will cause the test to wait for the Capybara's
504
- default wait time for the element to not exist. It is also possible to use a
505
- custom amount of time to wait. Using the same example as above:
506
-
507
- ```ruby
508
- @home.wait_for_no_search_field
509
- # or...
510
- @home.wait_for_no_search_field(10) #will wait for 10 seconds for the search field to disappear
511
- ```
512
-
513
475
  #### Waiting for an element to become visible
514
476
 
515
- Another method added by calling `element` is the
477
+ A method that gets added by calling `element` is the
516
478
  `wait_until_<element_name>_visible` method. Calling this method will
517
479
  cause the test to wait for Capybara's default wait time for the element
518
- to become visible (*not* the same as existence!). You can customise the
519
- wait time by supplying a number of seconds to wait. Using the above
520
- example:
480
+ to become visible. You can customise the wait time by supplying a number
481
+ of seconds to wait in-line or configuring the default wait time.
521
482
 
522
483
  ```ruby
523
484
  @home.wait_until_search_field_visible
524
485
  # or...
525
- @home.wait_until_search_field_visible(10)
486
+ @home.wait_until_search_field_visible(wait: 10)
526
487
  ```
527
488
 
528
489
  #### Waiting for an element to become invisible
@@ -530,27 +491,29 @@ example:
530
491
  Another method added by calling `element` is the
531
492
  `wait_until_<element_name>_invisible` method. Calling this method will
532
493
  cause the test to wait for Capybara's default wait time for the element
533
- to become invisible. You can customise the wait time be supplying a number
534
- of seconds to wait. Using the above example:
494
+ to become invisible. You can as with the visibility waiter, customise
495
+ the wait time in the same way.
535
496
 
536
497
  ```ruby
537
498
  @home.wait_until_search_field_invisible
538
499
  # or...
539
- @home.wait_until_search_field_invisible(10)
500
+ @home.wait_until_search_field_invisible(wait: 10)
540
501
  ```
541
502
 
542
503
  #### CSS Selectors vs. XPath Expressions
543
504
 
544
505
  While the above examples all use CSS selectors to find elements, it is
545
506
  possible to use XPath expressions too. In SitePrism, everywhere that you
546
- can use a CSS selector, you can use an XPath expression. An example:
507
+ can use a CSS selector, you can use an XPath expression.
508
+
509
+ An example:
547
510
 
548
511
  ```ruby
549
512
  class Home < SitePrism::Page
550
- # CSS Selector:
513
+ # CSS Selector
551
514
  element :first_name, 'div#signup input[name="first-name"]'
552
515
 
553
- #same thing as an XPath expression:
516
+ # Identical selector as an XPath expression
554
517
  element :first_name, :xpath, '//div[@id="signup"]//input[@name="first-name"]'
555
518
  end
556
519
  ```
@@ -565,17 +528,14 @@ class Home < SitePrism::Page
565
528
  end
566
529
  ```
567
530
 
568
- ...then the following methods are available:
531
+ Then the following methods are available:
569
532
 
570
533
  ```ruby
571
534
  @home.search_field
572
535
  @home.has_search_field?
573
536
  @home.has_no_search_field?
574
- @home.wait_for_search_field
575
- @home.wait_for_no_search_field
576
537
  @home.wait_until_search_field_visible
577
538
  @home.wait_until_search_field_invisible
578
-
579
539
  ```
580
540
 
581
541
  ### Element Collections
@@ -593,7 +553,7 @@ end
593
553
 
594
554
  Just like the `element` method, the `elements` method takes 2 arguments:
595
555
  the first being the name of the elements as a symbol, the second is the
596
- css selector that would return the array of capybara elements.
556
+ css selector (Or locator strategy), that would return capybara elements.
597
557
 
598
558
  #### Accessing the elements
599
559
 
@@ -624,7 +584,7 @@ arrays:
624
584
  @friends_page.names.map { |name| name.text }
625
585
  ```
626
586
 
627
- Or even run some tests...
587
+ Or even run some tests ...
628
588
 
629
589
  ```ruby
630
590
  expect(@friends_page.names.map { |name| name.text }).to eq(['Alice', 'Bob', 'Fred'])
@@ -646,60 +606,23 @@ class Friends < SitePrism::Page
646
606
  end
647
607
  ```
648
608
 
649
- ... then the following method is available:
609
+ Then the following method is available:
650
610
 
651
611
  ```ruby
652
612
  @friends_page.has_names? #=> returns true if at least one element is found using the relevant selector
653
613
  ```
654
614
 
655
- ...which allows for pretty test code:
615
+ This in turn allows the following nice test code
656
616
 
657
617
  ```ruby
658
618
  Then /^there should be some names listed on the page$/ do
659
- expect(@friends_page).to have_names
660
- end
661
- ```
662
-
663
- #### Waiting for the element collection
664
-
665
- Just like for an individual element, the tests can be told to wait for
666
- the existence or non-existence of the element collection. The `elements`
667
- method adds `wait_for_<element collection name>` and
668
- `wait_for_no_<element collection name>` methods that will wait for
669
- Capybara's default wait time until at least 1 element is found that
670
- matches the selector, or no elements are found that match the selector,
671
- respectively. For example, with the following page:
672
-
673
- ```ruby
674
- class Friends < SitePrism::Page
675
- elements :names, 'ul#names li a'
619
+ expect(@friends_page).to have_names #=> This only passes if there is at least one `name`
676
620
  end
677
-
678
- ```
679
-
680
- You can also wait for the existence of a list of names like this:
681
-
682
- ```ruby
683
- @friends_page.wait_for_names
684
- ```
685
-
686
- or wait for the non-existence of a list of names like this:
687
-
688
- ```ruby
689
- @friends_page.wait_for_no_names
690
- ```
691
-
692
- Again, you can customise the wait time by supplying a number of seconds
693
- to wait for:
694
-
695
- ```ruby
696
- @friends_page.wait_for_names(10)
697
- @friends_page.wait_for_no_names(10)
698
621
  ```
699
622
 
700
623
  #### Waiting for the elements to be visible or invisible
701
624
 
702
- Like the individual elements, calling the `elements` method will create
625
+ Like an individual element, calling the `elements` method will create
703
626
  two methods: `wait_until_<elements_name>_visible` and
704
627
  `wait_until_<elements_name>_invisible`. Calling these methods will cause
705
628
  your test to wait for the elements to become visible or invisible. Using
@@ -715,9 +638,9 @@ It is possible to wait for a specific amount of time instead of using
715
638
  the default Capybara wait time:
716
639
 
717
640
  ```ruby
718
- @friends_page.wait_until_names_visible(5)
641
+ @friends_page.wait_until_names_visible(wait: 5)
719
642
  # and...
720
- @friends_page.wait_until_names_invisible(7)
643
+ @friends_page.wait_until_names_invisible(wait: 7)
721
644
  ```
722
645
 
723
646
  ### Checking that all mapped elements are present on the page
@@ -738,7 +661,11 @@ Then /^the friends page contains all the expected elements$/ do
738
661
  end
739
662
  ```
740
663
 
741
- You may wish to have elements declared in a page object class that are not always guaranteed to be present (success or error messages, etc.). If you'd still like to test such a page with `all_there?` you can declare `expected_elements` on your page object class that narrows the elements included in `all_there?` check to those that definitely should be present.
664
+ You may wish to have elements declared in a page object class that are not
665
+ always guaranteed to be present (success or error messages, etc.).
666
+ If you'd still like to test such a page with `all_there?` you can declare
667
+ `expected_elements` on your page object class that narrows the elements
668
+ included in `all_there?` check to those that definitely should be present.
742
669
 
743
670
  ```ruby
744
671
  class TestPage < SitePrism::Page
@@ -784,7 +711,7 @@ A section is similar to a page in that it inherits from a SitePrism
784
711
  class:
785
712
 
786
713
  ```ruby
787
- class MenuSection < SitePrism::Section
714
+ class Menu < SitePrism::Section
788
715
  end
789
716
  ```
790
717
 
@@ -793,11 +720,11 @@ At the moment, this section does nothing.
793
720
  #### Adding a section to a page
794
721
 
795
722
  Pages include sections that's how SitePrism works. Here's a page that
796
- includes the above `MenuSection` section:
723
+ includes the above `Menu` section:
797
724
 
798
725
  ```ruby
799
726
  class Home < SitePrism::Page
800
- section :menu, MenuSection, '#gbx3'
727
+ section :menu, Menu, '#gbx3'
801
728
  end
802
729
  ```
803
730
 
@@ -815,14 +742,14 @@ to have some handy constructs like the one below
815
742
 
816
743
  ```ruby
817
744
  class People < SitePrism::Section
818
- element :headline, 'h2'
745
+ element :footer, 'h4'
819
746
  end
820
747
 
821
748
  class HomePage < SitePrism::Page
822
- # section people_with_block will have headline and
823
- # headline_clone elements in it
749
+ # section people_with_block will have `headline` and
750
+ # `footer` elements in it
824
751
  section :people_with_block, People do
825
- element :headline_clone, 'h2'
752
+ element :headline, 'h2'
826
753
  end
827
754
  end
828
755
  ```
@@ -841,7 +768,7 @@ class Home < SitePrism::Page
841
768
  end
842
769
  ```
843
770
 
844
- #### Accessing a page's section
771
+ #### Accessing a Page's section
845
772
 
846
773
  The `section` method (like the `element` method) adds a few methods to
847
774
  the page or section class it was called against. The first method that
@@ -851,13 +778,13 @@ being the first argument to the `section` method. Here's an example:
851
778
  ```ruby
852
779
  # the section
853
780
 
854
- class MenuSection < SitePrism::Section
781
+ class Menu < SitePrism::Section
855
782
  end
856
783
 
857
784
  # the page that includes the section
858
785
 
859
786
  class Home < SitePrism::Page
860
- section :menu, MenuSection, '#gbx3'
787
+ section :menu, Menu, '#gbx3'
861
788
  end
862
789
 
863
790
  # the page and section in action
@@ -866,11 +793,11 @@ end
866
793
  @home.menu #=> <MenuSection...>
867
794
  ```
868
795
 
869
- When the `menu` method is called against `@home`, an instance of
870
- `MenuSection` (the second argument to the `section` method) is returned.
871
- The third argument that is passed to the `section` method is the css
872
- selector that will be used to find the root element of the section; this
873
- root node becomes the 'scope' of the section.
796
+ When the `menu` method is called against `@home`, an instance of `Menu`
797
+ (the second argument to the `section` method) is returned. The third
798
+ argument that is passed to the `section` method is the locator that
799
+ will be used to find the root element of the section; this root node
800
+ becomes the 'scope' of the section.
874
801
 
875
802
  The following shows that though the same section can appear on multiple
876
803
  pages, it can take a different root node:
@@ -878,46 +805,46 @@ pages, it can take a different root node:
878
805
  ```ruby
879
806
  # define the section that appears on both pages
880
807
 
881
- class MenuSection < SitePrism::Section
808
+ class Menu < SitePrism::Section
882
809
  end
883
810
 
884
811
  # define 2 pages, each containing the same section
885
812
 
886
813
  class Home < SitePrism::Page
887
- section :menu, MenuSection, '#gbx3'
814
+ section :menu, Menu, '#gbx3'
888
815
  end
889
816
 
890
817
  class SearchResults < SitePrism::Page
891
- section :menu, MenuSection, '#gbx48'
818
+ section :menu, Menu, '#gbx48'
892
819
  end
893
820
  ```
894
821
 
895
- You can see that the `MenuSection` is used in both the `Home` and
822
+ You can see that the `Menu` is used in both the `Home` and
896
823
  `SearchResults` pages, but each has slightly different root node. The
897
824
  capybara element that is found by the css selector becomes the root node
898
- for the relevant page's instance of the `MenuSection` section.
825
+ for the relevant page's instance of the `Menu` section.
899
826
 
900
827
  #### Adding elements to a section
901
828
 
902
829
  This works just the same as adding elements to a page:
903
830
 
904
831
  ```ruby
905
- class MenuSection < SitePrism::Section
832
+ class Menu < SitePrism::Section
906
833
  element :search, 'a.search'
907
834
  element :images, 'a.image-search'
908
835
  element :maps, 'a.map-search'
909
836
  end
910
837
  ```
911
838
 
912
- Note that the css selectors used to find elements are searched for
839
+ Note that the locators used to find elements are searched for
913
840
  within the scope of the root element of that section. The search for the
914
841
  element won't be page-wide but it will only look in the section.
915
842
 
916
- When the section is added to a page...
843
+ When the section is added to a page ...
917
844
 
918
845
  ```ruby
919
846
  class Home < SitePrism::Page
920
- section :menu, MenuSection, '#gbx3'
847
+ section :menu, Menu, '#gbx3'
921
848
  end
922
849
  ```
923
850
 
@@ -935,7 +862,7 @@ end
935
862
 
936
863
  ```
937
864
 
938
- ...which leads to some pretty test code:
865
+ This then leads to some pretty test code ...
939
866
 
940
867
  ```ruby
941
868
  Then /^the home page menu contains a link to the various search functions$/ do
@@ -948,8 +875,10 @@ end
948
875
 
949
876
  ##### Accessing section elements using a block
950
877
 
951
- Sections have a `within` method that allows scoped access to the section's elements inside a block. This is similar to Capybara's `within` method and allows for shorter test code particularly with nested sections.
952
- Some of this test code can be made a little prettier by simply passing a block in.
878
+ A Section can be scoped so it is only accessible inside a block. This is
879
+ similar to Capybara's `within` method and allows for shorter test code
880
+ particularly with nested sections. Some of this test code can be
881
+ made a little prettier by simply passing a block in.
953
882
 
954
883
  ```ruby
955
884
  Then /^the home page menu contains a link to the various search functions$/ do
@@ -988,7 +917,7 @@ Then calling `#parent` will return the following:
988
917
  @my_page.load
989
918
 
990
919
  @my_page.my_section.parent #=> returns @my_page
991
- @my_page.my_section.my_subsection.parent #=> returns @my_section
920
+ @my_page.my_section.my_subsection.parent #=> returns @my_page.my_section
992
921
  ```
993
922
 
994
923
  #### Getting a section's parent page
@@ -997,14 +926,14 @@ It is possible to ask a section for the page that it belongs to. For example,
997
926
  given the following setup:
998
927
 
999
928
  ```ruby
1000
- class MenuSection < SitePrism::Section
929
+ class Menu < SitePrism::Section
1001
930
  element :search, 'a.search'
1002
931
  element :images, 'a.image-search'
1003
932
  element :maps, 'a.map-search'
1004
933
  end
1005
934
 
1006
935
  class Home < SitePrism::Page
1007
- section :menu, MenuSection, '#gbx3'
936
+ section :menu, Menu, '#gbx3'
1008
937
  end
1009
938
  ```
1010
939
 
@@ -1024,14 +953,14 @@ to the page or section it's been added to - same idea as what the
1024
953
  `has_<element name>?` method. Given the following setup:
1025
954
 
1026
955
  ```ruby
1027
- class MenuSection < SitePrism::Section
956
+ class Menu < SitePrism::Section
1028
957
  element :search, 'a.search'
1029
958
  element :images, 'a.image-search'
1030
959
  element :maps, 'a.map-search'
1031
960
  end
1032
961
 
1033
962
  class Home < SitePrism::Page
1034
- section :menu, MenuSection, '#gbx3'
963
+ section :menu, Menu, '#gbx3'
1035
964
  end
1036
965
  ```
1037
966
 
@@ -1050,41 +979,6 @@ expect(@home).to have_menu
1050
979
  expect(@home).not_to have_menu
1051
980
  ```
1052
981
 
1053
- #### Waiting for a section to exist
1054
-
1055
- Additional methods added to the page or section by the `section` method are
1056
- `wait_for_<section name>` and `wait_for_no_<section name>`. Similar to what
1057
- `element` does, these methods wait for the section to appear or disappear,
1058
- respectively - the test will wait up to capybara's
1059
- default wait time until the `root_element` of the section exists or does
1060
- not exist on the page/section that our section was added to. Given the following setup:
1061
-
1062
- ```ruby
1063
- class MenuSection < SitePrism::Section
1064
- element :search, 'a.search'
1065
- element :images, 'a.image-search'
1066
- element :maps, 'a.map-search'
1067
- end
1068
-
1069
- class Home < SitePrism::Page
1070
- section :menu, MenuSection, '#gbx3'
1071
- end
1072
- ```
1073
-
1074
- ... we can wait for the menu section to appear on the page like this:
1075
-
1076
- ```ruby
1077
- @home.wait_for_menu
1078
- @home.wait_for_menu(10) # waits for 10 seconds instead of capybara's default timeout
1079
- ```
1080
-
1081
- ... and we can wait for the menu section to disappear on the page like this:
1082
-
1083
- ```ruby
1084
- @home.wait_for_no_menu
1085
- @home.wait_for_no_menu(10) # waits for 10 seconds instead of capybara's default timeout
1086
- ```
1087
-
1088
982
  #### Waiting for a section to become visible or invisible
1089
983
 
1090
984
  Like an element, it is possible to wait for a section to become visible
@@ -1106,9 +1000,9 @@ time to wait for visibility/invisibility of a section. Here's how:
1106
1000
 
1107
1001
  ```ruby
1108
1002
  @home = Home.new
1109
- @home.wait_until_menu_visible(5)
1003
+ @home.wait_until_menu_visible(wait: 5)
1110
1004
  # and...
1111
- @home.wait_until_menu_invisible(3)
1005
+ @home.wait_until_menu_invisible(wait: 3)
1112
1006
  ```
1113
1007
 
1114
1008
  #### Sections within sections
@@ -1118,7 +1012,8 @@ sections within sections within sections within sections!
1118
1012
 
1119
1013
  ```ruby
1120
1014
 
1121
- # define a page that contains an area that contains a section for both logging in and registration, then modelling each of the sub sections separately
1015
+ # define a page that contains an area that contains a section for both
1016
+ # logging in and registration. Modelling each of the sub-sections separately
1122
1017
 
1123
1018
  class Login < SitePrism::Section
1124
1019
  element :username, '#username'
@@ -1146,7 +1041,6 @@ end
1146
1041
  Then /^I sign in$/ do
1147
1042
  @home = Home.new
1148
1043
  @home.load
1149
- @home.wait_for_login_and_registration
1150
1044
  expect(@home).to have_login_and_registration
1151
1045
  expect(@home.login_and_registration).to have_username
1152
1046
  @home.login_and_registration.login.username.set 'bob'
@@ -1203,41 +1097,42 @@ The only difference between `section` and `sections` is that whereas the
1203
1097
  first returns an instance of the supplied section class, the second
1204
1098
  returns an array containing as many instances of the section class as
1205
1099
  there are capybara elements found by the supplied css selector. This is
1206
- better explained in code :)
1100
+ better explained in the following example ...
1207
1101
 
1208
1102
  #### Adding a Section collection to a page (or other section)
1209
1103
 
1210
1104
  Given the following setup:
1211
1105
 
1212
1106
  ```ruby
1213
- class SearchResultSection < SitePrism::Section
1107
+ class SearchResults < SitePrism::Section
1214
1108
  element :title, 'a.title'
1215
- element :blurb, 'span.result-decription'
1109
+ element :blurb, 'span.result-description'
1216
1110
  end
1217
1111
 
1218
- class SearchResults < SitePrism::Page
1219
- sections :search_results, SearchResultSection, '#results li'
1112
+ class Home < SitePrism::Page
1113
+ sections :search_results, SearchResults, '#results li'
1220
1114
  end
1221
1115
  ```
1222
1116
 
1223
- ... it is possible to access each of the search results:
1117
+ It is possible to access each of the search results:
1224
1118
 
1225
1119
  ```ruby
1226
- @results_page = SearchResults.new
1120
+ @home = Home.new
1227
1121
  # ...
1228
- @results_page.search_results.each do |search_result|
1229
- puts search_result.title.text
1122
+ @home.search_results.each do |result|
1123
+ puts result.title.text
1230
1124
  end
1231
1125
  ```
1232
1126
 
1233
- ... which allows for pretty tests:
1127
+ This allows for pretty tests ...
1234
1128
 
1235
1129
  ```ruby
1236
1130
  Then /^there are lots of search_results$/ do
1237
- expect(@results_page.search_results.size).to eq 10
1238
- @results_page.search_results.each do |search_result|
1239
- expect(search_result).to have_title
1240
- expect(search_result.blurb.text).not_to be_nil
1131
+ expect(@results_page.search_results.size).to eq(10)
1132
+
1133
+ @home.search_results.each do |result|
1134
+ expect(result).to have_title
1135
+ expect(result.blurb.text).not_to be_empty
1241
1136
  end
1242
1137
  end
1243
1138
  ```
@@ -1245,11 +1140,10 @@ end
1245
1140
  The css selector that is passed as the 3rd argument to the
1246
1141
  `sections` method ("#results li") is used to find a number of capybara
1247
1142
  elements. Each capybara element found using the css selector is used to
1248
- create a new instance of the `SearchResultSection` and becomes its root
1143
+ create a new instance of `SearchResults` and becomes its root
1249
1144
  element. So if the css selector finds 3 `li` elements, calling
1250
1145
  `search_results` will return an array containing 3 instances of
1251
- `SearchResultSection`, each with one of the `li` elements as it's root
1252
- element.
1146
+ `SearchResults`, each with one of the `li` elements as it's root element.
1253
1147
 
1254
1148
  #### Anonymous Section Collections
1255
1149
 
@@ -1257,10 +1151,10 @@ You can define collections of anonymous sections the same way you would
1257
1151
  define a single anonymous section:
1258
1152
 
1259
1153
  ```ruby
1260
- class SearchResults < SitePrism::Page
1154
+ class Home < SitePrism::Page
1261
1155
  sections :search_results, '#results li' do
1262
1156
  element :title, 'a.title'
1263
- element :blurb, 'span.result-decription'
1157
+ element :blurb, 'span.result-description'
1264
1158
  end
1265
1159
  end
1266
1160
  ```
@@ -1269,85 +1163,92 @@ end
1269
1163
 
1270
1164
  Using the example above, it is possible to test for the existence of the
1271
1165
  sections. As long as there is at least one section in the array, the
1272
- sections exist. The `sections` method adds a `has_<sections name>?`
1273
- method to the page/section that our section has been added to. Given the
1274
- following example:
1166
+ sections item is said to exist. The `sections` method
1167
+ adds a `has_<sections name>?` method to the page/section that our
1168
+ section has been added to.
1169
+
1170
+ So given the example below, we can do the following ...
1275
1171
 
1276
1172
  ```ruby
1277
- class SearchResultSection < SitePrism::Section
1173
+ class SearchResults < SitePrism::Section
1278
1174
  element :title, 'a.title'
1279
- element :blurb, 'span.result-decription'
1175
+ element :blurb, 'span.result-description'
1280
1176
  end
1281
1177
 
1282
- class SearchResults < SitePrism::Page
1283
- sections :search_results, SearchResultSection, '#results li'
1178
+ class Home < SitePrism::Page
1179
+ sections :search_results, SearchResults, '#results li'
1284
1180
  end
1285
1181
  ```
1286
1182
 
1287
- ... here's how to test for the existence of the section:
1183
+ Here's how to test for the existence of the section:
1288
1184
 
1289
1185
  ```ruby
1290
- @results_page = SearchResults.new
1186
+ @home = Home.new
1291
1187
  # ...
1292
- @results_page.has_search_results?
1188
+ @home.has_search_results? #=> Only returns `true` if there is 1 or more results
1293
1189
  ```
1294
1190
 
1295
- ...which allows pretty tests:
1191
+ This allows for some pretty tests ...
1296
1192
 
1297
1193
  ```ruby
1298
1194
  Then /^there are search results on the page$/ do
1299
- expect(@results_page).to have_search_results
1195
+ expect(@home).to have_search_results
1300
1196
  end
1301
1197
  ```
1302
1198
 
1303
- #### Waiting for sections to appear
1199
+ #### Waiting for sections to appear/disappear
1304
1200
 
1305
1201
  The last methods added by `sections` to the page/section we're adding
1306
- our sections to are `wait_for_<sections name>` and `wait_for_no_<sections name>`.
1307
- They will wait for capybara's default wait time for there to be at least one instance of
1308
- the section in the array of sections or no instances of the section in the array
1309
- of sections, respectively. For example:
1202
+ our sections to are `wait_until_<sections name>_visible` and
1203
+ `wait_until_<sections name>_invisible`. They will wait for capybara's
1204
+ default wait time for there to be at least one of the section items
1205
+ in the array of sections to be visible or for one of the section items
1206
+ to be invisible respectively.
1207
+
1208
+ For example:
1310
1209
 
1311
1210
  ```ruby
1312
- class SearchResultSection < SitePrism::Section
1211
+ class SearchResults < SitePrism::Section
1313
1212
  element :title, 'a.title'
1314
1213
  element :blurb, 'span.result-decription'
1315
1214
  end
1316
1215
 
1317
- class SearchResults < SitePrism::Page
1318
- sections :search_results, SearchResultSection, '#results li'
1216
+ class Home < SitePrism::Page
1217
+ sections :search_results, SearchResults, '#results li'
1319
1218
  end
1320
1219
  ```
1321
1220
 
1322
- ... here's how to wait for the section:
1221
+ ... here's how to wait for one the section items to become visible:
1323
1222
 
1324
1223
  ```ruby
1325
- @results_page = SearchResults.new
1224
+ @home = Home.new
1326
1225
  # ...
1327
- @results_page.wait_for_search_results
1328
- @results_page.wait_for_search_results(10) #=> waits for 10 seconds instead of the default capybara timeout
1226
+ @home.wait_until_search_results_visible
1227
+ @home.wait_until_search_results_visible(wait: 3) #=> waits for 3 seconds instead of the default capybara timeout
1329
1228
  ```
1330
1229
 
1331
1230
  ... and how to wait for the sections to disappear
1332
1231
 
1333
1232
  ```ruby
1334
- @results_page = SearchResults.new
1233
+ @home = Home.new
1335
1234
  # ...
1336
- @results_page.wait_for_no_search_results
1337
- @results_page.wait_for_no_search_results(10) #=> waits for 10 seconds instead of the default capybara timeout
1235
+ @home.wait_until_search_results_invisible
1236
+ @home.wait_until_search_results_invisible(wait: 6) #=> waits for 6 seconds instead of the default capybara timeout
1338
1237
  ```
1339
1238
 
1340
1239
  ## Load Validations
1341
1240
 
1342
- Load validations enable common validations to be abstracted and performed on a Page or Section to determine
1343
- when it has finished loading and is ready for interaction in your tests.
1241
+ Load validations enable common validations to be abstracted and performed
1242
+ on a Page or Section to determine when it has finished loading
1243
+ and is ready for interaction in your tests.
1344
1244
 
1345
- For example, suppose you have a page which displays a 'Loading...' message while the body of
1346
- the page is loaded in the background. Load validations can be used to ensure tests wait for the correct url
1347
- to be displayed and the loading message removed before trying to interact with with the page.
1245
+ For example, suppose you have a page which displays a 'Loading...' message
1246
+ while the body of the page is loaded in the background. Load validations can
1247
+ be used to ensure tests wait for the correct url to be displayed and the
1248
+ loading message is no longer present before trying to interact with the page.
1348
1249
 
1349
- Other use cases include Sections which are displayed conditionally and may take time to become ready to
1350
- interact with, such as animated lightboxes.
1250
+ Other use cases include Sections which are displayed conditionally and may
1251
+ take time to become ready to interact with, such as animated lightboxes.
1351
1252
 
1352
1253
  ### Using Load Validations
1353
1254
 
@@ -1359,8 +1260,9 @@ Load validations can be used in three constructs:
1359
1260
 
1360
1261
  #### Page#load
1361
1262
 
1362
- When a block is passed to the `Page#load` method, the url will be loaded normally and then the block will be
1363
- executed within the context of `when_loaded`. See `when_loaded` documentation below for further details.
1263
+ When a block is passed to the `Page#load` method, the url will be loaded
1264
+ normally and then the block will be executed within the context of
1265
+ `when_loaded`. See `when_loaded` documentation below for further details.
1364
1266
 
1365
1267
  Example:
1366
1268
 
@@ -1373,10 +1275,11 @@ end
1373
1275
 
1374
1276
  #### Loadable#when_loaded
1375
1277
 
1376
- The `Loadable#when_loaded` method on a Loadable class instance will yield the instance of the class into a
1377
- block after all load validations have passed.
1278
+ The `Loadable#when_loaded` method on a Loadable class instance will yield
1279
+ the instance of the class into a block after all load validations have passed.
1378
1280
 
1379
- If any load validation fails, an error will be raised with the reason, if given, for the failure.
1281
+ If any load validation fails, an error will be raised
1282
+ with the reason, if given, for the failure.
1380
1283
 
1381
1284
  Example:
1382
1285
 
@@ -1390,9 +1293,10 @@ end
1390
1293
  #### Loadable#loaded?
1391
1294
 
1392
1295
  You can explicitly run load validations on a Loadable via the `loaded?` method.
1393
- This method will execute all load validations on the object and return a boolean value.
1394
- In the event of a validation failure, a validation error can be accessed via the `load_error`
1395
- method on the object, if any error message was emitted by the failing validation.
1296
+ This method will execute all load validations on the object and
1297
+ return a boolean value. In the event of a validation failure, a validation error
1298
+ can be accessed via the `load_error` method on the object, if any error message
1299
+ was emitted by the failing validation.
1396
1300
 
1397
1301
  Example:
1398
1302
 
@@ -1407,7 +1311,8 @@ end
1407
1311
 
1408
1312
  ### Defining Load Validations
1409
1313
 
1410
- A load validation is a block which returns a boolean value when evaluated against an instance of the Loadable.
1314
+ A load validation is a block which returns a boolean value when evaluated against
1315
+ an instance of the Page or Section where defined.
1411
1316
 
1412
1317
  ```ruby
1413
1318
  class SomePage < SitePrism::Page
@@ -1416,11 +1321,12 @@ class SomePage < SitePrism::Page
1416
1321
  end
1417
1322
  ```
1418
1323
 
1419
- The block may instead return a two-element array which includes the boolean result as the first element and an
1420
- error message as the second element. It is highly recommended to supply an error message, as they are
1324
+ The block may be defined as a two-element array which includes the boolean check
1325
+ as the first element and an error message as the second element.
1326
+ It is highly recommended to supply an error message, as they are
1421
1327
  extremely useful in debugging validation errors.
1422
1328
 
1423
- The error message will be ignored unless the boolean value is falsey.
1329
+ The error message is ignored unless the boolean value is evaluated as falsey.
1424
1330
 
1425
1331
  ```ruby
1426
1332
  class SomePage < SitePrism::Page
@@ -1429,15 +1335,18 @@ class SomePage < SitePrism::Page
1429
1335
  end
1430
1336
  ```
1431
1337
 
1432
- Load validations may be defined on `SitePrism::Page` and `SitePrism::Section` classes (herein referred
1433
- to as `Loadables`) and are evaluated against an instance of the class when executed.
1338
+ Load validations may be defined on `SitePrism::Page` and `SitePrism::Section`
1339
+ classes (herein referred to as `Loadables`) and are evaluated against an
1340
+ instance of the class when created.
1434
1341
 
1435
1342
  ### Load Validation Inheritance and Execution Order
1436
1343
 
1437
- Any number of load validations may be defined on a Loadable class and will be inherited by its subclasses.
1344
+ Any number of load validations may be defined on a Loadable and they are
1345
+ inherited by its subclasses (if any exist).
1438
1346
 
1439
- Load validations are executed in the order that they are defined. Inherited load validations are executed
1440
- from the top of the inheritance chain (e.g. `SitePrism::Page` or `SitePrism::Section`) to the bottom.
1347
+ Load validations are executed in the order that they are defined.
1348
+ Inherited load validations are executed from the top of the inheritance chain
1349
+ (e.g. `SitePrism::Page` or `SitePrism::Section`) to the bottom.
1441
1350
 
1442
1351
  For example:
1443
1352
 
@@ -1446,7 +1355,6 @@ class BasePage < SitePrism::Page
1446
1355
  element :loading_message, '.loader'
1447
1356
 
1448
1357
  load_validation do
1449
- wait_for_loading_message(1)
1450
1358
  [has_no_loading_message?(wait: 10), 'loading message was still displayed']
1451
1359
  end
1452
1360
  end
@@ -1462,61 +1370,60 @@ class FooPage < BasePage
1462
1370
  end
1463
1371
  ```
1464
1372
 
1465
- In the above example, when `loaded?` is called on an instance of `FooPage`, the validations will be performed in the
1466
- following order:
1373
+ In the above example, when `loaded?` is called on an instance of `FooPage`,
1374
+ the validations will be performed in the following order:
1467
1375
 
1468
- 1. The `SitePrism::Page` default load validation will check `displayed?`
1469
- 2. The `BasePage` load validation will wait for the loading message to disappear.
1470
- 3. The `FooPage` load validation will wait for the `form` element to be present.
1471
- 4. The `FooPage` load validation will wait for the `some_other_element` element to be present.
1376
+ 1. The `BasePage` validation will wait for the loading message to disappear.
1377
+ 2. The `FooPage` validation will wait for the `form` element to be present.
1378
+ 3. The `FooPage` validation will wait for the `some_other_element` element to be present.
1472
1379
 
1473
- NOTE: `SitePrism::Page` includes a default load validation on `page.displayed?` which is applied
1474
- to all pages. It is therefore not necessary to define a load validation for this condition on
1475
- inheriting page objects.
1380
+ **NB:** `SitePrism::Page` **used to** include a default load validation on
1381
+ `page.displayed?` however for v3 this has been removed. It is therefore
1382
+ necessary to re-define this if you want to retain the behaviour
1383
+ from site_prism v2. See [UPGRADING.md](https://github.com/natritmeyer/site_prism/blob/master/UPGRADING.md#default-load-validations)
1384
+ for more info on this.
1476
1385
 
1477
1386
  ## Using Capybara Query Options
1478
1387
 
1479
- When querying an element, section or a collection of elements or sections, you may
1480
- supply Capybara query options as arguments to the element and section methods in order
1481
- to refine the results of the query and enable Capybara to wait for all of the conditions
1482
- necessary to properly fulfill your request.
1388
+ When querying an element, section or a collection of elements or sections,
1389
+ you may supply Capybara query options as arguments to the element and section
1390
+ methods in order to refine the results of the query and enable Capybara to
1391
+ wait for all of the conditions necessary to properly fulfill your request.
1483
1392
 
1484
1393
  Given the following sample page and elements:
1485
1394
 
1486
1395
  ```ruby
1487
- class SearchResultSection < SitePrism::Section
1396
+ class SearchResults < SitePrism::Section
1488
1397
  element :title, 'a.title'
1489
1398
  element :blurb, 'span.result-decription'
1490
1399
  end
1491
1400
 
1492
- class SearchResults < SitePrism::Page
1401
+ class Home < SitePrism::Page
1493
1402
  element :footer, '.footer'
1494
- sections :search_results, SearchResultSection, '#results li'
1403
+ sections :search_results, SearchResults, '#results li'
1495
1404
  end
1496
1405
  ```
1497
1406
 
1498
- Asserting the attributes of an element or section returned by any method may fail if
1499
- the page has not finished loading the element(s):
1407
+ Asserting the attributes of an element or section returned by any method may
1408
+ fail if the page has not finished loading the section(s):
1500
1409
 
1501
1410
  ```ruby
1502
- @results_page = SearchResults.new
1411
+ @home = Home.new
1503
1412
  # ...
1504
- expect(@results_page.search_results.size).to == 25 # This may fail!
1413
+ expect(@home.search_results.size).to == 25 # This may fail!
1505
1414
  ```
1506
1415
 
1507
- The above query can be rewritten to utilize the Capybara :count option when querying for
1508
- the collection, which in turn causes Capybara to expect some number of results to be returned.
1509
- The method calls below will succeed, provided the elements appear on the page within the timeout:
1416
+ The above query can be rewritten to utilize the Capybara `:count` option
1417
+ when querying for the sections to be present and countable, which in turn
1418
+ causes Capybara to expect some number of results to be returned.
1419
+ The method calls below will succeed, provided the elements appear on
1420
+ the page within the timeout:
1510
1421
 
1511
1422
  ```ruby
1512
- @results_page = SearchResults.new
1513
- # ...
1514
- @results_page.has_search_results?(count: 25)
1515
- # OR
1516
- @results_page.search_results(count: 25)
1423
+ @home = Home.new
1424
+ @home.has_search_results?(count: 25)
1517
1425
  # OR
1518
- @results_page.wait_for_search_results(nil, count: 25)
1519
- # Note that wait_for_<element_name> expects a timeout value to be passed as the first parameter or nil to use the default timeout value.
1426
+ @home.search_results(count: 25)
1520
1427
  ```
1521
1428
 
1522
1429
  Now we can write pretty, non-failing tests without hard coding these options
@@ -1528,14 +1435,14 @@ Then /^there are search results on the page$/ do
1528
1435
  end
1529
1436
  ```
1530
1437
 
1531
- This is supported for all of the Capybara options including, but not limited to :count, :text,
1532
- :wait, etc. This can also be used when defining page objects. Eg:
1438
+ This is supported for all of the Capybara options including, but not limited to
1439
+ `:count`, `:text` etc. This can also be used when defining page objects.
1533
1440
 
1534
1441
  ```ruby
1535
- class SearchResults < SitePrism::Page
1536
- element :footer, '.footer'
1537
- element :view_more, 'li', text: 'View More'
1538
- sections :search_results, SearchResultSection, '#results li'
1442
+ class Home < SitePrism::Page
1443
+ element :footer, '.footer'
1444
+ element :view_more, 'li', text: 'View More'
1445
+ sections :search_results, SearchResults, '#results li', count: 5
1539
1446
  end
1540
1447
  ```
1541
1448
 
@@ -1547,8 +1454,6 @@ The following element methods allow Capybara options to be passed as arguments t
1547
1454
  @results_page.<element_or_section_name>(text: 'Welcome!')
1548
1455
  @results_page.has_<element_or_section_name>?(count: 25)
1549
1456
  @results_page.has_no_<element_or_section_name>?(text: 'Logout')
1550
- @results_page.wait_for_<element_or_section_name>(nil, count: 25)
1551
- @results_page.wait_for_no_<element_or_section_name>(nil, count: 25)
1552
1457
  @results_page.wait_until_<element_or_section_name>_visible(text: 'Some ajaxy text appears!')
1553
1458
  @results_page.wait_until_<element_or_section_name>_invisible(text: 'Some ajaxy text disappears!')
1554
1459
  ```
@@ -1577,7 +1482,7 @@ describe 'admin/things/index' do
1577
1482
  end
1578
1483
  ```
1579
1484
 
1580
- ## IFrames
1485
+ ## iFrames
1581
1486
 
1582
1487
  SitePrism allows you to interact with iframes. An iframe is declared as
1583
1488
  a `SitePrism::Page` class, and then referenced by the page or section it
@@ -1606,7 +1511,7 @@ class PageContainingIframe < SitePrism::Page
1606
1511
  end
1607
1512
  ```
1608
1513
 
1609
- ### Locating an iframe
1514
+ ### Locating an iFrame
1610
1515
 
1611
1516
  While the above example uses a CSS selector to find the iframe, it is also
1612
1517
  possible to use an XPath expression or the index of the iframe in its parent
@@ -1635,30 +1540,17 @@ the above example, here's how it's done:
1635
1540
  expect(@page).to have_my_iframe
1636
1541
  ```
1637
1542
 
1638
- ### Waiting for an iframe
1639
-
1640
- Like an element or section, it is possible to wait for an iframe to
1641
- exist or not exist by using the `wait_for_<iframe_name>` and
1642
- `wait_for_no_<iframe_name>` methods. For example:
1643
-
1644
- ```ruby
1645
- @page = PageContainingIframe.new
1646
- # ...
1647
- @page.wait_for_my_iframe
1648
- @page.wait_for_no_my_iframe
1649
- ```
1650
-
1651
1543
  ### Interacting with an iframe's contents:
1652
1544
 
1653
- Since an iframe contains a fully fledged SitePrism::Page, you are able
1545
+ Since an iframe contains a fully fledged `SitePrism::Page`, you are able
1654
1546
  to interact with the elements and sections defined within it. Due to
1655
1547
  capybara internals it is necessary to pass a block to the iframe instead
1656
1548
  of simply calling methods on it; the block argument is the
1657
- SitePrism::Page that represents the iframe's contents. For example:
1549
+ `SitePrism::Page` that represents the iframe's contents. For example:
1658
1550
 
1659
1551
  ```ruby
1660
1552
  # SitePrism::Page representing the iframe
1661
- class Login < SitePrism::Page
1553
+ class LoginFrame < SitePrism::Page
1662
1554
  element :username, 'input.username'
1663
1555
  element :password, 'input.password'
1664
1556
  end
@@ -1667,7 +1559,7 @@ end
1667
1559
  class Home < SitePrism::Page
1668
1560
  set_url 'http://www.example.com'
1669
1561
 
1670
- iframe :login_area, Login, '#login_and_registration'
1562
+ iframe :login_frame, LoginFrame, '#login_and_registration'
1671
1563
  end
1672
1564
 
1673
1565
  # cucumber step that performs login
@@ -1675,8 +1567,8 @@ When /^I log in$/ do
1675
1567
  @home = Home.new
1676
1568
  @home.load
1677
1569
 
1678
- @home.login_area do |frame|
1679
- #`frame` is an instance of the `Login` class
1570
+ @home.login_frame do |frame|
1571
+ #`frame` is an instance of the `LoginFrame` class
1680
1572
  frame.username.set 'admin'
1681
1573
  frame.password.set 'p4ssword'
1682
1574
  end
@@ -1693,110 +1585,38 @@ a Cucumber based framework
1693
1585
 
1694
1586
  ### Using Capybara Implicit Waits
1695
1587
 
1696
- By default, SitePrism element and section methods do not utilize
1697
- Capybara's implicit wait methodology and will return immediately if
1698
- the element or section requested is not found on the page. Add the
1699
- following code to enable Capybara's implicit wait methodology.
1700
-
1701
- ```ruby
1702
- SitePrism.configure do |config|
1703
- config.use_implicit_waits = true
1704
- end
1705
- ```
1706
-
1707
- This enables you to replace this:
1708
-
1709
- ```ruby
1710
- # wait_until methods always wait for the element to be present on the page:
1711
- @search_page.wait_for_search_results
1712
-
1713
- # Element and section methods do not (But will do if you configure the above)
1714
- @search_page.search_results
1715
- ```
1716
-
1717
- with this:
1718
-
1719
- ```ruby
1720
- # With implicit waits enabled, use of wait_until methods is no longer required.
1721
- # This method will wait for the element to be found on the page or
1722
- # until the `Capybara.default_max_wait_time` timeout is reached.
1723
- @search_page.search_results
1724
- ```
1588
+ By default, SitePrism element and section methods utilize
1589
+ Capybara's implicit wait methodology and will return only once the shorter of
1590
+ the Capybara timeout limit has been reached or the required query has passed.
1725
1591
 
1726
- Note that even with implicit waits on you can temporarily modify wait times in SitePrism to help work-around special circumstances.
1592
+ If you want to tweak the waiting time or disable it completely, configure it
1593
+ as per the code below
1727
1594
 
1728
1595
  ```ruby
1729
- # Option 1: using wait_for
1730
- @search_page.wait_for_search_results(30) # will wait up to 30seconds
1731
-
1732
- # Option 2: using Capybara directly
1733
- Capybara.using_wait_time(30) do
1734
- @search_page.subsection.search_results
1596
+ Capybara.configure do |config|
1597
+ config.default_max_wait_time = 11 #=> Wait up to 11 seconds for all querys to fail
1598
+ # or alternatively, if you don't want to ever wait
1599
+ config.default_max_wait_time = 0 #=> Don't ever wait!
1735
1600
  end
1736
1601
  ```
1737
1602
 
1738
- ## Raising Errors on wait_for
1739
-
1740
- By default, when using `wait_for_*` and `wait_for_no_*` methods, SitePrism will not raise
1741
- an error if an element does not appear or disappear within the timeout period and will
1742
- simply return `false` and allow the test to continue. This is different from
1743
- the other methods such as `wait_until_*_visible` which do raise errors.
1744
-
1745
- Add the following code to enable errors to be raised immediately when a
1746
- `wait_for_*` method does not find the element it is waiting for and when a
1747
- `wait_for_no_*` method continues to find an element it is waiting to not exist.
1603
+ Note that even with implicit waits on you can dynamically modify the wait times
1604
+ in any SitePrism method to help work-around special circumstances.
1748
1605
 
1749
1606
  ```ruby
1750
- SitePrism.configure do |config|
1751
- config.raise_on_wait_fors = true
1752
- end
1753
- ```
1754
-
1755
- This enables you to replace this:
1756
-
1757
- ```ruby
1758
- raise unless @search_page.wait_for_search_results
1759
- # or...
1760
- raise unless @search_page.wait_for_no_search_results
1761
- ```
1762
-
1763
- with this:
1607
+ # Option 1: using wait key assignment
1608
+ @home.search_results(wait: 20) # will wait up to 20 seconds
1764
1609
 
1765
- ```ruby
1766
- # With raise on wait_fors enabled, this will automatically raise
1767
- # if no search results are found
1768
- @search_page.wait_for_search_results
1769
- # or automatically raise if search results are still found
1770
- @search_page.wait_for_no_search_results
1771
- ```
1772
-
1773
- ## Configuring default load_validations
1774
-
1775
- By default, SitePrism will add a single default load validation to all pages.
1776
- This single load validation verifies the page URL is correct, and will run whenever you
1777
- call `#loaded?` on an instantiated page. It uses the DSL defined `set_url` or `set_url_matcher`
1778
- as a source of truth to compare the value of `page.current_url` when you call `#loaded?`
1779
-
1780
- However there may be times you are unsure what your page URL will even look like, or you
1781
- might not want this validation to run first, or even at all. In these situations it is
1782
- sometimes desirable to remove this default validation.
1783
-
1784
- Adding the below code and SitePrism will remove this validation from being
1785
- set up for all your pages (And ran accordingly). Note that by default this validation
1786
- is set to run on **all** pages.
1787
-
1788
- ```ruby
1789
- SitePrism.configure do |config|
1790
- config.default_load_validations = false
1610
+ # Option 2: using Capybara directly, this will wait up to 20 seconds
1611
+ Capybara.using_wait_time(20) do
1612
+ @home.search_results
1791
1613
  end
1792
1614
  ```
1793
1615
 
1794
1616
  ## Using SitePrism with VCR
1795
1617
 
1796
1618
  There's a SitePrism plugin called `site_prism.vcr` that lets you use
1797
- SitePrism with the VCR gem. Check it out here:
1798
-
1799
- * https://github.com/dnesteryuk/site_prism.vcr
1619
+ SitePrism with the VCR gem. Check it out [HERE](https://github.com/dnesteryuk/site_prism.vcr)
1800
1620
 
1801
1621
  # Epilogue
1802
1622
 
@@ -1872,5 +1692,10 @@ end
1872
1692
  # etc...
1873
1693
  ```
1874
1694
 
1875
- The only thing that needs instantiating is the App class - from then on pages don't
1876
- need to be initialized, they are now returned by methods on @app. Maintenance win!
1695
+ The only thing that needs instantiating is the `App` class - from then on
1696
+ pages don't need to be initialized, they are now returned by methods on `@app`.
1697
+
1698
+ It is possible to further optimise this, by using Cucumber/RSpec hooks, however
1699
+ the investigation and optimisation of this is left as an exercise to the Reader.
1700
+
1701
+ Happy testing from all of the SitePrism team!