4 new revisions:
Revision: 783613193c6c
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:40:33 2011
Log: better names for functions & attributes
http://code.google.com/p/robotframework/source/detail?r=783613193c6c
Revision: 85fddd102f19
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:40:49 2011
Log: changed order of functions to see structure
http://code.google.com/p/robotframework/source/detail?r=85fddd102f19
Revision: c281e49bcab5
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:48:16 2011
Log: Enable back & forward when selecting details
http://code.google.com/p/robotframework/source/detail?r=c281e49bcab5
Revision: 8c2ffe77a9fb
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:51:22 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=8c2ffe77a9fb
==============================================================================
Revision: 783613193c6c
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:40:33 2011
Log: better names for functions & attributes
http://code.google.com/p/robotframework/source/detail?r=783613193c6c
Modified:
/src/robot/webcontent/log.js
=======================================
--- /src/robot/webcontent/log.js Mon Jun 20 03:29:18 2011
+++ /src/robot/webcontent/log.js Mon Jun 20 23:40:33 2011
@@ -36,23 +36,26 @@
$('#'+elementId+'_unfoldlink').show();
}
-// TODO: rename
-function iterateTasks(){
- if (!window.tasks.length)
+function expandRecursively(){
+ if (!window.elementsToExpand.length)
return;
- var element = window.tasks.pop();
+ var element = window.elementsToExpand.pop();
if (element == undefined || elementHiddenByUser(element.id)) {
- window.tasks = []
+ window.elementsToExpand = [];
return;
}
- $("#"+element.id+"_unfoldlink").click();
+ expandElement(element);
var children = element.children()
for (var i = children.length-1; i >= 0; i--) {
- if (window.tasksMatcher(children[i]))
- window.tasks.push(children[i]);
- }
- if (window.tasks.length)
- setTimeout("iterateTasks()", 0);
+ if (window.expandDecider(children[i]))
+ window.elementsToExpand.push(children[i]);
+ }
+ if (window.elementsToExpand.length)
+ setTimeout(expandRecursively, 0);
+}
+
+function expandElement(element) {
+ $("#" + element.id + "_unfoldlink").click();
}
function elementHiddenByUser(elementId) {
@@ -61,22 +64,22 @@
}
function expandAllChildren(elementId) {
- window.tasks = [window.testdata.find(elementId)];
- window.tasksMatcher = function() {return true;};
- iterateTasks();
+ window.elementsToExpand = [window.testdata.find(elementId)];
+ window.expandDecider = function() {return true;};
+ expandRecursively();
}
function expandFailed(element) {
if (element.status == "FAIL") {
- window.tasks = [element];
- window.tasksMatcher = function(e) {return e.status == "FAIL";};
- iterateTasks();
+ window.elementsToExpand = [element];
+ window.expandDecider = function(e) {return e.status == "FAIL";};
+ expandRecursively();
}
}
function expandSuite(suite) {
if (suite.status == "PASS")
- $("#"+suite.id+"_unfoldlink").click();
+ expandElement(suite);
else
expandFailed(suite);
}
==============================================================================
Revision: 85fddd102f19
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:40:49 2011
Log: changed order of functions to see structure
http://code.google.com/p/robotframework/source/detail?r=85fddd102f19
Modified:
/src/robot/webcontent/report.html
=======================================
--- /src/robot/webcontent/report.html Mon Jun 20 13:36:51 2011
+++ /src/robot/webcontent/report.html Mon Jun 20 23:40:49 2011
@@ -40,131 +40,153 @@
initLayout(topsuite.name, 'Report');
addSummary(topsuite);
addStatistics();
+ addDetails();
+});
+
+function addSummary(topsuite) {
+ var opts = {logURL: window.settings.logURL};
+ $.tmpl('summaryTableTemplate', topsuite,
opts).insertAfter($('#header_div'));
+}
+
+function addDetails() {
if (window.location.hash) {
showDetailsByHash();
} else {
renderTotalSelector("no_selection");
}
$('#test_details_container').css('min-height', $(window).height());
-});
-
-function addSummary(topsuite) {
- var opts = {logURL: window.settings.logURL};
- $.tmpl('summaryTableTemplate', topsuite,
opts).insertAfter($('#header_div'));
}
-function showTotalsTab() {
- renderTotalSelector('totals');
+function showDetailsByHash() {
+ var hashParts =
decodeURI(window.location.hash.substring(1)).split('_');
+ var key = hashParts.shift();
+ var arg = hashParts.join('_');
+ var action = {
+ 'total': totalDetailSelected,
+ 'tag': tagDetailSelected,
+ 'suite': suiteDetailSelected,
+ 'totals': showTotalsTab,
+ 'tags': showTagsTab,
+ 'suites': showSuitesTab
+ }[key];
+ if (action) {
+ action(arg);
+ }
+ window.location.hash = window.location.hash.substring(1);
}
-function showTagsTab() {
- renderTagsSelector('tags');
+function totalDetailSelected(type) {
+ if (!type) return;
+ renderTotalSelector('total_' + type);
+ renderTotalDetails(type);
+ ensureTotalDetailsAreVisible(type);
}
-function showSuitesTab() {
- renderSuiteSelector('suites');
+function renderTotalDetails(type) {
+ var stat;
+ if (type == 'Critical Tests')
+ stat = window.testdata.statistics().total[0];
+ else
+ stat = window.testdata.statistics().total[1];
+ var tests = getTotalTests(type)
+ stat.totalTime = calculateTotalTime(tests);
+ $.tmpl('tagOrTotalDetailsTemplate', stat).appendTo('#details_header');
+ drawTestDetailsTable(tests);
}
function renderTotalSelector(linkTarget) {
- emptyDetails();
var args = {linkTarget: linkTarget, totals_tab_status: 'tab_selected'};
- $.tmpl('detailsHeaderTemplate',
args).appendTo('#test_details_container');
-
$.tmpl('totalDetailsSelectorTemplate').appendTo('#test_details_container');
+ renderSelector(args, 'totalDetailsSelectorTemplate');
}
-function renderTagsSelector(linkTarget) {
- emptyDetails();
- var args = {linkTarget: linkTarget, tags_tab_status: 'tab_selected'};
- var tagstats = {tags: window.testdata.statistics().tag};
- $.tmpl('detailsHeaderTemplate',
args).appendTo('#test_details_container');
- $.tmpl('tagDetailsSelectorTemplate',
tagstats).appendTo('#test_details_container');
+function ensureTotalDetailsAreVisible(type) {
+ document.getElementById('radio_'+type).checked = true;
+ $('#print_selector').text(type);
+ window.location.hash = 'total_'+type
}
-function renderSuiteSelector(linkTarget) {
- emptyDetails();
- var args = {linkTarget: linkTarget, suites_tab_status: 'tab_selected'};
- var suitestats = {suites: window.testdata.statistics().suite};
- $.tmpl('detailsHeaderTemplate',
args).appendTo('#test_details_container');
- $.tmpl('suiteDetailsSelectorTemplate',
suitestats).appendTo('#test_details_container');
+function tagDetailSelected(name) {
+ if (!name) return;
+ renderTagsSelector('tag_' + name);
+ var tag = findTagByName(name, window.testdata.statistics().tag);
+ renderTagDetails(tag);
+ ensureTagDetailsAreVisible(name);
}
-function emptyDetails(){
- window.tasks = [];
- $('#test_details_container').empty();
+function renderTagDetails(tag) {
+ var tests = getTestsHavingTag(tag);
+ if (tag) {
+ tag.totalTime = calculateTotalTime(tests);
+ }
+ $.tmpl('tagOrTotalDetailsTemplate', tag).appendTo('#details_header');
+ drawTestDetailsTable(tests);
}
-function totalDetailSelected(type) {
- if (!type) return;
- renderTotalSelector("total_"+type);
- renderTotalDetails(type);
- ensureTotalDetailsAreVisible(type);
+function renderTagsSelector(linkTarget) {
+ var args = {linkTarget: linkTarget, tags_tab_status: 'tab_selected'};
+ var tagstats = {tags: window.testdata.statistics().tag};
+ renderSelector(args, 'tagDetailsSelectorTemplate', tagstats);
}
-function tagDetailSelected(name) {
- if (!name) return;
- renderTagsSelector("tag_"+name);
- var alltags = window.testdata.statistics().tag;
- var tag = findTagByName(name, alltags);
- renderDetailsByTag(tag);
- ensureTagDetailsAreVisible(name);
+function ensureTagDetailsAreVisible(name) {
+ document.getElementById('tag_detail_selector').value = name;
+ $('#print_selector').text(name);
+ window.location.hash = 'tag_'+name;
}
function suiteDetailSelected(name) {
if (!name) return;
- renderSuiteSelector("suite_"+name);
- renderDetailsBySuite(name);
+ renderSuiteSelector('suite_' + name);
+ renderSuiteDetails(name);
ensureSuiteDetailsAreVisible(name);
}
-function renderTotalDetails(type) {
- if (type == 'Critical Tests')
- var stat = window.testdata.statistics().total[0];
- else
- var stat = window.testdata.statistics().total[1];
- var tests = getTotalTests(type)
- stat.totalTime = calculateTotalTime(tests);
- $.tmpl('tagOrTotalDetailsTemplate', stat).appendTo('#details_header');
- drawTestDetailsTable(tests);
+function ensureSuiteDetailsAreVisible(name) {
+ document.getElementById('suite_detail_selector').value = name;
+ $('#print_selector').text(name);
+ window.location.hash = 'suite_'+name;
}
-function renderDetailsByTag(tag) {
- var tests = getTestsHavingTag(tag);
- if (tag) {
- tag.totalTime = calculateTotalTime(tests);
- }
- $.tmpl('tagOrTotalDetailsTemplate', tag).appendTo('#details_header');
- drawTestDetailsTable(tests);
-}
-
-function renderDetailsBySuite(name) {
+function renderSuiteDetails(name) {
var suite = testdata.suite().findSuiteByName(name);
var opts = {logURL: window.settings.logURL};
$.tmpl('suiteDetailsTemplate', suite,
opts).appendTo('#details_header');
drawTestDetailsTable(suite.allTests());
}
-function drawTestDetailsTable(tests) {
- $.tmpl('testDetailsTableTemplate').appendTo('#test_details_container');
- window.tasks = tests;
- iterateDetails();
+function renderSuiteSelector(linkTarget) {
+ var args = {linkTarget: linkTarget, suites_tab_status: 'tab_selected'};
+ var stats = {suites: window.testdata.statistics().suite};
+ renderSelector(args, 'suiteDetailsSelectorTemplate', stats);
}
-function ensureTotalDetailsAreVisible(type) {
- document.getElementById('radio_'+type).checked = true;
- $('#print_selector').text(type);
- window.location.hash = 'total_'+type
+function showTotalsTab() {
+ renderTotalSelector('totals');
}
-function ensureTagDetailsAreVisible(name) {
- document.getElementById('tag_detail_selector').value = name;
- $('#print_selector').text(name);
- window.location.hash = 'tag_'+name;
+function showTagsTab() {
+ renderTagsSelector('tags');
}
-function ensureSuiteDetailsAreVisible(name) {
- document.getElementById('suite_detail_selector').value = name;
- $('#print_selector').text(name);
- window.location.hash = 'suite_'+name;
+function showSuitesTab() {
+ renderSuiteSelector('suites');
+}
+
+function renderSelector(args, template, stats) {
+ emptyDetails();
+ $.tmpl('detailsHeaderTemplate',
args).appendTo('#test_details_container');
+ $.tmpl(template, stats).appendTo('#test_details_container');
+}
+
+function emptyDetails(){
+ window.elementsToRender = [];
+ $('#test_details_container').empty();
+}
+
+function drawTestDetailsTable(tests) {
+ $.tmpl('testDetailsTableTemplate').appendTo('#test_details_container');
+ window.elementsToRender = tests;
+ renderTestDetails();
}
function findTagByName(name, tags) {
@@ -174,34 +196,7 @@
}
}
-function showDetailsByHash() {
- // TODO: cleanup
- var hash = decodeURI(window.location.hash.substring(1));
- if (hash.indexOf("suite_") == 0) {
- var suite = hash.substring("suite_".length);
- suiteDetailSelected(suite)
- }
- else if (hash.indexOf("tag_") == 0) {
- var tag = hash.substring("tag_".length);
- tagDetailSelected(tag)
- }
- else if (hash.indexOf("total_") == 0) {
- var type = hash.substring("total_".length);
- totalDetailSelected(type)
- }
- else if (hash == 'totals') {
- showTotalsTab();
- }
- else if (hash == 'tags') {
- showTagsTab();
- }
- else if (hash == 'suites') {
- showSuitesTab();
- }
- window.location.hash = window.location.hash.substring(1);
-}
-
-function sort_failures_first(t1, t2) {
+function sortByStatus(t1, t2) {
if (t1.status != t2.status)
return t1.status == 'FAIL' ? -1 : 1;
if (t1.isCritical != t2.isCritical)
@@ -212,13 +207,13 @@
function getTestsHavingTag(tag) {
if (!tag)
return [];
- return
window.testdata.suite().searchTestsByTag(tag).sort(sort_failures_first);
+ return
window.testdata.suite().searchTestsByTag(tag).sort(sortByStatus);
}
function getTotalTests(type) {
if (type == 'Critical Tests')
- return
window.testdata.suite().criticalTests().sort(sort_failures_first);
- return window.testdata.suite().allTests().sort(sort_failures_first);
+ return window.testdata.suite().criticalTests().sort(sortByStatus);
+ return window.testdata.suite().allTests().sort(sortByStatus);
}
function calculateTotalTime(tests) {
@@ -238,19 +233,22 @@
$("body").css("background-color",window.settings.background.pass);
}
-function iterateDetails(){
- if (window.tasks.length == 0) {
+function renderTestDetails(){
+ if (window.elementsToRender.length == 0) {
return;
}
- var elements = pop_upto(window.tasks, 50);
- $.tmpl('testDetailsTableRowTemplate', elements, {logURL:
window.settings.logURL}).appendTo('#test_details');
- if(window.tasks.length > 0)
- setTimeout("iterateDetails()", 0);
+ var elements = popUpTo(window.elementsToRender, 50);
+ $.tmpl('testDetailsTableRowTemplate',
+ elements,
+ {logURL: window.settings.logURL}
+ ).appendTo('#test_details');
+ if (window.elementsToRender.length > 0)
+ setTimeout(renderTestDetails, 0);
}
-function pop_upto(list, upto) {
+function popUpTo(list, upTo) {
var result = [];
- while (list.length > 0 && result.length < upto)
+ while (list.length > 0 && result.length < upTo)
result.push(list.shift());
return result;
}
==============================================================================
Revision: c281e49bcab5
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:48:16 2011
Log: Enable back & forward when selecting details
http://code.google.com/p/robotframework/source/detail?r=c281e49bcab5
Modified:
/src/robot/webcontent/report.html
=======================================
--- /src/robot/webcontent/report.html Mon Jun 20 23:40:49 2011
+++ /src/robot/webcontent/report.html Mon Jun 20 23:48:16 2011
@@ -41,6 +41,7 @@
addSummary(topsuite);
addStatistics();
addDetails();
+ window.onhashchange = showDetailsByHash;
});
function addSummary(topsuite) {
==============================================================================
Revision: 8c2ffe77a9fb
Author: Janne Härkönen <[email protected]>
Date: Mon Jun 20 23:51:22 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=8c2ffe77a9fb