site_prism 5.1.1 → 5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -3
- data/lib/site_prism/dsl/methods.rb +2 -2
- data/lib/site_prism/section.rb +7 -2
- data/lib/site_prism/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 649181c5bfb2e9481f22a4df67e59e6ee9879fce75433b279de0f230fcc58fc0
|
|
4
|
+
data.tar.gz: 5492e1875a4369dc72d6f8101eb77abc74a1ee299f18949cc2443de58b837839
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 682014ffab6661db3b30f7cdee3f6b013d1d1782675e518810dbdfdcadd886381162de313379d8cd63102a68b93eca1617d16d1c87f2524ea1eecd4ec62bbcf5
|
|
7
|
+
data.tar.gz: 58865c5e2a82b41df83dabfd90137fb5a66f4f6923444c9969af26856c76d2c83155e2907f18a69663af18cb828153f6a1a6daac2b89a1498e20ce09c2bc0d14
|
data/README.md
CHANGED
|
@@ -1059,9 +1059,10 @@ expect(@home).not_to have_menu
|
|
|
1059
1059
|
Like an element, it is possible to wait for a section to become visible
|
|
1060
1060
|
or invisible. Calling the `section` method creates two methods on the
|
|
1061
1061
|
relevant page or section:
|
|
1062
|
-
`wait_until_<section_name>_visible`
|
|
1063
|
-
`wait_until_<section_name>_invisible
|
|
1064
|
-
|
|
1062
|
+
* `wait_until_<section_name>_visible`
|
|
1063
|
+
* `wait_until_<section_name>_invisible`
|
|
1064
|
+
|
|
1065
|
+
Using the above example, here's how they're used:
|
|
1065
1066
|
|
|
1066
1067
|
```ruby
|
|
1067
1068
|
@home = Home.new
|
|
@@ -1080,6 +1081,17 @@ time to wait for visibility/invisibility of a section. Here's how:
|
|
|
1080
1081
|
@home.wait_until_menu_invisible(wait: 3)
|
|
1081
1082
|
```
|
|
1082
1083
|
|
|
1084
|
+
You can also call `wait_until_invisible` directly on a section object.
|
|
1085
|
+
```ruby
|
|
1086
|
+
@home = Home.new
|
|
1087
|
+
@home.menu.tap do |menu|
|
|
1088
|
+
# some actions with a menu object
|
|
1089
|
+
menu.wait_until_invisible(wait: 3)
|
|
1090
|
+
end
|
|
1091
|
+
# is the same as
|
|
1092
|
+
@home.wait_until_menu_invisible(wait: 3)
|
|
1093
|
+
```
|
|
1094
|
+
|
|
1083
1095
|
#### Sections within sections
|
|
1084
1096
|
|
|
1085
1097
|
You are not limited to adding sections only to pages; you can nest
|
|
@@ -1555,6 +1567,7 @@ The following element methods allow Capybara options to be passed as arguments t
|
|
|
1555
1567
|
@results_page.has_no_<element_or_section_name>?(text: 'Logout')
|
|
1556
1568
|
@results_page.wait_until_<element_or_section_name>_visible(text: 'Some ajaxy text appears!')
|
|
1557
1569
|
@results_page.wait_until_<element_or_section_name>_invisible(text: 'Some ajaxy text disappears!')
|
|
1570
|
+
@results_page.<section_name>.wait_until_invisible(text: 'Hi!')
|
|
1558
1571
|
```
|
|
1559
1572
|
|
|
1560
1573
|
## Test views with Page objects
|
|
@@ -57,7 +57,7 @@ module SitePrism
|
|
|
57
57
|
build(:section, name, *find_args) do
|
|
58
58
|
define_method(name) do |*runtime_args, &runtime_block|
|
|
59
59
|
section_element = _find(*merge_args(find_args, runtime_args))
|
|
60
|
-
section_class.new(self, section_element, &runtime_block)
|
|
60
|
+
section_class.new(self, section_element, name, &runtime_block)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -73,7 +73,7 @@ module SitePrism
|
|
|
73
73
|
define_method(name) do |*runtime_args, &runtime_block|
|
|
74
74
|
raise_if_runtime_block_supplied(self, name, runtime_block, :sections)
|
|
75
75
|
_all(*merge_args(find_args, runtime_args)).map do |element|
|
|
76
|
-
section_class.new(self, element)
|
|
76
|
+
section_class.new(self, element, name)
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
end
|
data/lib/site_prism/section.rb
CHANGED
|
@@ -16,7 +16,7 @@ module SitePrism
|
|
|
16
16
|
include DSL
|
|
17
17
|
extend Forwardable
|
|
18
18
|
|
|
19
|
-
attr_reader :root_element, :parent
|
|
19
|
+
attr_reader :root_element, :parent, :name
|
|
20
20
|
|
|
21
21
|
class << self
|
|
22
22
|
def set_default_search_arguments(*args)
|
|
@@ -40,9 +40,10 @@ module SitePrism
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def initialize(parent, root_element, &block)
|
|
43
|
+
def initialize(parent, root_element, name = nil, &block)
|
|
44
44
|
@parent = parent
|
|
45
45
|
@root_element = root_element
|
|
46
|
+
@name = name
|
|
46
47
|
within(&block) if block
|
|
47
48
|
end
|
|
48
49
|
|
|
@@ -81,5 +82,9 @@ module SitePrism
|
|
|
81
82
|
candidate = candidate.parent until candidate.is_a?(SitePrism::Page)
|
|
82
83
|
candidate
|
|
83
84
|
end
|
|
85
|
+
|
|
86
|
+
def wait_until_invisible(*args, **kwargs)
|
|
87
|
+
parent.public_send(:"wait_until_#{name}_invisible", *args, **kwargs)
|
|
88
|
+
end
|
|
84
89
|
end
|
|
85
90
|
end
|
data/lib/site_prism/version.rb
CHANGED