Commit 89115b88 authored by Romain Courteaud's avatar Romain Courteaud

[Zelenium] Store the test HTML as a dataURL in case of error

This will ease debugging from posted test results.
This code should be synchronous (no Blob asDataURL method for example) and so, btoa is used.

Sadly, btoa will fail with unicode character
Do not report HTML error in such case, until a cleaner dataURL is implemented
parent ea28b5f8
......@@ -499,6 +499,19 @@ objectExtend(HtmlTestCaseRow.prototype, {
markFailed: function(errorMsg) {
AbstractResultAwareRow.prototype.markFailed.call(this, errorMsg);
this.setMessage(errorMsg);
// Store the test HTML as a dataURL to ease debugging from posted test results
// This code should be synchronous (no Blob asDataURL method for example)
var aElement = this.trElement.ownerDocument.createElement("a");
aElement.textContent = ' (HTML)'
try {
aElement.href = 'data:text/html;base64,' + btoa(sel$('selenium_myiframe').contentWindow.document.body.innerHTML);
this.trElement.cells[2].appendChild(aElement);
} catch (error) {
// btoa will fail with unicode character
// Do not report HTML error in such case, until a cleaner dataURL is implemented
;
}
},
setMessage: function(message) {
......
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