ae_page_objects 4.0.1 → 4.3.1.tim1

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
- SHA1:
3
- metadata.gz: db1d397fb998ff6d6fce4f99c5c23903023dd1f6
4
- data.tar.gz: 8adbae2a2d9c88068b591e901e46568a872fbfa0
2
+ SHA256:
3
+ metadata.gz: 7f569ecce06125424916611b6f8ebc2b78709c1b0d15e02f49e503b1aae0c845
4
+ data.tar.gz: 374ef8d80600c7a74951a876235776598d124512ab4a6c758e722e38c7f4d20c
5
5
  SHA512:
6
- metadata.gz: 7dce44727da3a23632fc2d796a8aca93cb560ef9d6cceff31b7b22b14bb919644d09add3d41f61c0d904605c9c26fa7d773bd213f0a9b5489946ebcd302bb14a
7
- data.tar.gz: 80be52c061e4fb9e3c23e03e0b681ae65d262569ca76a19d60bab6e2e70c5f2359ad20c86ff7cbff46a7b347681cdb1459272ef87ac6870469ccb5fdc4968c07
6
+ metadata.gz: feddd6e4fefcbe544a2e104ea7b529776907fcf5781fc30c4880778391d625b07b649cfee2ea8ef8b03cd40513661465cd935156cfc40046e44ac4211834e52d
7
+ data.tar.gz: 0efba04d353e4634b9cecc851bb5452545ecff929e218795813453f2a015c2e5a597a88593b26fdefbad07f55eeb4afbd6532d85f4a5baed922aa0988002a0ef
@@ -32,7 +32,25 @@ module AePageObjects
32
32
  full_path = router.generate_path(path, *args)
33
33
  raise PathNotResolvable, "#{self.name} not visitable via #{paths.first}(#{args.inspect})" unless full_path
34
34
 
35
- Capybara.current_session.visit(full_path)
35
+ load_retries = 0
36
+ begin
37
+ Capybara.current_session.visit(full_path)
38
+ rescue Net::ReadTimeout
39
+ # A Net::ReadTimeout can occur when the current session was already in the progress of loading
40
+ # a page. This is fairly common and happens in situations like below:
41
+ # 1. the test performs an action that causes the page to reload
42
+ # 2. an assertion is made on the new page
43
+ # 3. the test then loads a different page
44
+ # Its possible for the assertion in #2 above to happen before the page is fully loaded, in which
45
+ # case the page load in #3 can fail with Net::ReadTimeout.
46
+ # In this situation the easiest thing to do is to retry
47
+ if load_retries < 3
48
+ load_retries += 1
49
+ retry
50
+ else
51
+ raise
52
+ end
53
+ end
36
54
 
37
55
  new
38
56
  end
@@ -16,28 +16,28 @@ module AePageObjects
16
16
  end
17
17
 
18
18
  def visible?(options = {})
19
- wait_until_visible(options[:wait])
19
+ wait_until_visible(0)
20
20
  true
21
21
  rescue ElementNotVisible
22
22
  false
23
23
  end
24
24
 
25
25
  def hidden?(options = {})
26
- wait_until_hidden(options[:wait])
26
+ wait_until_hidden(0)
27
27
  true
28
28
  rescue ElementNotHidden
29
29
  false
30
30
  end
31
31
 
32
32
  def present?(options = {})
33
- wait_until_present(options[:wait])
33
+ wait_until_present(0)
34
34
  true
35
35
  rescue ElementNotPresent
36
36
  false
37
37
  end
38
38
 
39
39
  def absent?(options = {})
40
- wait_until_absent(options[:wait])
40
+ wait_until_absent(0)
41
41
  true
42
42
  rescue ElementNotAbsent
43
43
  false
@@ -41,7 +41,19 @@ module AePageObjects
41
41
  end
42
42
 
43
43
  def size
44
- node.all(:xpath, item_xpath, options.merge(wait: false)).size
44
+ #
45
+ # In some cases when #size is called while the DOM is updating, Capybara
46
+ # will catch (and swallow) underlying exceptions such as
47
+ # `Selenium::WebDriver::Error::StaleElementReferenceError`.
48
+ # When this happens it will wait up to the max wait time, which can cause
49
+ # issues for `AePageObjects.wait_until` blocks.
50
+ #
51
+ # To prevent this issue the #all and #size calls are made with the Capybara
52
+ # wait time set to 0.
53
+ #
54
+ Capybara.using_wait_time(0) do
55
+ node.all(:xpath, item_xpath, options).size
56
+ end
45
57
  end
46
58
 
47
59
  def last
@@ -133,12 +133,12 @@ module AePageObjects
133
133
  private
134
134
 
135
135
  def recognizer
136
- @recognizer ||= case ::Rails.version
137
- when /\A3\.[01]/
136
+ @recognizer ||= case ::Rails.gem_version
137
+ when Gem::Requirement.new('>= 3.0', '< 3.2')
138
138
  Recognizer::Rails3.new
139
- when /\A3\.2/
139
+ when Gem::Requirement.new('~> 3.2')
140
140
  Recognizer::Rails32.new
141
- when /\A(4\.[012]|5\.0)/
141
+ when Gem::Requirement.new('>= 4.0', '< 7.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 = '4.0.1'.freeze
2
+ VERSION = '4.3.1.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: 4.0.1
4
+ version: 4.3.1.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: 2018-05-07 00:00:00.000000000 Z
11
+ date: 2021-03-18 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
@@ -75,13 +75,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
75
  version: 2.2.5
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ">="
78
+ - - ">"
79
79
  - !ruby/object:Gem::Version
80
- version: '0'
80
+ version: 1.3.1
81
81
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.5.2
84
- signing_key:
82
+ rubygems_version: 3.1.4
83
+ signing_key:
85
84
  specification_version: 4
86
85
  summary: Capybara Page Objects pattern
87
86
  test_files: []