mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
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
4 changed files with 13 additions and 0 deletions
|
@ -48,5 +48,12 @@ describe Capybara::Driver::Webkit, "#resize_window(width, height)" do
|
|||
@driver.body.should include("[800x600]")
|
||||
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! }
|
||||
end
|
||||
|
|
|
@ -16,6 +16,7 @@ void Reset::start() {
|
|||
page()->setUserAgent(NULL);
|
||||
page()->resetResponseHeaders();
|
||||
page()->resetConsoleMessages();
|
||||
page()->resetWindowSize();
|
||||
resetHistory();
|
||||
emit finished(new Response(true));
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) {
|
|||
this, SLOT(frameCreated(QWebFrame *)));
|
||||
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
|
||||
this, SLOT(handleUnsupportedContent(QNetworkReply*)));
|
||||
resetWindowSize();
|
||||
}
|
||||
|
||||
void WebPage::resetWindowSize() {
|
||||
this->setViewportSize(QSize(1680, 1050));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class WebPage : public QWebPage {
|
|||
bool ignoreSslErrors();
|
||||
QString consoleMessages();
|
||||
void resetConsoleMessages();
|
||||
void resetWindowSize();
|
||||
|
||||
public slots:
|
||||
bool shouldInterruptJavaScript();
|
||||
|
|
Loading…
Add table
Reference in a new issue