capybara-headless_chrome 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 8cc9d89c93d37d2fc503e918c6f694aee844b554
4
- data.tar.gz: 2cd155dd480fb7e8bb7e36c8a03dc440abb994b3
3
+ metadata.gz: ef4f12c23030bdb00d8c24f495d8ebe76689b2ff
4
+ data.tar.gz: fc54211a643936f225f6a7a50c16bf37d99b0074
5
5
  SHA512:
6
- metadata.gz: e66250cff62ceddd3adfd3afb7f0f5a13ea9cf99aec4bb690933f3a2fe09f1af558adebec967ebb0c77538b3d26c5cd1ca660e13d8bbc0c88d48f677da0bb9f0
7
- data.tar.gz: a1bd9bc702df494dfa1edfb39fa8af4e078872e2c96516664f602220eafffa7b0495ff9be276e516c6302572e38ae80f04a97aeab0491982b5612562ee4c5ac0
6
+ metadata.gz: af7ac8e05e5a984067441fd4ff969a3ac2fd38ae2c305e63a6bfe44be3fae681b88191d099f8591d9214f61e14f1f7d7a91d073f8836732fe6c784743214a075
7
+ data.tar.gz: 41691d7b8f3d1f006c03a7de7bebb3b9a61f3ff3c21e3797e275f4b40f537f8aa4a982b579f9400a7e5d4097e0f3a67400929172c588c7106307afe22c8db741
@@ -2,3 +2,16 @@ Before do
2
2
  page.downloads.reset
3
3
  end
4
4
 
5
+ AfterStep do
6
+ aggregate_failures 'javascript errors' do
7
+ page.javascript_errors.each do |error|
8
+ fail error
9
+ end
10
+ end
11
+
12
+ page.javascript_warnings.each do |warning|
13
+ STDERR.puts 'WARN: javascript warning'
14
+ STDERR.puts warning
15
+ end
16
+ end
17
+
@@ -16,8 +16,24 @@ module Capybara
16
16
  @downloads ||= Downloads.new
17
17
  end
18
18
 
19
+ def javascript_errors
20
+ console_entries level: "SEVERE"
21
+ end
22
+
23
+ def javascript_warnings
24
+ console_entries level: "WARNING"
25
+ end
26
+
19
27
  private
20
28
 
29
+ def console_entries level: nil
30
+ browser.manage.logs.get(:browser)
31
+ .select {|e| level ? e.level == level : true }
32
+ .map(&:message)
33
+ .select(&:present?)
34
+ .to_a
35
+ end
36
+
21
37
  def chrome_capabilities args
22
38
  ::Selenium::WebDriver::Remote::Capabilities.chrome(
23
39
  chromeOptions: {
@@ -4,6 +4,14 @@ module Capybara
4
4
  def downloads
5
5
  driver.downloads
6
6
  end
7
+
8
+ def javascript_errors
9
+ driver.javascript_errors
10
+ end
11
+
12
+ def javascript_warnings
13
+ driver.javascript_warnings
14
+ end
7
15
  end
8
16
  end
9
17
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module HeadlessChrome
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-headless_chrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-18 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chromedriver-helper