Commit bb7edb27 authored by Jérome Perrin's avatar Jérome Perrin

Zelenium: catch potential errors when making (HTML) link for failed test

When a test fail, we make a data-url link with the HTML of the current
page, so that we can easily investigate test failures n test nodes.
We should not let errors that might happen here propagate, otherwise
the test result is not created and the test runner does not detect
that the test is finished.

One case that caused such errors was failed assertion just after
using goBack command without waiting
parent 2baee241
......@@ -523,11 +523,17 @@ objectExtend(HtmlTestCaseRow.prototype, {
* @return {string}
*/
function convertDocumentToDataUrl(doc){
return 'data:text/html;charset=utf-8;base64,' + b64EncodeUnicode(doc.body.innerHTML);
try {
return 'data:text/html;charset=utf-8;base64,' + b64EncodeUnicode(doc.body.innerHTML);
} catch (e) {
// Document might be empty (after goBack)
console.warn("Ignored error while converting document to data-url");
return e.toString();
}
}
/**
* converts all iframs to a base64 link containing the page content.
* converts all iframes to a base64 link containing the page content.
* @param {Document} doc the document
* @return {string}
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment