ae_page_objects 4.4.0.pre.rc.1 → 5.0.0.pre1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 050326bd45948e6541587873da40715708f854333d9965816e0d7d78d54d33bb
|
4
|
+
data.tar.gz: baaa65ec6da2ef99f462d2259e8add8920654897e078dabe2b0b237c7f57b390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 370ec5c9073399673f4cd498b35440319c8c81677d4c198a835a6ed56d8859da8333129315b1306119e9e6ac6559a2fc412c0e51c81f7fcfe0414ef907779305
|
7
|
+
data.tar.gz: 694053ed1cf77a4258c8c68a4652f02f6ec5a52b778e77f79d78d881610416e693b5cc19c4ce427e01c60a7b7bc92d38ec4f4f4656331221bd158028cef10ecb
|
@@ -89,6 +89,11 @@ module AePageObjects
|
|
89
89
|
def configure(options)
|
90
90
|
@locator = options.delete(:locator)
|
91
91
|
@name = options.delete(:name)
|
92
|
+
if options.key?(:wait)
|
93
|
+
@wait = options.delete(:wait)
|
94
|
+
else
|
95
|
+
@wait = true
|
96
|
+
end
|
92
97
|
|
93
98
|
@name = @name.to_s if @name
|
94
99
|
end
|
@@ -107,20 +112,24 @@ module AePageObjects
|
|
107
112
|
|
108
113
|
def scoped_node
|
109
114
|
locator = eval_locator(@locator)
|
110
|
-
|
111
|
-
|
115
|
+
|
116
|
+
return parent.node if locator.empty?
|
117
|
+
|
118
|
+
default_options = { minimum: 0 }
|
119
|
+
if locator.last.is_a?(::Hash)
|
120
|
+
locator[-1] = default_options.merge(locator.last)
|
112
121
|
else
|
113
|
-
default_options
|
114
|
-
|
115
|
-
locator[-1] = default_options.merge(locator.last)
|
116
|
-
else
|
117
|
-
locator.push(default_options)
|
118
|
-
end
|
122
|
+
locator.push(default_options)
|
123
|
+
end
|
119
124
|
|
125
|
+
if @wait
|
120
126
|
node = AePageObjects.wait_until { parent.node.first(*locator) }
|
121
|
-
|
122
|
-
node
|
127
|
+
else
|
128
|
+
node = parent.node.first(*locator)
|
129
|
+
raise LoadingElementFailed, 'Element Not Found' unless node
|
123
130
|
end
|
131
|
+
node.allow_reload!
|
132
|
+
node
|
124
133
|
rescue AePageObjects::WaitTimeoutError => e
|
125
134
|
raise LoadingElementFailed, e.message
|
126
135
|
end
|
@@ -15,32 +15,22 @@ module AePageObjects
|
|
15
15
|
@loaded_element = nil
|
16
16
|
end
|
17
17
|
|
18
|
-
def visible?
|
19
|
-
|
20
|
-
|
21
|
-
rescue ElementNotVisible
|
22
|
-
false
|
18
|
+
def visible?
|
19
|
+
reload_element
|
20
|
+
@loaded_element&.visible?
|
23
21
|
end
|
24
22
|
|
25
|
-
def hidden?
|
26
|
-
|
27
|
-
true
|
28
|
-
rescue ElementNotHidden
|
29
|
-
false
|
23
|
+
def hidden?
|
24
|
+
!visible?
|
30
25
|
end
|
31
26
|
|
32
|
-
def present?
|
33
|
-
|
34
|
-
|
35
|
-
rescue ElementNotPresent
|
36
|
-
false
|
27
|
+
def present?
|
28
|
+
reload_element
|
29
|
+
!@loaded_element.nil?
|
37
30
|
end
|
38
31
|
|
39
|
-
def absent?
|
40
|
-
|
41
|
-
true
|
42
|
-
rescue ElementNotAbsent
|
43
|
-
false
|
32
|
+
def absent?
|
33
|
+
!present?
|
44
34
|
end
|
45
35
|
|
46
36
|
def presence
|
@@ -123,8 +113,19 @@ module AePageObjects
|
|
123
113
|
|
124
114
|
private
|
125
115
|
|
126
|
-
def load_element
|
127
|
-
@
|
116
|
+
def load_element(wait: true)
|
117
|
+
args = @args.dup
|
118
|
+
|
119
|
+
options_or_locator = args.pop
|
120
|
+
options = if options_or_locator.is_a?(Hash)
|
121
|
+
options_or_locator.merge(wait: wait)
|
122
|
+
else
|
123
|
+
{ locator: options_or_locator, wait: wait }
|
124
|
+
end
|
125
|
+
|
126
|
+
args << options
|
127
|
+
|
128
|
+
@element_class.new(*args)
|
128
129
|
end
|
129
130
|
|
130
131
|
def implicit_element
|
@@ -132,7 +133,7 @@ module AePageObjects
|
|
132
133
|
end
|
133
134
|
|
134
135
|
def reload_element
|
135
|
-
@loaded_element = load_element
|
136
|
+
@loaded_element = load_element(wait: false)
|
136
137
|
rescue LoadingElementFailed
|
137
138
|
@loaded_element = nil
|
138
139
|
end
|
@@ -6,13 +6,13 @@ module AePageObjects
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def using_wait_time
|
9
|
-
start_time =
|
9
|
+
start_time = Time.now
|
10
10
|
@wait_time = [@wait_time, @max_time].min
|
11
11
|
Capybara.using_wait_time(@wait_time) do
|
12
12
|
yield
|
13
13
|
end
|
14
14
|
ensure
|
15
|
-
if
|
15
|
+
if Time.now - start_time > @wait_time
|
16
16
|
@wait_time *= 2
|
17
17
|
end
|
18
18
|
end
|
data/lib/ae_page_objects.rb
CHANGED
@@ -16,7 +16,7 @@ module AePageObjects
|
|
16
16
|
autoload :Checkbox, 'ae_page_objects/elements/checkbox'
|
17
17
|
|
18
18
|
class << self
|
19
|
-
attr_accessor :default_router
|
19
|
+
attr_accessor :default_router
|
20
20
|
|
21
21
|
def browser
|
22
22
|
@browser ||= begin
|
@@ -45,7 +45,7 @@ module AePageObjects
|
|
45
45
|
result = call_wait_until_block(error_message, &block)
|
46
46
|
else
|
47
47
|
seconds_to_wait ||= default_max_wait_time
|
48
|
-
start_time =
|
48
|
+
start_time = Time.now
|
49
49
|
|
50
50
|
# In an effort to avoid flakiness, Capybara waits, rescues errors, reloads nodes, and
|
51
51
|
# retries.
|
@@ -71,7 +71,7 @@ module AePageObjects
|
|
71
71
|
errors += [WaitTimeoutError]
|
72
72
|
raise e unless errors.include?(e.class)
|
73
73
|
|
74
|
-
delay = seconds_to_wait - (
|
74
|
+
delay = seconds_to_wait - (Time.now - start_time)
|
75
75
|
|
76
76
|
if delay <= 0
|
77
77
|
# Raising the WaitTimeoutError in the rescue block ensures that Ruby attaches
|
@@ -80,7 +80,7 @@ module AePageObjects
|
|
80
80
|
end
|
81
81
|
|
82
82
|
sleep(0.05)
|
83
|
-
raise FrozenInTime, "Time appears to be frozen" if
|
83
|
+
raise FrozenInTime, "Time appears to be frozen" if Time.now == start_time
|
84
84
|
|
85
85
|
retry
|
86
86
|
end
|
@@ -106,4 +106,3 @@ end
|
|
106
106
|
|
107
107
|
require 'ae_page_objects/core/basic_router'
|
108
108
|
AePageObjects.default_router = AePageObjects::BasicRouter.new
|
109
|
-
AePageObjects.time_keeper = Time
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_page_objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|