capybara-wait_image 0.3.0 → 0.3.2
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 +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +1 -5
- data/Gemfile +0 -1
- data/README.md +0 -2
- data/capybara-wait_image.gemspec +1 -1
- data/lib/capybara/wait_image/version.rb +1 -1
- data/lib/capybara/wait_image.rb +15 -3
- metadata +4 -8
- data/Gemfile.lock +0 -115
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e203f6ea7d2388fd02cc2e1a03d06db7b17c61ef7772b8aa8080a90af9d42598
|
4
|
+
data.tar.gz: dbfa06d7ddcf503d8b7488b233934f18538d966774b6de477b409ab962c9df25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c85a9093caec17ae7427c4e5e7fddb9833f5b028d6d6c1a7df583eebb5ad7eb17a73006db0aa18a59cfe46c7a6d38ea5b5419db656d1d4ab7bb9f94d7b25bf8
|
7
|
+
data.tar.gz: 1885ac34ccd2c4034d9978fd5d3fdba7b3b09d637e90a3447b9094a1a17ead89285c867d11f9dc4e7040ae2499f53c10ac64bbe3c9502104f0ae7e7bdc999180
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,6 @@ The main cause of flaky tests in E2E tests using a browser is a click error caus
|
|
4
4
|
|
5
5
|
By adding this gem, the test will wait for the image to be displayed just before each click, hover, etc, thus improving the reliability of the test.
|
6
6
|
|
7
|
-
Currently, this gem supports only RSpec, so if you want to use it for other than RSpec, please submit a pull request.
|
8
|
-
|
9
7
|
## Installation
|
10
8
|
|
11
9
|
Install the gem and add to the application's Gemfile by executing:
|
data/capybara-wait_image.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Reduce click miss in E2E tests and increases test stability due to waiting for image to load automatically"
|
13
13
|
spec.homepage = "https://github.com/willnet/capybara-wait_image"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">=
|
15
|
+
spec.required_ruby_version = ">= 3.0.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/willnet/capybara-wait_image"
|
data/lib/capybara/wait_image.rb
CHANGED
@@ -6,6 +6,18 @@ require "capybara"
|
|
6
6
|
module Capybara
|
7
7
|
# Wait for image to load automatically
|
8
8
|
module WaitImage
|
9
|
+
def _stale_errors
|
10
|
+
return @_stale_errors if defined? @_stale_errors
|
11
|
+
|
12
|
+
@_stale_errors = []
|
13
|
+
if defined? ::Selenium::WebDriver::Error::StaleElementReferenceError
|
14
|
+
@_stale_errors << ::Selenium::WebDriver::Error::StaleElementReferenceError
|
15
|
+
end
|
16
|
+
@_stale_errors << ::Ferrum::NodeNotFoundError if defined? ::Ferrum::NodeNotFoundError
|
17
|
+
@_stale_errors << ::Capybara::Cuprite::ObsoleteNode if defined? ::Capybara::Cuprite::ObsoleteNode
|
18
|
+
@_stale_errors
|
19
|
+
end
|
20
|
+
|
9
21
|
def _wait_for_image_loading # rubocop:disable Metrics/MethodLength
|
10
22
|
Timeout.timeout(Capybara.default_max_wait_time) do
|
11
23
|
sleep 0.5 until evaluate_script(<<~JS)
|
@@ -19,8 +31,8 @@ module Capybara
|
|
19
31
|
_logger.debug "[capybara-wait_image]Timeout::Error"
|
20
32
|
rescue Capybara::NotSupportedByDriverError
|
21
33
|
# It comes here when you run it in rack-test, but you can ignore it
|
22
|
-
rescue
|
23
|
-
_logger.debug "[capybara-wait_image]
|
34
|
+
rescue *_stale_errors
|
35
|
+
_logger.debug "[capybara-wait_image]Stale Error"
|
24
36
|
reload
|
25
37
|
_wait_for_image_loading
|
26
38
|
end
|
@@ -39,7 +51,7 @@ module Capybara
|
|
39
51
|
@_logger ||= if defined?(Rails)
|
40
52
|
Rails.logger
|
41
53
|
else
|
42
|
-
Logger.new(
|
54
|
+
Logger.new(File::NULL)
|
43
55
|
end
|
44
56
|
end
|
45
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-wait_image
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: capybara
|
@@ -37,7 +36,6 @@ files:
|
|
37
36
|
- CHANGELOG.md
|
38
37
|
- CODE_OF_CONDUCT.md
|
39
38
|
- Gemfile
|
40
|
-
- Gemfile.lock
|
41
39
|
- LICENSE.txt
|
42
40
|
- README.md
|
43
41
|
- Rakefile
|
@@ -52,7 +50,6 @@ metadata:
|
|
52
50
|
homepage_uri: https://github.com/willnet/capybara-wait_image
|
53
51
|
source_code_uri: https://github.com/willnet/capybara-wait_image
|
54
52
|
changelog_uri: https://github.com/willnet/capybara-wait_image/releases
|
55
|
-
post_install_message:
|
56
53
|
rdoc_options: []
|
57
54
|
require_paths:
|
58
55
|
- lib
|
@@ -60,15 +57,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
57
|
requirements:
|
61
58
|
- - ">="
|
62
59
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
60
|
+
version: 3.0.0
|
64
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
62
|
requirements:
|
66
63
|
- - ">="
|
67
64
|
- !ruby/object:Gem::Version
|
68
65
|
version: '0'
|
69
66
|
requirements: []
|
70
|
-
rubygems_version: 3.
|
71
|
-
signing_key:
|
67
|
+
rubygems_version: 3.6.7
|
72
68
|
specification_version: 4
|
73
69
|
summary: Reduce click miss in E2E tests and increases test stability
|
74
70
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
capybara-wait_image (0.3.0)
|
5
|
-
capybara (~> 3.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.8.4)
|
11
|
-
public_suffix (>= 2.0.2, < 6.0)
|
12
|
-
ast (2.4.2)
|
13
|
-
capybara (3.39.1)
|
14
|
-
addressable
|
15
|
-
matrix
|
16
|
-
mini_mime (>= 0.1.3)
|
17
|
-
nokogiri (~> 1.8)
|
18
|
-
rack (>= 1.6.0)
|
19
|
-
rack-test (>= 0.6.3)
|
20
|
-
regexp_parser (>= 1.5, < 3.0)
|
21
|
-
xpath (~> 3.2)
|
22
|
-
diff-lcs (1.5.0)
|
23
|
-
json (2.6.3)
|
24
|
-
matrix (0.4.2)
|
25
|
-
mini_mime (1.1.2)
|
26
|
-
mustermann (3.0.0)
|
27
|
-
ruby2_keywords (~> 0.0.1)
|
28
|
-
nio4r (2.5.8)
|
29
|
-
nokogiri (1.14.0-arm64-darwin)
|
30
|
-
racc (~> 1.4)
|
31
|
-
nokogiri (1.14.0-x86_64-darwin)
|
32
|
-
racc (~> 1.4)
|
33
|
-
nokogiri (1.14.0-x86_64-linux)
|
34
|
-
racc (~> 1.4)
|
35
|
-
parallel (1.22.1)
|
36
|
-
parser (3.2.0.0)
|
37
|
-
ast (~> 2.4.1)
|
38
|
-
public_suffix (5.0.1)
|
39
|
-
puma (6.0.2)
|
40
|
-
nio4r (~> 2.0)
|
41
|
-
racc (1.6.2)
|
42
|
-
rack (2.2.6)
|
43
|
-
rack-protection (3.0.5)
|
44
|
-
rack
|
45
|
-
rack-test (2.1.0)
|
46
|
-
rack (>= 1.3)
|
47
|
-
rainbow (3.1.1)
|
48
|
-
rake (13.0.6)
|
49
|
-
regexp_parser (2.6.1)
|
50
|
-
rexml (3.2.5)
|
51
|
-
rspec (3.12.0)
|
52
|
-
rspec-core (~> 3.12.0)
|
53
|
-
rspec-expectations (~> 3.12.0)
|
54
|
-
rspec-mocks (~> 3.12.0)
|
55
|
-
rspec-core (3.12.0)
|
56
|
-
rspec-support (~> 3.12.0)
|
57
|
-
rspec-expectations (3.12.2)
|
58
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.12.0)
|
60
|
-
rspec-mocks (3.12.3)
|
61
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.12.0)
|
63
|
-
rspec-support (3.12.0)
|
64
|
-
rubocop (1.43.0)
|
65
|
-
json (~> 2.3)
|
66
|
-
parallel (~> 1.10)
|
67
|
-
parser (>= 3.2.0.0)
|
68
|
-
rainbow (>= 2.2.2, < 4.0)
|
69
|
-
regexp_parser (>= 1.8, < 3.0)
|
70
|
-
rexml (>= 3.2.5, < 4.0)
|
71
|
-
rubocop-ast (>= 1.24.1, < 2.0)
|
72
|
-
ruby-progressbar (~> 1.7)
|
73
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
74
|
-
rubocop-ast (1.24.1)
|
75
|
-
parser (>= 3.1.1.0)
|
76
|
-
ruby-progressbar (1.11.0)
|
77
|
-
ruby2_keywords (0.0.5)
|
78
|
-
rubyzip (2.3.2)
|
79
|
-
selenium-webdriver (4.7.1)
|
80
|
-
rexml (~> 3.2, >= 3.2.5)
|
81
|
-
rubyzip (>= 1.2.2, < 3.0)
|
82
|
-
websocket (~> 1.0)
|
83
|
-
sinatra (3.0.5)
|
84
|
-
mustermann (~> 3.0)
|
85
|
-
rack (~> 2.2, >= 2.2.4)
|
86
|
-
rack-protection (= 3.0.5)
|
87
|
-
tilt (~> 2.0)
|
88
|
-
tilt (2.0.11)
|
89
|
-
unicode-display_width (2.4.2)
|
90
|
-
webdrivers (5.2.0)
|
91
|
-
nokogiri (~> 1.6)
|
92
|
-
rubyzip (>= 1.3.0)
|
93
|
-
selenium-webdriver (~> 4.0)
|
94
|
-
websocket (1.2.9)
|
95
|
-
xpath (3.2.0)
|
96
|
-
nokogiri (~> 1.8)
|
97
|
-
|
98
|
-
PLATFORMS
|
99
|
-
arm64-darwin-21
|
100
|
-
arm64-darwin-22
|
101
|
-
x86_64-darwin-22
|
102
|
-
x86_64-linux
|
103
|
-
|
104
|
-
DEPENDENCIES
|
105
|
-
capybara-wait_image!
|
106
|
-
puma
|
107
|
-
rake (~> 13.0)
|
108
|
-
rspec (~> 3.0)
|
109
|
-
rubocop (~> 1.21)
|
110
|
-
selenium-webdriver
|
111
|
-
sinatra (~> 3.0)
|
112
|
-
webdrivers
|
113
|
-
|
114
|
-
BUNDLED WITH
|
115
|
-
2.3.4
|