ae_page_objects 4.3.1.tim5 → 4.4.0.pre.rc.1
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: a81fd3e14e49322c4e0ca92ce91305800f7edde065a25f78776cadbeb1192de9
|
4
|
+
data.tar.gz: 3bacbc5553b90bc2e43ffec38a2d2f4de72544f0ec0c3932df0f0901852877e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b01d530f561624b31f84d6cd50c79380c553e08df964c34cd2316ee2923b913853f3eb69f5dfbb446ef77ab81f6b515b31739dab4615fd452b60d0e735fe939
|
7
|
+
data.tar.gz: c6495b4e601622233ce5f9bed97612fb51cd37a0db4d9c577637c3babad5caec4418a5ab1d26f8b75c3061200d1d5a51fd181af99f66c43534d4267ec87dd488
|
@@ -89,11 +89,6 @@ 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
|
97
92
|
|
98
93
|
@name = @name.to_s if @name
|
99
94
|
end
|
@@ -112,24 +107,20 @@ module AePageObjects
|
|
112
107
|
|
113
108
|
def scoped_node
|
114
109
|
locator = eval_locator(@locator)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
default_options = { minimum: 0 }
|
119
|
-
if locator.last.is_a?(::Hash)
|
120
|
-
locator[-1] = default_options.merge(locator.last)
|
110
|
+
if locator.empty?
|
111
|
+
parent.node
|
121
112
|
else
|
122
|
-
|
123
|
-
|
113
|
+
default_options = { minimum: 0 }
|
114
|
+
if locator.last.is_a?(::Hash)
|
115
|
+
locator[-1] = default_options.merge(locator.last)
|
116
|
+
else
|
117
|
+
locator.push(default_options)
|
118
|
+
end
|
124
119
|
|
125
|
-
if @wait
|
126
120
|
node = AePageObjects.wait_until { parent.node.first(*locator) }
|
127
|
-
|
128
|
-
node
|
129
|
-
raise LoadingElementFailed, 'Element Not Found' unless node
|
121
|
+
node.allow_reload!
|
122
|
+
node
|
130
123
|
end
|
131
|
-
node.allow_reload!
|
132
|
-
node
|
133
124
|
rescue AePageObjects::WaitTimeoutError => e
|
134
125
|
raise LoadingElementFailed, e.message
|
135
126
|
end
|
@@ -16,21 +16,31 @@ module AePageObjects
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def visible?(options = {})
|
19
|
-
|
20
|
-
|
19
|
+
wait_until_visible(options[:wait])
|
20
|
+
true
|
21
|
+
rescue ElementNotVisible
|
22
|
+
false
|
21
23
|
end
|
22
24
|
|
23
25
|
def hidden?(options = {})
|
24
|
-
|
26
|
+
wait_until_hidden(options[:wait])
|
27
|
+
true
|
28
|
+
rescue ElementNotHidden
|
29
|
+
false
|
25
30
|
end
|
26
31
|
|
27
32
|
def present?(options = {})
|
28
|
-
|
29
|
-
|
33
|
+
wait_until_present(options[:wait])
|
34
|
+
true
|
35
|
+
rescue ElementNotPresent
|
36
|
+
false
|
30
37
|
end
|
31
38
|
|
32
39
|
def absent?(options = {})
|
33
|
-
|
40
|
+
wait_until_absent(options[:wait])
|
41
|
+
true
|
42
|
+
rescue ElementNotAbsent
|
43
|
+
false
|
34
44
|
end
|
35
45
|
|
36
46
|
def presence
|
@@ -113,19 +123,8 @@ module AePageObjects
|
|
113
123
|
|
114
124
|
private
|
115
125
|
|
116
|
-
def load_element
|
117
|
-
|
118
|
-
|
119
|
-
options_or_locator = args.pop
|
120
|
-
options = if options_or_locator.is_a?(Hash)
|
121
|
-
options_or_locator.dup.merge(wait: wait)
|
122
|
-
else
|
123
|
-
{ locator: options_or_locator, wait: wait }
|
124
|
-
end
|
125
|
-
|
126
|
-
args << options
|
127
|
-
|
128
|
-
@element_class.new(*args)
|
126
|
+
def load_element
|
127
|
+
@element_class.new(*@args)
|
129
128
|
end
|
130
129
|
|
131
130
|
def implicit_element
|
@@ -133,7 +132,7 @@ module AePageObjects
|
|
133
132
|
end
|
134
133
|
|
135
134
|
def reload_element
|
136
|
-
@loaded_element = load_element
|
135
|
+
@loaded_element = load_element
|
137
136
|
rescue LoadingElementFailed
|
138
137
|
@loaded_element = nil
|
139
138
|
end
|
@@ -6,13 +6,13 @@ module AePageObjects
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def using_wait_time
|
9
|
-
start_time =
|
9
|
+
start_time = AePageObjects.time_keeper.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 AePageObjects.time_keeper.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, :time_keeper
|
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 = AePageObjects.time_keeper.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 - (AePageObjects.time_keeper.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 AePageObjects.time_keeper.now == start_time
|
84
84
|
|
85
85
|
retry
|
86
86
|
end
|
@@ -106,3 +106,4 @@ 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.
|
4
|
+
version: 4.4.0.pre.rc.1
|
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: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|