* adjust for create bug from case.

This commit is contained in:
wangyidong
2017-03-21 16:53:55 +08:00
parent 323308d105
commit 7de75f5fc1
6 changed files with 38 additions and 24 deletions
+17 -16
View File
@@ -1397,34 +1397,35 @@ class bugModel extends model
$bugSteps .= $this->lang->bug->tplStep;
if(!empty($stepResults))
{
$i = 0;
foreach($caseSteps as $key => $step)
$i = 1;
foreach($steps as $stepId)
{
if(!in_array($step->id, $steps)) continue;
$i++;
if(!isset($caseSteps[$stepId])) continue;
$step = $caseSteps[$stepId];
$bugSteps .= $i . '. ' . $step->desc . "<br />";
$i++;
}
$bugSteps .= $this->lang->bug->tplResult;
$i = 0;
foreach($caseSteps as $key => $step)
$i = 1;
foreach($steps as $stepId)
{
if(!in_array($step->id, $steps)) continue;
if(!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) continue;
$bugSteps .= $i . '. ' . $stepResults[$stepId]['real'] . "<br />";
$i++;
if(empty($stepResults[$step->id]['real'])) continue;
$bugSteps .= $i . '. ' . $stepResults[$step->id]['real'] . "<br />";
}
$bugSteps .= $this->lang->bug->tplExpect;
$i = 0;
foreach($caseSteps as $key => $step)
$i = 1;
foreach($steps as $stepId)
{
if(!in_array($step->id, $steps)) continue;
$i++;
if(!$step->expect) continue;
$bugSteps .= $i . '. ' . $step->expect . "<br />";
}
if(!isset($caseSteps[$stepId])) continue;
$step = $caseSteps[$stepId];
if($step->expect) $bugSteps .= $i . '. ' . $step->expect . "<br />";
$i++;
}
}
return array('title' => $title, 'steps' => $bugSteps, 'storyID' => $run->case->story, 'moduleID' => $run->case->module, 'version' => $run->case->version);
+1 -1
View File
@@ -261,7 +261,7 @@ class testcaseModel extends model
if($case->linkCase or $case->fromCaseID) $case->linkCaseTitles = $this->dao->select('id,title')->from(TABLE_CASE)->where('id')->in($case->linkCase)->orWhere('id')->eq($case->fromCaseID)->fetchPairs();
if($version == 0) $version = $case->version;
$case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->orderBy('id')->fetchAll();
$case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->orderBy('id')->fetchAll('id');
$case->files = $this->loadModel('file')->getByObject('testcase', $caseID);
$case->currentVersion = $version ? $version : $case->version;
return $case;
+3 -1
View File
@@ -875,7 +875,9 @@ class testtask extends control
$testtaskID = $this->dao->select('task')->from(TABLE_TESTRUN)->where('id')->eq($runID)->fetch('task');
$testtask = $this->dao->select('build, product')->from(TABLE_TESTTASK)->where('id')->eq($testtaskID)->fetch();
$this->view->build = isset($builds[$testtask->build]) ? $builds[$testtask->build] : '';
$this->view->build = isset($builds[$testtask->build]) ? $builds[$testtask->build] : '';
$this->view->testtaskID = $testtaskID;
}
else
{
+15 -4
View File
@@ -76,15 +76,26 @@ $(document).ready(function()
$this.next('.result-detail').toggleClass('hide', !show);
$this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);
});
$('#casesResults table caption .result-tip').html($('#resultTip').html());
$("#submit").text(caseResultSave);
$("#submit").attr({"disabled":"disabled"});
$('#casesResults table caption .result-tip').html($('#resultTip').html());
$("#submit").text(caseResultSave);
$("#submit").attr({"disabled":"disabled"});
});
}
}
return false;
});
$(document).on('click', ".step-group input[type='checkbox']", function()
{
var $next = $(this).closest('tr').next();
while($next.length && $next.hasClass('step-item'))
{
var isChecked = $(this).prop('checked');
$next.find("input[type='checkbox']").prop('checked', isChecked);
$next = $next.next();
}
});
});
+1 -1
View File
@@ -49,7 +49,7 @@
</tr>
<tr class='result-detail hide' id='tr-detail_<?php echo $trCount++; ?>'>
<td colspan='7' class='pd-0'>
<form action='<?php echo $this->createLink('bug', 'create', "product=$case->product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,resultID=$result->id,runID=$runID")?>' target='_blank' method='post'>
<form action='<?php echo $this->createLink('bug', 'create', "product=$case->product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,resultID=$result->id,runID=$runID" . (isset($testtaskID) ? ",testtask=$testtaskID" : ''))?>' target='_blank' method='post'>
<table class='table table-condensed borderless mg-0 resultSteps'>
<thead>
<tr>
+1 -1
View File
@@ -42,7 +42,7 @@
$step->id = 0;
$step->parent = 0;
$step->case = $run->case->id;
$step->type = 'item';
$step->type = 'step';
$step->desc = '';
$step->expect = '';
$run->case->steps[] = $step;