capybara-webkit 1.5.0 → 1.5.1
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/Gemfile.lock +1 -1
- data/lib/capybara/webkit/version.rb +1 -1
- data/spec/driver_spec.rb +40 -1
- data/src/WebPageManager.cpp +9 -0
- data/src/WebPageManager.h +1 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfdf16446ea82ddfb76352fcddb30f280a252622
|
4
|
+
data.tar.gz: 036edb4e104031410e3babac1c4d2076e83df99f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76fe34598fef3fd313303b5d0665ca5184f63a98d066bef64a0c7f8e59ef03fc847e75df354d7836532d97710a862fb3f0ad9cae1b02adc82766c3c08e9fcf2
|
7
|
+
data.tar.gz: 62163e9a180e75705c4df3af95fa79fa57479b5fec24421f3cb023345fe4cff695312c802b6d8b69d9c36097f36440a306c7ee26178351c3a7dcfbf706510c03
|
data/Gemfile.lock
CHANGED
data/spec/driver_spec.rb
CHANGED
@@ -7,7 +7,7 @@ require 'base64'
|
|
7
7
|
describe Capybara::Webkit::Driver do
|
8
8
|
include AppRunner
|
9
9
|
|
10
|
-
def visit(url, driver=driver)
|
10
|
+
def visit(url, driver=self.driver)
|
11
11
|
driver.visit("#{AppRunner.app_host}#{url}")
|
12
12
|
end
|
13
13
|
|
@@ -675,6 +675,31 @@ describe Capybara::Webkit::Driver do
|
|
675
675
|
HTML
|
676
676
|
end
|
677
677
|
|
678
|
+
get '/ajax' do
|
679
|
+
<<-HTML
|
680
|
+
<html>
|
681
|
+
<head>
|
682
|
+
</head>
|
683
|
+
<body>
|
684
|
+
<script type="text/javascript">
|
685
|
+
function testAlert() {
|
686
|
+
var xhr = new XMLHttpRequest();
|
687
|
+
xhr.open('GET', '/slow', true);
|
688
|
+
xhr.setRequestHeader('Content-Type', 'text/plain');
|
689
|
+
xhr.onreadystatechange = function () {
|
690
|
+
if (xhr.readyState == 4) {
|
691
|
+
alert('From ajax');
|
692
|
+
}
|
693
|
+
};
|
694
|
+
xhr.send();
|
695
|
+
}
|
696
|
+
</script>
|
697
|
+
<input type="button" onclick="testAlert()" name="test"/>
|
698
|
+
</body>
|
699
|
+
</html>
|
700
|
+
HTML
|
701
|
+
end
|
702
|
+
|
678
703
|
get '/double' do
|
679
704
|
<<-HTML
|
680
705
|
<html>
|
@@ -689,6 +714,11 @@ describe Capybara::Webkit::Driver do
|
|
689
714
|
</html>
|
690
715
|
HTML
|
691
716
|
end
|
717
|
+
|
718
|
+
get '/slow' do
|
719
|
+
sleep 0.5
|
720
|
+
""
|
721
|
+
end
|
692
722
|
end
|
693
723
|
end
|
694
724
|
|
@@ -761,6 +791,15 @@ describe Capybara::Webkit::Driver do
|
|
761
791
|
driver.reset!
|
762
792
|
driver.alert_messages.should be_empty
|
763
793
|
end
|
794
|
+
|
795
|
+
it "clears alerts from ajax requests in between sessions" do
|
796
|
+
visit("/ajax")
|
797
|
+
driver.find("//input").first.click
|
798
|
+
driver.reset!
|
799
|
+
sleep 0.5
|
800
|
+
driver.alert_messages.should eq([])
|
801
|
+
expect { visit("/") }.not_to raise_error
|
802
|
+
end
|
764
803
|
end
|
765
804
|
|
766
805
|
context "on a confirm app" do
|
data/src/WebPageManager.cpp
CHANGED
@@ -90,6 +90,7 @@ void WebPageManager::requestCreated(QByteArray &url, QNetworkReply *reply) {
|
|
90
90
|
if (reply->isFinished())
|
91
91
|
replyFinished(reply);
|
92
92
|
else {
|
93
|
+
m_pendingReplies.append(reply);
|
93
94
|
connect(reply, SIGNAL(finished()), SLOT(handleReplyFinished()));
|
94
95
|
}
|
95
96
|
}
|
@@ -103,6 +104,7 @@ void WebPageManager::handleReplyFinished() {
|
|
103
104
|
void WebPageManager::replyFinished(QNetworkReply *reply) {
|
104
105
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
105
106
|
logger() << "Received" << status << "from" << reply->url().toString();
|
107
|
+
m_pendingReplies.removeAll(reply);
|
106
108
|
}
|
107
109
|
|
108
110
|
void WebPageManager::setPageStatus(bool success) {
|
@@ -144,6 +146,13 @@ void WebPageManager::reset() {
|
|
144
146
|
m_currentPage->resetLocalStorage();
|
145
147
|
m_blacklistedRequestHandler->reset();
|
146
148
|
m_unknownUrlHandler->reset();
|
149
|
+
|
150
|
+
foreach(QNetworkReply *reply, m_pendingReplies) {
|
151
|
+
logger() << "Aborting request to" << reply->url().toString();
|
152
|
+
reply->abort();
|
153
|
+
}
|
154
|
+
m_pendingReplies.clear();
|
155
|
+
|
147
156
|
while (!m_pages.isEmpty()) {
|
148
157
|
WebPage *page = m_pages.takeFirst();
|
149
158
|
page->deleteLater();
|
data/src/WebPageManager.h
CHANGED
@@ -58,6 +58,7 @@ class WebPageManager : public QObject {
|
|
58
58
|
static void handleDebugMessage(QtMsgType type, const char *message);
|
59
59
|
|
60
60
|
QList<WebPage *> m_pages;
|
61
|
+
QList<QNetworkReply *> m_pendingReplies;
|
61
62
|
WebPage *m_currentPage;
|
62
63
|
bool m_ignoreSslErrors;
|
63
64
|
NetworkCookieJar *m_cookieJar;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-webkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2015-
|
16
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: capybara
|
@@ -396,8 +396,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
396
396
|
version: '0'
|
397
397
|
requirements: []
|
398
398
|
rubyforge_project:
|
399
|
-
rubygems_version: 2.
|
399
|
+
rubygems_version: 2.4.5
|
400
400
|
signing_key:
|
401
401
|
specification_version: 4
|
402
402
|
summary: Headless Webkit driver for Capybara
|
403
|
-
test_files:
|
403
|
+
test_files:
|
404
|
+
- spec/browser_spec.rb
|
405
|
+
- spec/capybara_webkit_builder_spec.rb
|
406
|
+
- spec/connection_spec.rb
|
407
|
+
- spec/cookie_jar_spec.rb
|
408
|
+
- spec/driver_rendering_spec.rb
|
409
|
+
- spec/driver_resize_window_spec.rb
|
410
|
+
- spec/driver_spec.rb
|
411
|
+
- spec/errors_spec.rb
|
412
|
+
- spec/integration/session_spec.rb
|
413
|
+
- spec/selenium_compatibility_spec.rb
|
414
|
+
- spec/self_signed_ssl_cert.rb
|
415
|
+
- spec/spec_helper.rb
|
416
|
+
- spec/support/app_runner.rb
|
417
|
+
- spec/support/matchers/include_response.rb
|
418
|
+
- spec/support/output_writer.rb
|
419
|
+
has_rdoc:
|