capybara-timeout_reporter 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03703999c0f4fd8d190a040d1841e44a3f4e854d
4
+ data.tar.gz: 3d0933e28205bdfd4d893d343a84ad99cdbea023
5
+ SHA512:
6
+ metadata.gz: 1c8d91abedf02fa191b066c11dda154072c3c3bba5199a30c98a68d2a618e9498fe9e56eac98979fc3f4b5302b20ee6aeef8b69f641fc7e3297075daf1da259c
7
+ data.tar.gz: 5fcfbc394e8b8c63e993c095fc678d4d3f8992d5e4ee8c1b7bc61ec91d07f4035dd0bc01dbf78a8da7e605965fe2c7c74a41b7c8246279b3ea09615798176c7e
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capybara-timeout_reporter.rb.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Vitalii Grygoruk
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # Capybara::TimeoutReporter
2
+
3
+ Speed up your Capybara tests by detecting and fixing finders that reach sync timeout.
4
+
5
+ ## Contributing
6
+
7
+ 1. Fork it `https://github.com/vgiroguk/capybara-timeout_reporter/fork`
8
+ 2. Create your feature branch (`git checkout -b new-feature`)
9
+ 3. Commit your changes (`git commit -am 'Added feature'`)
10
+ 4. Push to the branch (`git push origin new-feature`)
11
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "capybara-timeout_reporter"
5
+ spec.version = "0.0.2"
6
+ spec.authors = ["Vitalii Grygoruk"]
7
+ spec.email = ["vitaliy[dot]grigoruk[at]gmail[dot]com"]
8
+ spec.summary = %q{Detecting and reporting capybara sync timeouts}
9
+ spec.description = %q{Allows you to execute a block or raise a warning if you use a finder that reaches capybara's timeout.}
10
+ spec.homepage = "https://github.com/vgrigoruk/capybara-timeout_reporter"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0")
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_development_dependency "bundler", "~> 1.7"
19
+ spec.add_development_dependency "rake", "~> 10.0"
20
+ spec.add_dependency "capybara", "~> 2.0"
21
+ end
@@ -0,0 +1,36 @@
1
+ require 'capybara'
2
+
3
+ module Capybara
4
+ class TimeoutReporter
5
+ @on_timeout = Proc.new do |seconds, src_line|
6
+ puts "[WARNING] Capybara find timed out after #{seconds} seconds in #{src_line}"
7
+ end
8
+
9
+ class << self
10
+ attr_accessor :on_timeout
11
+ end
12
+
13
+ def self.on_timeout=(proc)
14
+ @on_timeout = proc
15
+ end
16
+ end
17
+
18
+ module Node
19
+ class Base
20
+ def synchronize_with_warning(seconds=Capybara.default_wait_time, options = {}, &block)
21
+ start_time = Time.now
22
+ synchronize_without_warning(seconds, options, &block)
23
+ rescue Capybara::ElementNotFound => e
24
+ if Time.now-start_time > seconds
25
+ trace_line = Thread.current.backtrace.find { |l| !l.include?('gems/capybara')}
26
+ src_line = trace_line.match(/(.*):.*/).captures.first
27
+ Capybara::TimeoutReporter.on_timeout.call(seconds, src_line)
28
+ end
29
+ raise e
30
+ end
31
+
32
+ alias_method :synchronize_without_warning, :synchronize
33
+ alias_method :synchronize, :synchronize_with_warning
34
+ end
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capybara-timeout_reporter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Vitalii Grygoruk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capybara
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ description: Allows you to execute a block or raise a warning if you use a finder
56
+ that reaches capybara's timeout.
57
+ email:
58
+ - vitaliy[dot]grigoruk[at]gmail[dot]com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - capybara-timeout_reporter.gemspec
69
+ - lib/capybara/timeout_reporter.rb
70
+ homepage: https://github.com/vgrigoruk/capybara-timeout_reporter
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.2.2
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Detecting and reporting capybara sync timeouts
94
+ test_files: []