Set the window to the default size on #reset!
This should prevent state leakage between test cases.
This commit is contained in:
parent
04fde02ad7
commit
1a609a945d
|
@ -48,5 +48,12 @@ describe Capybara::Driver::Webkit, "#resize_window(width, height)" do
|
||||||
@driver.body.should include("[800x600]")
|
@driver.body.should include("[800x600]")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "resets the window to the default size when the driver is reset" do
|
||||||
|
@driver.resize_window(800, 600)
|
||||||
|
@driver.reset!
|
||||||
|
@driver.visit("/")
|
||||||
|
@driver.body.should include(DEFAULT_DIMENTIONS)
|
||||||
|
end
|
||||||
|
|
||||||
after(:all) { @driver.reset! }
|
after(:all) { @driver.reset! }
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,6 +16,7 @@ void Reset::start() {
|
||||||
page()->setUserAgent(NULL);
|
page()->setUserAgent(NULL);
|
||||||
page()->resetResponseHeaders();
|
page()->resetResponseHeaders();
|
||||||
page()->resetConsoleMessages();
|
page()->resetConsoleMessages();
|
||||||
|
page()->resetWindowSize();
|
||||||
resetHistory();
|
resetHistory();
|
||||||
emit finished(new Response(true));
|
emit finished(new Response(true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) {
|
||||||
this, SLOT(frameCreated(QWebFrame *)));
|
this, SLOT(frameCreated(QWebFrame *)));
|
||||||
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
|
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
|
||||||
this, SLOT(handleUnsupportedContent(QNetworkReply*)));
|
this, SLOT(handleUnsupportedContent(QNetworkReply*)));
|
||||||
|
resetWindowSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebPage::resetWindowSize() {
|
||||||
this->setViewportSize(QSize(1680, 1050));
|
this->setViewportSize(QSize(1680, 1050));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ class WebPage : public QWebPage {
|
||||||
bool ignoreSslErrors();
|
bool ignoreSslErrors();
|
||||||
QString consoleMessages();
|
QString consoleMessages();
|
||||||
void resetConsoleMessages();
|
void resetConsoleMessages();
|
||||||
|
void resetWindowSize();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool shouldInterruptJavaScript();
|
bool shouldInterruptJavaScript();
|
||||||
|
|
Loading…
Reference in New Issue