Lib.robot.htmldata.rebot.view.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sikulixapi Show documentation
Show all versions of sikulixapi Show documentation
... for visual testing and automation
function removeJavaScriptDisabledWarning() {
// Not using jQuery here for maximum speed
document.getElementById('javascript-disabled').style.display = 'none';
}
function addJavaScriptDisabledWarning(error) {
if (window.console)
console.error('Opening failed: ' + error.name + ': ' + error.message);
document.getElementById('javascript-disabled').style.display = 'block';
}
function initLayout(suiteName, type) {
parseTemplates();
setTitle(suiteName, type);
addHeader();
addReportOrLogLink(type);
}
function parseTemplates() {
$('script[type="text/x-jquery-tmpl"]').map(function (idx, elem) {
$.template(elem.id, elem.text);
});
}
function setTitle(suiteName, type) {
var givenTitle = window.settings.title;
var title = givenTitle ? givenTitle : suiteName + " Test " + type;
document.title = util.unescape(title);
}
function addHeader() {
$.tmpl('${title}
' +
'' +
'Generated
${generated}
' +
'${ago} ago' +
'' +
'', {
generated: window.output.generatedTimestamp,
ago: util.createGeneratedAgoString(window.output.generatedMillis),
title: document.title
}).appendTo($('#header'));
}
function addReportOrLogLink(myType) {
var url;
var text;
var container = $('#report-or-log-link');
if (myType == 'Report') {
url = window.settings.logURL;
text = 'LOG';
} else {
url = window.settings.reportURL;
text = 'REPORT';
}
if (url) {
container.find('a').attr('href', url);
container.find('a').text(text);
} else {
container.remove();
}
}
function addStatistics() {
var statHeaders =
'Total ' +
'Pass ' +
'Fail ' +
'Elapsed ' +
'Pass / Fail ';
var statTable =
'Test Statistics
' +
'' +
'Total Statistics ' + statHeaders +
'
' +
'' +
'Statistics by Tag ' + statHeaders +
'
' +
'' +
'Statistics by Suite ' + statHeaders +
'
';
$(statTable).appendTo('#statistics-container');
util.map(['total', 'tag', 'suite'], addStatTable);
addTooltipsToElapsedTimes();
enableStatisticsSorter();
}
function addTooltipsToElapsedTimes() {
$('.stats-col-elapsed').attr('title',
'Total execution time of these test cases. ' +
'Excludes suite setups and teardowns.');
$('#suite-stats').find('.stats-col-elapsed').attr('title',
'Total execution time of this test suite.');
}
function enableStatisticsSorter() {
$.tablesorter.addParser({
id: 'statName',
type: 'numeric',
is: function(s) {
return false; // do not auto-detect
},
format: function(string, table, cell, cellIndex) {
// Rows have class in format 'row-'.
var index = $(cell).parent().attr('class').substring(4);
return parseInt(index);
}
});
$(".statistics").tablesorter({
sortInitialOrder: 'desc',
headers: {0: {sorter:'statName', sortInitialOrder: 'asc'},
5: {sorter: false}}
});
}
function addStatTable(tableName) {
var stats = window.testdata.statistics()[tableName];
if (tableName == 'tag' && stats.length == 0) {
renderNoTagStatTable();
} else {
renderStatTable(tableName, stats);
}
}
function renderNoTagStatTable() {
$('' +
'No Tags ' +
' ' +
' ' +
' ' +
' ' +
'' +
'' +
' ' +
' ').appendTo('#tag-stats');
}
function renderStatTable(tableName, stats) {
var template = tableName + 'StatisticsRowTemplate';
var tbody = $('');
for (var i = 0, len = stats.length; i < len; i++) {
$.tmpl(template, stats[i], {index: i}).appendTo(tbody);
}
tbody.appendTo('#' + tableName + '-stats');
}
$.template('statColumnsTemplate',
'${total} ' +
'${pass} ' +
'${fail} ' +
'${elapsed} ' +
'' +
'{{if total}}' +
'' +
'' +
'' +
'' +
'{{else}}' +
'' +
'{{/if}}' +
' '
);
$.template('suiteStatusMessageTemplate',
'${critical} critical test, ' +
'${criticalPassed} passed, ' +
'${criticalFailed} failed
' +
'${total} test total, ' +
'${totalPassed} passed, ' +
'${totalFailed} failed'
);
// For complete cross-browser experience..
// http://www.quirksmode.org/js/events_order.html
function stopPropagation(event) {
var event = event || window.event;
event.cancelBubble = true;
if (event.stopPropagation)
event.stopPropagation();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy