mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Support for enabling/disabling localStorage
This commit is contained in:
parent
f4b34e1402
commit
a0fb662773
2 changed files with 34 additions and 0 deletions
|
@ -1277,6 +1277,39 @@ describe Capybara::Driver::Webkit do
|
|||
end
|
||||
end
|
||||
|
||||
context "localStorage works" do
|
||||
before(:all) do
|
||||
@app = lambda do |env|
|
||||
body = <<-HTML
|
||||
<html>
|
||||
<body>
|
||||
<span id='output'></span>
|
||||
<script type="text/javascript">
|
||||
if (typeof localStorage !== "undefined") {
|
||||
if (!localStorage.refreshCounter) {
|
||||
localStorage.refreshCounter = 0;
|
||||
}
|
||||
if (localStorage.refreshCounter++ > 0) {
|
||||
document.getElementById("output").innerHTML = "localStorage is enabled";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
HTML
|
||||
[200,
|
||||
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
|
||||
[body]]
|
||||
end
|
||||
end
|
||||
|
||||
it "displays the message on subsequent page loads" do
|
||||
subject.find("//span[contains(.,'localStorage is enabled')]").should be_empty
|
||||
subject.visit "/"
|
||||
subject.find("//span[contains(.,'localStorage is enabled')]").should_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context "app with a lot of HTML tags" do
|
||||
before(:all) do
|
||||
@app = lambda do |env|
|
||||
|
|
|
@ -25,6 +25,7 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) {
|
|||
|
||||
void WebPage::resetWindowSize() {
|
||||
this->setViewportSize(QSize(1680, 1050));
|
||||
this->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
|
||||
}
|
||||
|
||||
void WebPage::setCustomNetworkAccessManager() {
|
||||
|
|
Loading…
Reference in a new issue