capybara 2.14.1 → 2.14.2

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: f26eecbab15830d1234ded90963559b1bcc5a189
4
- data.tar.gz: 1c53aa8f1da2909f235f41c778b48c0633749025
3
+ metadata.gz: 2dc6b7471732df96709e856d00f104f1e2f43aac
4
+ data.tar.gz: 7c8e722e733587c8f3854e461f7e5ab168a93c26
5
5
  SHA512:
6
- metadata.gz: 5d610898b0ab9dd9d8cdddc43de6e4933d041bc48bf38882865537986d5851e1ee24de44bbc172ea825a69dfe1ae4e98acc42269c0f86869cf54cc213da825b7
7
- data.tar.gz: 6c7cc0c84a10b0b10f3990ab570cd065cdb329ec0ef3f55304d4fb6f66fa53e6e4498239e4c364fb80d9fedcf3c52bf5712f7d4131169c74e95b586c02c569f7
6
+ metadata.gz: 18629cb7fd46d4d80ee6de85508ebd7349ee9544cf0653b421c4184e13a289edad3da27a5ba7eeca44a3921c7b0db24de9d7440c56955a97d8b9dfa4d7b8ac0e
7
+ data.tar.gz: 81ec7b11745dfc178f4c1c9c57d7b6dbc0f56b1f5ec68bde85ed3375fee04fcd9ed7f4c6a19a040b13556400933e67a4c246bc0873e7b02370ec17ea251cf1f3
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ # Version 2.14.2
2
+
3
+ Release date: 2017-06-09
4
+
5
+ ### Fixed
6
+
7
+ * Workaround for system modals when using headless Chrome now works if the page changes
8
+
1
9
  # Version 2.14.1
2
10
 
3
11
  Release date: 2017-06-07
@@ -368,6 +368,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
368
368
  prompt: window.prompt,
369
369
  confirm: window.confirm,
370
370
  alert: window.alert,
371
+ called: false
371
372
  }
372
373
  window.capybara.add_handler(modal_handler);
373
374
 
@@ -420,15 +421,19 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
420
421
  ignore: Selenium::WebDriver::Error::NoAlertPresentError)
421
422
  begin
422
423
  wait.until do
423
- called, alert_text = evaluate_script('window.capybara.current_modal_status()')
424
+ called, alert_text = evaluate_script('window.capybara && window.capybara.current_modal_status()')
424
425
  if called
425
- execute_script('window.capybara.modal_handlers.shift()')
426
+ execute_script('window.capybara && window.capybara.modal_handlers.shift()')
426
427
  regexp = options[:text].is_a?(Regexp) ? options[:text] : Regexp.escape(options[:text].to_s)
427
428
  if alert_text.match(regexp)
428
429
  alert_text
429
430
  else
430
431
  raise Capybara::ModalNotFound.new("Unable to find modal dialog#{" with #{options[:text]}" if options[:text]}")
431
432
  end
433
+ elsif called.nil?
434
+ # page changed so modal_handler data has gone away
435
+ warn "Can't verify modal text when page change occurs - ignoring" if options[:text]
436
+ ""
432
437
  else
433
438
  nil
434
439
  end
@@ -87,6 +87,10 @@ $(function() {
87
87
  $(link).attr('opened', 'true');
88
88
  }, 3000);
89
89
  });
90
+ $('#alert-page-change').click(function() {
91
+ alert('Page is changing');
92
+ return true;
93
+ });
90
94
  $('#open-confirm').click(function() {
91
95
  if(confirm('Confirm opened')) {
92
96
  $(this).attr('confirmed', 'true');
@@ -47,6 +47,14 @@ Capybara::SpecHelper.spec '#accept_alert', requires: [:modals] do
47
47
  expect(message).to eq('Alert opened [*Yay?*]')
48
48
  end
49
49
 
50
+ it "should handle the alert if the page changes" do
51
+ @session.accept_alert do
52
+ @session.click_link('Alert page change')
53
+ sleep 1 # ensure page change occurs before the accept_alert block exits
54
+ end
55
+ expect(@session).to have_current_path('/with_html')
56
+ end
57
+
50
58
  context "with an asynchronous alert" do
51
59
  it "should accept the alert" do
52
60
  @session.accept_alert do
@@ -76,6 +76,7 @@
76
76
 
77
77
  <p>
78
78
  <a href="#" id="open-alert">Open alert</a>
79
+ <a href="/with_html" id="alert-page-change">Alert page change</a>
79
80
  </p>
80
81
 
81
82
  <p>
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Capybara
3
- VERSION = '2.14.1'
3
+ VERSION = '2.14.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.1
4
+ version: 2.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Walpole
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - gem-public_cert.pem
13
- date: 2017-06-07 00:00:00.000000000 Z
13
+ date: 2017-06-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri