testng-reports.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. $(document).ready(function() {
  2. $('a.navigator-link').on("click", function() {
  3. // Extract the panel for this link
  4. var panel = getPanelName($(this));
  5. // Mark this link as currently selected
  6. $('.navigator-link').parent().removeClass('navigator-selected');
  7. $(this).parent().addClass('navigator-selected');
  8. showPanel(panel);
  9. });
  10. installMethodHandlers('failed');
  11. installMethodHandlers('skipped');
  12. installMethodHandlers('passed', true); // hide passed methods by default
  13. $('a.method').on("click", function() {
  14. showMethod($(this));
  15. return false;
  16. });
  17. // Hide all the panels and display the first one (do this last
  18. // to make sure the click() will invoke the listeners)
  19. $('.panel').hide();
  20. $('.navigator-link').first().trigger("click");
  21. // Collapse/expand the suites
  22. $('a.collapse-all-link').on("click", function() {
  23. var contents = $('.navigator-suite-content');
  24. if (contents.css('display') == 'none') {
  25. contents.show();
  26. } else {
  27. contents.hide();
  28. }
  29. });
  30. });
  31. // The handlers that take care of showing/hiding the methods
  32. function installMethodHandlers(name, hide) {
  33. function getContent(t) {
  34. return $('.method-list-content.' + name + "." + t.attr('panel-name'));
  35. }
  36. function getHideLink(t, name) {
  37. var s = 'a.hide-methods.' + name + "." + t.attr('panel-name');
  38. return $(s);
  39. }
  40. function getShowLink(t, name) {
  41. return $('a.show-methods.' + name + "." + t.attr('panel-name'));
  42. }
  43. function getMethodPanelClassSel(element, name) {
  44. var panelName = getPanelName(element);
  45. var sel = '.' + panelName + "-class-" + name;
  46. return $(sel);
  47. }
  48. $('a.hide-methods.' + name).on("click", function() {
  49. var w = getContent($(this));
  50. w.hide();
  51. getHideLink($(this), name).hide();
  52. getShowLink($(this), name).show();
  53. getMethodPanelClassSel($(this), name).hide();
  54. });
  55. $('a.show-methods.' + name).on("click", function() {
  56. var w = getContent($(this));
  57. w.show();
  58. getHideLink($(this), name).show();
  59. getShowLink($(this), name).hide();
  60. showPanel(getPanelName($(this)));
  61. getMethodPanelClassSel($(this), name).show();
  62. });
  63. if (hide) {
  64. $('a.hide-methods.' + name).trigger("click");
  65. } else {
  66. $('a.show-methods.' + name).trigger("click");
  67. }
  68. }
  69. function getHashForMethod(element) {
  70. return element.attr('hash-for-method');
  71. }
  72. function getPanelName(element) {
  73. return element.attr('panel-name');
  74. }
  75. function showPanel(panelName) {
  76. $('.panel').hide();
  77. var panel = $('.panel[panel-name="' + panelName + '"]');
  78. panel.show();
  79. }
  80. function showMethod(element) {
  81. var hashTag = getHashForMethod(element);
  82. var panelName = getPanelName(element);
  83. showPanel(panelName);
  84. var current = document.location.href;
  85. var base = current.substring(0, current.indexOf('#'))
  86. document.location.href = base + '#' + hashTag;
  87. var newPosition = $(document).scrollTop() - 65;
  88. $(document).scrollTop(newPosition);
  89. }
  90. function drawTable() {
  91. for (var i = 0; i < suiteTableInitFunctions.length; i++) {
  92. window[suiteTableInitFunctions[i]]();
  93. }
  94. for (var k in window.suiteTableData) {
  95. var v = window.suiteTableData[k];
  96. var div = v.tableDiv;
  97. var data = v.tableData
  98. var table = new google.visualization.Table(document.getElementById(div));
  99. table.draw(data, {
  100. showRowNumber : false
  101. });
  102. }
  103. }