capybara 2.14.1 → 2.14.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dc6b7471732df96709e856d00f104f1e2f43aac
|
4
|
+
data.tar.gz: 7c8e722e733587c8f3854e461f7e5ab168a93c26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18629cb7fd46d4d80ee6de85508ebd7349ee9544cf0653b421c4184e13a289edad3da27a5ba7eeca44a3921c7b0db24de9d7440c56955a97d8b9dfa4d7b8ac0e
|
7
|
+
data.tar.gz: 81ec7b11745dfc178f4c1c9c57d7b6dbc0f56b1f5ec68bde85ed3375fee04fcd9ed7f4c6a19a040b13556400933e67a4c246bc0873e7b02370ec17ea251cf1f3
|
data/History.md
CHANGED
@@ -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
|
data/lib/capybara/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|