ae_page_objects 4.3.1.tim1 → 4.3.1.tim5

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: 7f569ecce06125424916611b6f8ebc2b78709c1b0d15e02f49e503b1aae0c845
4
- data.tar.gz: 374ef8d80600c7a74951a876235776598d124512ab4a6c758e722e38c7f4d20c
3
+ metadata.gz: a6795ea94086b882084a1277ca3106a196690d56b63c96f875627851c49a85e7
4
+ data.tar.gz: 5ad6dbc3077f2db4590597ab19a5d41bc71968b4ecdfbebd0a5212d8a377406c
5
5
  SHA512:
6
- metadata.gz: feddd6e4fefcbe544a2e104ea7b529776907fcf5781fc30c4880778391d625b07b649cfee2ea8ef8b03cd40513661465cd935156cfc40046e44ac4211834e52d
7
- data.tar.gz: 0efba04d353e4634b9cecc851bb5452545ecff929e218795813453f2a015c2e5a597a88593b26fdefbad07f55eeb4afbd6532d85f4a5baed922aa0988002a0ef
6
+ metadata.gz: feb8689c59272e92048748098034cbb26c790f354b513f36721bf7c07eb1045bf1e1bc2183958e7ed9ec553dd0fcc116c8ac593832d39fd1c8b7e93b07f7becc
7
+ data.tar.gz: 520a8ff36c6071ee05eef2ebcf348dcd101a7c0c6290d73037922b9abe90df9814666077681ed7f01d8cd926e3cd5b3818f360d43e7a37f0471c04ccb559e93f
@@ -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
- if locator.empty?
111
- parent.node
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 = { 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
122
+ locator.push(default_options)
123
+ end
119
124
 
125
+ if @wait
120
126
  node = AePageObjects.wait_until { parent.node.first(*locator) }
121
- node.allow_reload!
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
@@ -16,31 +16,21 @@ module AePageObjects
16
16
  end
17
17
 
18
18
  def visible?(options = {})
19
- wait_until_visible(0)
20
- true
21
- rescue ElementNotVisible
22
- false
19
+ reload_element
20
+ @loaded_element&.visible?
23
21
  end
24
22
 
25
23
  def hidden?(options = {})
26
- wait_until_hidden(0)
27
- true
28
- rescue ElementNotHidden
29
- false
24
+ !visible?
30
25
  end
31
26
 
32
27
  def present?(options = {})
33
- wait_until_present(0)
34
- true
35
- rescue ElementNotPresent
36
- false
28
+ reload_element
29
+ !@loaded_element.nil?
37
30
  end
38
31
 
39
32
  def absent?(options = {})
40
- wait_until_absent(0)
41
- true
42
- rescue ElementNotAbsent
43
- false
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
- @element_class.new(*@args)
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.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)
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
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '4.3.1.tim1'.freeze
2
+ VERSION = '4.3.1.tim5'.freeze
3
3
  end
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.3.1.tim1
4
+ version: 4.3.1.tim5
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: 1.3.1
81
81
  requirements: []
82
- rubygems_version: 3.1.4
82
+ rubygems_version: 3.1.2
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Capybara Page Objects pattern