deploycaseresults.html.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. /**
  3. * The deploycaseresults view file of testtask of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package testtask
  9. * @version $Id: results.html.php 4129 2013-01-18 01:58:14Z wwccss $
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php include $app->getModuleRoot() . 'common/view/header.lite.html.php';?>
  14. <div id='mainContent' class="main-content">
  15. <div class='main-header'>
  16. <h2>
  17. <span class='label label-id'><?php echo $case->id;?></span>
  18. <?php echo $case->title;?>
  19. <small class='text-muted'><?php echo $lang->testtask->results . ' ' . html::icon($lang->icons['result']);?></small>
  20. </h2>
  21. </div>
  22. <div class='cell' style='word-break:break-all'>
  23. <div class='detail'>
  24. <div class='detail-title'><?php echo $lang->testcase->precondition;?></div>
  25. <div class='detail-content'><?php echo $case->precondition;?></div>
  26. </div>
  27. <div id='casesResults' class='detail'>
  28. <table class='table table-condensed table-hover' style='border: 1px solid #ddd; word-break:break-all'>
  29. <?php $count = count($results);?>
  30. <caption class='text-left'>
  31. <strong><?php echo $lang->testcase->result?> &nbsp;<span> <?php printf($lang->testtask->showResult, $count)?></span> <span class='result-tip'></span></strong>
  32. </caption>
  33. <?php $failCount = 0; $trCount=1?>
  34. <?php foreach($results as $result):?>
  35. <?php
  36. $class = ($result->caseResult == 'pass' ? 'success' : ($result->caseResult == 'fail' ? 'danger' : ($result->caseResult == 'blocked' ? 'warning' : '')));
  37. if($class != 'success') $failCount++;
  38. $fileCount = '(' . count($result->files) . ')';
  39. ?>
  40. <tr class='result-item' id='result-<?php echo $class?>' style='cursor: pointer'>
  41. <td class='w-120px'> &nbsp; #<?php echo $result->id?></td>
  42. <td class='w-180px'><?php echo $result->date;?></td>
  43. <td><?php echo $users[$result->lastRunner] . ' ' . $lang->testtask->runCase;?></td>
  44. <td class='w-150px'><?php echo zget($builds, $result->build, '');?></td>
  45. <td class='w-50px text-right'><strong class='text-<?php echo $class;?>'><?php echo $lang->testcase->resultList[$result->caseResult]?></strong></td>
  46. <td class='w-60px'><?php if(!empty($result->files)) echo html::a("#caseResult{$result->id}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?></td>
  47. <td class='w-50px text-center'><i class='collapse-handle icon-chevron-down text-muted'></i></td>
  48. </tr>
  49. <?php $params = isset($testtask) ? ",testtask=$testtask->id,executionID=$testtask->execution,buildID=$testtask->build" : '';?>
  50. <tr class='result-detail hide' id='tr-detail_<?php echo $trCount++; ?>'>
  51. <td colspan='7' class='pd-0'>
  52. <table class='table table-condensed borderless mg-0 resultSteps'>
  53. <thead>
  54. <tr>
  55. <th class='w-40px'><?php echo $lang->testcase->stepID;?></th>
  56. <th class='w-p30 text-left'><?php echo $lang->testcase->stepDesc;?></th>
  57. <th class='w-p25 text-left'><?php echo $lang->testcase->stepExpect;?></th>
  58. <th class='w-p5 text-left'><?php echo $lang->testcase->stepVersion;?></th>
  59. <th class='text-center'><?php echo $lang->testcase->result;?></th>
  60. <th class='w-p20 text-left'><?php echo $lang->testcase->real;?></th>
  61. <th class='w-80px'></th>
  62. </tr>
  63. </thead>
  64. <?php
  65. $stepId = $childId = 0;
  66. foreach($result->stepResults as $key => $stepResult):
  67. ?>
  68. <?php
  69. if(empty($stepResult['type'])) $stepResult['type'] = 'step';
  70. if(empty($stepResult['parent'])) $stepResult['parent'] = 0;
  71. if($stepResult['type'] == 'group' or $stepResult['type'] == 'step')
  72. {
  73. $stepId++;
  74. $childId = 0;
  75. }
  76. $stepClass = $stepResult['type'] == 'item' ? 'step-item' : 'step-group';
  77. $modalID = $result->id . '-' . $key;
  78. $fileCount = '(' . count($stepResult['files']) . ')';
  79. ?>
  80. <tr class='step <?php echo $stepClass?>'>
  81. <td class='step-id'>
  82. <?php echo $stepId;?>
  83. </td>
  84. <td class='text-left' <?php if($stepResult['type'] == 'group') echo "colspan='6'"?>>
  85. <div class='input-group'>
  86. <?php if($stepResult['type'] == 'item') echo "<span class='step-item-id'>{$stepId}.{$childId}</span>";?>
  87. <?php if(isset($stepResult['desc'])) echo nl2br($stepResult['desc']);?>
  88. </div>
  89. </td>
  90. <?php if($stepResult['type'] != 'group'):?>
  91. <td class='text-left'><?php if(isset($stepResult['expect'])) echo nl2br($stepResult['expect']);?></td>
  92. <td><?php if(isset($result->version)) echo nl2br($result->version);?></td>
  93. <?php if(!empty($stepResult['result'])):?>
  94. <td class='<?php echo $stepResult['result'];?> text-center'><?php echo $lang->testcase->resultList[$stepResult['result']];?></td>
  95. <td><?php echo $stepResult['real'];?></td>
  96. <td class='text-center'><?php if(!empty($stepResult['files'])) echo html::a("#stepResult{$modalID}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?></td>
  97. <?php else:?>
  98. <td></td>
  99. <td></td>
  100. <?php endif; endif; $childId++;?>
  101. </tr>
  102. <?php endforeach;?>
  103. </table>
  104. </td>
  105. </tr>
  106. <?php endforeach;?>
  107. </table>
  108. <?php foreach($results as $result):?>
  109. <div class="modal fade" id="caseResult<?php echo $result->id;?>">
  110. <div class="modal-dialog">
  111. <div class="modal-content">
  112. <div class="modal-header">
  113. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  114. <h4 class="modal-title"><?php echo $lang->files;?></h4>
  115. </div>
  116. <div class="modal-body"><?php echo $this->fetch('file', 'printFiles', array('files' => $result->files, 'fieldset' => 'false'));?></div>
  117. </div>
  118. </div>
  119. </div>
  120. <?php foreach($result->stepResults as $stepID => $stepResult):?>
  121. <div class="modal fade" id="stepResult<?php echo $result->id . '-' .$stepID;?>">
  122. <div class="modal-dialog">
  123. <div class="modal-content">
  124. <div class="modal-header">
  125. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  126. <h4 class="modal-title"><?php echo $lang->files;?></h4>
  127. </div>
  128. <div class="modal-body"><?php echo $this->fetch('file', 'printFiles', array('files' => $stepResult['files'], 'fieldset' => 'false'));?></div>
  129. </div>
  130. </div>
  131. </div>
  132. <?php endforeach;?>
  133. <?php endforeach;?>
  134. <div id='resultTip' class='hide'><?php if($count > 0) echo $failCount > 0 ? "<span>" . sprintf($lang->testtask->showFail, $failCount) . "</span>":"<span class='text-success'>{$lang->testtask->passAll}</span>";?></div>
  135. <style>.table-hover tr.result-detail:hover td {background: #fff} #casesResults > table > caption {border: 1px solid #ddd; margin-bottom: -1px}</style>
  136. </div>
  137. </div>
  138. </div>
  139. <script>
  140. $(function()
  141. {
  142. $('.result-item').click(function()
  143. {
  144. var $this = $(this);
  145. $this.toggleClass('show-detail');
  146. var show = $this.hasClass('show-detail');
  147. $this.next('.result-detail').toggleClass('hide', !show);
  148. $this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);;
  149. });
  150. $('#casesResults table caption .result-tip').html($('#resultTip').html());
  151. });
  152. </script>
  153. <?php include $app->getModuleRoot() . 'common/view/footer.lite.html.php';?>