This repository has been archived by the owner on Mar 3, 2020. It is now read-only.
add error message detail for page load failure #311
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5831441
page load failure should not cause the next command to fail
142047c
add error message detail for page load failure
b7e3868
page succeeds only when all loadFinished events succeed
9cbf7d2
remove debug output
7b4a3ba
Merge branch 'master' of https://github.com/thoughtbot/capybara-webkit
0aac807
Merge branch 'multiple-loadFinished-with-timers'
000f7da
standardize whitespace on condition statements
000f327
better names for javascript functions that trigger the loadFinished s…
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,7 @@ bool WebPage::javaScriptPrompt(QWebFrame *frame, const QString &message, const Q | |
|
||
void WebPage::loadStarted() { | ||
m_loading = true; | ||
m_errorPageMessage = QString(); | ||
} | ||
|
||
void WebPage::loadFinished(bool success) { | ||
|
@@ -153,7 +154,11 @@ bool WebPage::isLoading() const { | |
} | ||
|
||
QString WebPage::failureString() { | ||
return QString("Unable to load URL: ") + currentFrame()->requestedUrl().toString(); | ||
QString message = QString("Unable to load URL: ") + currentFrame()->requestedUrl().toString(); | ||
if (m_errorPageMessage.isEmpty()) | ||
return message; | ||
else | ||
return message + ": " + m_errorPageMessage; | ||
} | ||
|
||
bool WebPage::render(const QString &fileName) { | ||
|
@@ -191,12 +196,16 @@ QString WebPage::chooseFile(QWebFrame *parentFrame, const QString &suggestedFile | |
} | ||
|
||
bool WebPage::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) { | ||
Q_UNUSED(option); | ||
if (extension == ChooseMultipleFilesExtension) { | ||
QStringList names = QStringList() << getLastAttachedFileName(); | ||
static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names; | ||
return true; | ||
} | ||
else if (extension == QWebPage::ErrorPageExtension) { | ||
ErrorPageExtensionOption *errorOption = (ErrorPageExtensionOption*) option; | ||
m_errorPageMessage = "Because of error loading " + errorOption->url.toString() + ": " + errorOption->errorString; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This message is combined with How about this: drop the colon on line 161 and downcase the 'B' in "Because".
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I improved the message formatting as you suggested in commit 1b99d2d. |
||
return false; | ||
} | ||
return false; | ||
} | ||
|
||
|
@@ -241,6 +250,15 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) { | |
Q_UNUSED(handler); | ||
} | ||
|
||
bool WebPage::supportsExtension(Extension extension) const { | ||
if (extension == ErrorPageExtension) | ||
return true; | ||
else if (extension == ChooseMultipleFilesExtension) | ||
return true; | ||
else | ||
return false; | ||
} | ||
|
||
QWebPage *WebPage::createWindow(WebWindowType type) { | ||
Q_UNUSED(type); | ||
return m_manager->createPage(this); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this else needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else clause handles the block at line 6,
before { subject.visit("/hello/world?success=true") }