ae_page_objects 5.0.0.pre1 → 5.0.0.tim1

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
- SHA256:
3
- metadata.gz: 050326bd45948e6541587873da40715708f854333d9965816e0d7d78d54d33bb
4
- data.tar.gz: baaa65ec6da2ef99f462d2259e8add8920654897e078dabe2b0b237c7f57b390
2
+ SHA1:
3
+ metadata.gz: dbfd8677597cf0026b13d31f3a468148cedab2df
4
+ data.tar.gz: 7385fcd650b5ea30d077e6fd7fcc23c997808fc1
5
5
  SHA512:
6
- metadata.gz: 370ec5c9073399673f4cd498b35440319c8c81677d4c198a835a6ed56d8859da8333129315b1306119e9e6ac6559a2fc412c0e51c81f7fcfe0414ef907779305
7
- data.tar.gz: 694053ed1cf77a4258c8c68a4652f02f6ec5a52b778e77f79d78d881610416e693b5cc19c4ce427e01c60a7b7bc92d38ec4f4f4656331221bd158028cef10ecb
6
+ metadata.gz: d1bd1f9f15668d99c7ed9e9ff604bd54d23b5159d702b01188194b51fcc145614dc960bf242216fd7b7976b909523dc06a226e465cc5b4599c9b2b87d37665b1
7
+ data.tar.gz: 2de8621bfc85d7c66306af7c9761e3b0a57692bc307c97e2df1a23f003334867be5dd2cd039d5051c05add08e0e1dd1199972630ce2ddb1dba9ceb0b148d2fa2
@@ -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
- 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)
110
+ if locator.empty?
111
+ parent.node
121
112
  else
122
- locator.push(default_options)
123
- end
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
- else
128
- node = parent.node.first(*locator)
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
@@ -15,22 +15,36 @@ module AePageObjects
15
15
  @loaded_element = nil
16
16
  end
17
17
 
18
- def visible?
19
- reload_element
20
- @loaded_element&.visible?
18
+ def visible?(options = {})
19
+ options[:wait] ||= 0
20
+ wait_until_visible(options[:wait])
21
+ true
22
+ rescue ElementNotVisible
23
+ false
21
24
  end
22
25
 
23
- def hidden?
24
- !visible?
26
+ def hidden?(options = {})
27
+ options[:wait] ||= 0
28
+ wait_until_hidden(options[:wait])
29
+ true
30
+ rescue ElementNotHidden
31
+ false
25
32
  end
26
33
 
27
- def present?
28
- reload_element
29
- !@loaded_element.nil?
34
+ def present?(options = {})
35
+ options[:wait] ||= 0
36
+ wait_until_present(options[:wait])
37
+ true
38
+ rescue ElementNotPresent
39
+ false
30
40
  end
31
41
 
32
- def absent?
33
- !present?
42
+ def absent?(options = {})
43
+ options[:wait] ||= 0
44
+ wait_until_absent(options[:wait])
45
+ true
46
+ rescue ElementNotAbsent
47
+ false
34
48
  end
35
49
 
36
50
  def presence
@@ -113,19 +127,8 @@ module AePageObjects
113
127
 
114
128
  private
115
129
 
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)
130
+ def load_element
131
+ @element_class.new(*@args)
129
132
  end
130
133
 
131
134
  def implicit_element
@@ -133,7 +136,7 @@ module AePageObjects
133
136
  end
134
137
 
135
138
  def reload_element
136
- @loaded_element = load_element(wait: false)
139
+ @loaded_element = load_element
137
140
  rescue LoadingElementFailed
138
141
  @loaded_element = nil
139
142
  end
@@ -133,12 +133,12 @@ module AePageObjects
133
133
  private
134
134
 
135
135
  def recognizer
136
- @recognizer ||= case ::Rails.gem_version
137
- when Gem::Requirement.new('>= 3.0', '< 3.2')
136
+ @recognizer ||= case ::Rails.version
137
+ when /\A3\.[01]/
138
138
  Recognizer::Rails3.new
139
- when Gem::Requirement.new('~> 3.2')
139
+ when /\A3\.2/
140
140
  Recognizer::Rails32.new
141
- when Gem::Requirement.new('>= 4.0', '< 7.0')
141
+ when /\A(4\.[012]|5\.0)/
142
142
  Recognizer::Rails4Plus.new
143
143
  else
144
144
  warn "[WARNING]: AePageObjects is not tested against Rails #{::Rails.version} and may behave in an undefined manner."
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '5.0.0.pre1'.freeze
2
+ VERSION = '5.0.0.tim1'.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: 5.0.0.pre1
4
+ version: 5.0.0.tim1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio Engineering
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -64,7 +64,7 @@ homepage: http://github.com/appfolio/ae_page_objects
64
64
  licenses:
65
65
  - MIT
66
66
  metadata: {}
67
- post_install_message:
67
+ post_install_message:
68
68
  rdoc_options: []
69
69
  require_paths:
70
70
  - lib
@@ -79,8 +79,9 @@ 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.2
83
- signing_key:
82
+ rubyforge_project:
83
+ rubygems_version: 2.5.2
84
+ signing_key:
84
85
  specification_version: 4
85
86
  summary: Capybara Page Objects pattern
86
87
  test_files: []