Merge branch 'master' into 'feedback_1796'
# Conflicts: # module/testcase/js/browse.js
This commit is contained in:
@@ -579,6 +579,7 @@ class testtask extends control
|
||||
$this->view->suites = $this->loadModel('testsuite')->getSuitePairs($productID);
|
||||
$this->view->suiteName = isset($suiteName) ? $suiteName : $this->lang->testtask->browseBySuite;
|
||||
$this->view->canBeChanged = $canBeChanged;
|
||||
$this->view->automation = $this->loadModel('zanode')->getAutomationByProduct($productID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -1209,11 +1210,13 @@ class testtask extends control
|
||||
* Run case.
|
||||
*
|
||||
* @param int $runID
|
||||
* @param String $extras others params, forexample, caseID=10, version=3
|
||||
* @param int $caseID
|
||||
* @param int $version
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function runCase($runID, $caseID = 0, $version = 0)
|
||||
public function runCase($runID, $caseID = 0, $version = 0, $confirm = '')
|
||||
{
|
||||
if($runID)
|
||||
{
|
||||
@@ -1227,6 +1230,18 @@ class testtask extends control
|
||||
|
||||
$caseID = $caseID ? $caseID : $run->case->id;
|
||||
$preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID);
|
||||
$automation = $this->loadModel('zanode')->getAutomationByProduct($run->case->product);
|
||||
$confirmURL = inlink('runCase', "runID=$runID&caseID=$caseID&version=$version&confirm=yes");
|
||||
$cancelURL = inlink('runCase', "runID=$runID&caseID=$caseID&version=$version&confirm=no");
|
||||
|
||||
if($automation and $confirm == '' and $run->case->auto == 'auto') return print(js::confirm($this->lang->zanode->runCaseConfirm, $confirmURL, $cancelURL));
|
||||
if($confirm == 'yes')
|
||||
{
|
||||
$resultID = $this->testtask->initResult($runID, $caseID, $run->case->version, $automation->node);
|
||||
if(!dao::isError()) $this->zanode->runZTFScript($automation->id, $caseID, $resultID);
|
||||
if(dao::isError()) return print(js::error(dao::getError()) . js::locate($this->createLink('zanode', 'browse'), 'parent'));
|
||||
}
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$caseResult = $this->testtask->createResult($runID);
|
||||
@@ -1289,6 +1304,7 @@ class testtask extends control
|
||||
$this->view->caseID = $caseID;
|
||||
$this->view->version = $version;
|
||||
$this->view->runID = $runID;
|
||||
$this->view->confirm = $confirm;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -1299,13 +1315,17 @@ class testtask extends control
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @param string $from
|
||||
* @param int $taskID
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchRun($productID, $orderBy = 'id_desc', $from = 'testcase', $taskID = 0)
|
||||
public function batchRun($productID, $orderBy = 'id_desc', $from = 'testcase', $taskID = 0, $confirm = '')
|
||||
{
|
||||
$this->loadModel('tree');
|
||||
$url = $this->session->caseList ? $this->session->caseList : $this->createLink('testcase', 'browse', "productID=$productID");
|
||||
$automation = $this->loadModel('zanode')->getAutomationByProduct($productID);
|
||||
|
||||
if($this->post->results)
|
||||
{
|
||||
$this->testtask->batchRun($from, $taskID);
|
||||
@@ -1362,7 +1382,13 @@ class testtask extends control
|
||||
|
||||
/* Set modules. */
|
||||
$moduleOptionMenu = array(0 => '/');
|
||||
foreach($cases as $case) $moduleOptionMenu += $this->tree->getModulesName($case->module);
|
||||
foreach($cases as $caseID => $case)
|
||||
{
|
||||
if($case->auto == 'auto' and $confirm == 'yes') unset($cases[$caseID]);
|
||||
$moduleOptionMenu += $this->tree->getModulesName($case->module);
|
||||
}
|
||||
if(empty($cases)) return print(js::locate($url));
|
||||
|
||||
$this->view->moduleOptionMenu = $moduleOptionMenu;
|
||||
|
||||
/* If case has changed and not confirmed, remove it. */
|
||||
@@ -1392,6 +1418,7 @@ class testtask extends control
|
||||
$this->view->position[] = $this->lang->testtask->common;
|
||||
$this->view->position[] = $this->lang->testtask->batchRun;
|
||||
$this->view->from = $from;
|
||||
$this->view->confirm = $confirm;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1590,4 +1617,18 @@ class testtask extends control
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get test result info.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetResult($resultID)
|
||||
{
|
||||
$result = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('id')->eq((int)$resultID)->fetch();
|
||||
$this->send(array('result' => 'success', 'message' => '', 'data' => $result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ body {background: white;}
|
||||
.resultSteps .step-group .step-expects {display: none;}
|
||||
.resultSteps .step-item .step-item-id {display: table-cell;}
|
||||
.resultSteps .step-item .step-id {color: transparent;}
|
||||
.result-item .span-warning{color: #f1a325;}
|
||||
|
||||
@@ -31,3 +31,6 @@
|
||||
.resultSteps .step-item .step-id {color: transparent;}
|
||||
|
||||
.form-condensed textarea[id*='reals'] {height: 35px;}
|
||||
|
||||
.result-item .span-warning{color: #f1a325;}
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ $(function()
|
||||
$('.result-item').click(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
if($this.data('status') == 'running')
|
||||
{
|
||||
return;
|
||||
}
|
||||
$this.toggleClass('show-detail');
|
||||
var show = $this.hasClass('show-detail');
|
||||
$this.next('.result-detail').toggleClass('hide', !show);
|
||||
@@ -22,7 +26,35 @@ $(function()
|
||||
|
||||
$('#casesResults table caption .result-tip').html($('#resultTip').html());
|
||||
|
||||
$('tr:first').click();
|
||||
if($('tr:first').data('status') == 'ready')
|
||||
{
|
||||
$('tr:first').click();
|
||||
}
|
||||
else
|
||||
{
|
||||
var times = 0;
|
||||
var id = $('tr:first').data('id')
|
||||
var link = createLink('testtask', 'ajaxGetResult', 'resultID=' + id);
|
||||
|
||||
var resultInterval = setInterval(() => {
|
||||
times++;
|
||||
if(times > 600)
|
||||
{
|
||||
clearInterval(resultInterval);
|
||||
}
|
||||
|
||||
$.get(link, function(task)
|
||||
{
|
||||
task = JSON.parse(task);
|
||||
task = task.data;
|
||||
if(task.ZTFResult != '')
|
||||
{
|
||||
clearInterval(resultInterval);
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
$('#casesResults').click(function(event)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->testtask->unlinkCase = "Verknüpfung aufheben";
|
||||
$lang->testtask->batchUnlinkCases = "Mehrere Verknüpfungen aufheben";
|
||||
$lang->testtask->batchAssign = "Mehrere zuordnen";
|
||||
$lang->testtask->runCase = "Ausführen";
|
||||
$lang->testtask->running = "Excuting";
|
||||
$lang->testtask->runningLog = "Execution Log";
|
||||
$lang->testtask->runNode = "Executed by %s,Execute on node %s %s";
|
||||
$lang->testtask->batchRun = "Mehrere ausführen";
|
||||
$lang->testtask->results = "Ergebnisse";
|
||||
$lang->testtask->createBug = "Bug erstellen";
|
||||
@@ -105,6 +108,7 @@ $lang->testtask->caseCount = 'Case Count';
|
||||
$lang->testtask->passCount = 'Pass';
|
||||
$lang->testtask->failCount = 'Fail';
|
||||
$lang->testtask->summary = '%s cases, %s failures, %s time.';
|
||||
$lang->testtask->stepSummary = 'Total %s steps, %s passes, %s failures.';
|
||||
$lang->testtask->pageSummary = 'Total testtasks: <strong>%s</strong>.';
|
||||
$lang->testtask->mySummary = 'Total testtasks: <strong>%s</strong>, Wait: <strong>%s</strong>, Testing: <strong>%s</strong>, Blocked: <strong>%s</strong>.';
|
||||
$lang->testtask->allSummary = 'Total testtasks: <strong>%s</strong>, Wait: <strong>%s</strong>, Testing: <strong>%s</strong>, Blocked: <strong>%s</strong>, Done: <strong>%s</strong>.';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->testtask->unlinkCase = "Unlink";
|
||||
$lang->testtask->batchUnlinkCases = "Batch Unlink Cases";
|
||||
$lang->testtask->batchAssign = "Batch Assign";
|
||||
$lang->testtask->runCase = "Run";
|
||||
$lang->testtask->running = "Excuting";
|
||||
$lang->testtask->runningLog = "Execution Log";
|
||||
$lang->testtask->runNode = "Executed by %s,Execute on node %s %s";
|
||||
$lang->testtask->batchRun = "Batch Run";
|
||||
$lang->testtask->results = "Results";
|
||||
$lang->testtask->createBug = "Bug(+)";
|
||||
@@ -105,6 +108,7 @@ $lang->testtask->caseCount = 'Case Count';
|
||||
$lang->testtask->passCount = 'Pass';
|
||||
$lang->testtask->failCount = 'Fail';
|
||||
$lang->testtask->summary = '%s cases, %s failures, %s time.';
|
||||
$lang->testtask->stepSummary = 'Total %s steps, %s passes, %s failures.';
|
||||
$lang->testtask->pageSummary = 'Total testtasks: <strong>%s</strong>.';
|
||||
$lang->testtask->mySummary = 'Total testtasks: <strong>%s</strong>, Wait: <strong>%s</strong>, Testing: <strong>%s</strong>, Blocked: <strong>%s</strong>.';
|
||||
$lang->testtask->allSummary = 'Total testtasks: <strong>%s</strong>, Wait: <strong>%s</strong>, Testing: <strong>%s</strong>, Blocked: <strong>%s</strong>, Done: <strong>%s</strong>.';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->testtask->unlinkCase = "Exclure";
|
||||
$lang->testtask->batchUnlinkCases = "Exclure CasTests par Lot";
|
||||
$lang->testtask->batchAssign = "Affecter par Lot";
|
||||
$lang->testtask->runCase = "Jouer";
|
||||
$lang->testtask->running = "Excuting";
|
||||
$lang->testtask->runningLog = "Execution Log";
|
||||
$lang->testtask->runNode = "Executed by %s,Execute on node %s %s";
|
||||
$lang->testtask->batchRun = "Jouer par Lot";
|
||||
$lang->testtask->results = "Résultats";
|
||||
$lang->testtask->createBug = "Bug(+)";
|
||||
@@ -105,6 +108,7 @@ $lang->testtask->caseCount = 'Compteur CasTest';
|
||||
$lang->testtask->passCount = 'Pass';
|
||||
$lang->testtask->failCount = 'Fail';
|
||||
$lang->testtask->summary = '%s CasTest, %s échecs, %s heures.';
|
||||
$lang->testtask->stepSummary = 'Total %s steps, %s passes, %s failures.';
|
||||
$lang->testtask->pageSummary = 'Total testtasks: <strong>%s</strong>.';
|
||||
$lang->testtask->mySummary = 'Total testtasks: <strong>%s</strong>, Wait: <strong>%s</strong>, Testing: <strong>%s</strong>, Blocked: <strong>%s</strong>.';
|
||||
$lang->testtask->allSummary = 'Total testtasks: <strong>%s</strong>, Wait: <strong>%s</strong>, Testing: <strong>%s</strong>, Blocked: <strong>%s</strong>, Done: <strong>%s</strong>.';
|
||||
|
||||
@@ -27,6 +27,9 @@ $lang->testtask->unlinkCase = "Hủy liên kết";
|
||||
$lang->testtask->batchUnlinkCases = "Hủy liên kết tình huống hàng loạt";
|
||||
$lang->testtask->batchAssign = "Bàn giao hàng loạt";
|
||||
$lang->testtask->runCase = "Chạy";
|
||||
$lang->testtask->running = "Excuting";
|
||||
$lang->testtask->runningLog = "Execution Log";
|
||||
$lang->testtask->runNode = "Executed by %s,Execute on node %s %s";
|
||||
$lang->testtask->batchRun = "Chạy hàng loạt";
|
||||
$lang->testtask->results = "Kết quả";
|
||||
$lang->testtask->resultsAction = "Kết quả tình huống";
|
||||
@@ -94,6 +97,7 @@ $lang->testtask->caseCount = 'Case Count';
|
||||
$lang->testtask->passCount = 'Pass';
|
||||
$lang->testtask->failCount = 'Fail';
|
||||
$lang->testtask->summary = '%s cases, %s failures, %s time.';
|
||||
$lang->testtask->stepSummary = 'Total %s steps, %s passes, %s failures.';
|
||||
|
||||
$lang->testtask->beginAndEnd = 'Thời gian';
|
||||
$lang->testtask->to = 'Tới';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->testtask->unlinkCase = "移除";
|
||||
$lang->testtask->batchUnlinkCases = "批量移除用例";
|
||||
$lang->testtask->batchAssign = "批量指派";
|
||||
$lang->testtask->runCase = "执行";
|
||||
$lang->testtask->running = "执行中";
|
||||
$lang->testtask->runningLog = "执行日志";
|
||||
$lang->testtask->runNode = "由%s,在执行节点%s上 %s";
|
||||
$lang->testtask->batchRun = "批量执行";
|
||||
$lang->testtask->results = "结果";
|
||||
$lang->testtask->createBug = "提Bug";
|
||||
@@ -105,6 +108,7 @@ $lang->testtask->caseCount = '用例数';
|
||||
$lang->testtask->passCount = '成功';
|
||||
$lang->testtask->failCount = '失败';
|
||||
$lang->testtask->summary = '有%s个用例,失败%s个,耗时%s。';
|
||||
$lang->testtask->stepSummary = '共有%s个步骤,%s个通过,%s个失败。';
|
||||
$lang->testtask->pageSummary = '本页共 <strong>%s</strong> 个测试单。';
|
||||
$lang->testtask->mySummary = '本页共 <strong>%s</strong> 个测试单,待测试测试单 <strong>%s</strong>,测试中测试单 <strong>%s</strong>,被阻塞测试单 <strong>%s</strong>。';
|
||||
$lang->testtask->allSummary = '本页共 <strong>%s</strong> 个测试单,待测试测试单 <strong>%s</strong>,测试中测试单 <strong>%s</strong>,被阻塞测试单 <strong>%s</strong>,已测测试单 <strong>%s</strong>。';
|
||||
|
||||
@@ -26,6 +26,10 @@ $lang->testtask->unlinkCase = "移除";
|
||||
$lang->testtask->batchUnlinkCases = "批量移除用例";
|
||||
$lang->testtask->batchAssign = "批量指派";
|
||||
$lang->testtask->runCase = "執行";
|
||||
$lang->testtask->running = "執行中";
|
||||
$lang->testtask->runningLog = "執行日誌";
|
||||
$lang->testtask->runningNode = "由%s,在執行節點%s上執行中";
|
||||
$lang->testtask->runNode = "由%s,在執行節點%s上執行";
|
||||
$lang->testtask->batchRun = "批量執行";
|
||||
$lang->testtask->results = "結果";
|
||||
$lang->testtask->createBug = "提Bug";
|
||||
|
||||
@@ -1170,6 +1170,31 @@ class testtaskModel extends model
|
||||
->fetchGroup('case', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Init testtask result.
|
||||
*
|
||||
* @param int $runID
|
||||
* @param int $caseID
|
||||
* @param int $version
|
||||
* @param int $nodeID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function initResult($runID = 0, $caseID = 0, $version = 0, $nodeID = 0)
|
||||
{
|
||||
$result = new stdClass();
|
||||
$result->run = $runID;
|
||||
$result->case = $caseID;
|
||||
$result->version = $version;
|
||||
$result->node = $nodeID;
|
||||
$result->date = helper::now();
|
||||
$result->lastRunner = $this->app->user->account;
|
||||
|
||||
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
|
||||
if(!dao::isError()) return $resultID = $this->dao->lastInsertID();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test result
|
||||
*
|
||||
@@ -1295,6 +1320,7 @@ class testtaskModel extends model
|
||||
$postReals = $postData->reals[$caseID];
|
||||
|
||||
$caseResult = $result ? $result : 'pass';
|
||||
if($postData->node) $caseResult = '';
|
||||
$stepResults = array();
|
||||
if($dbSteps)
|
||||
{
|
||||
@@ -1325,6 +1351,7 @@ class testtaskModel extends model
|
||||
$result->stepResults = serialize($stepResults);
|
||||
$result->lastRunner = $this->app->user->account;
|
||||
$result->date = $now;
|
||||
|
||||
$this->dao->insert(TABLE_TESTRESULT)->data($result)->autoCheck()->exec();
|
||||
$this->dao->update(TABLE_CASE)->set('lastRunner')->eq($this->app->user->account)->set('lastRunDate')->eq($now)->set('lastRunResult')->eq($caseResult)->where('id')->eq($caseID)->exec();
|
||||
|
||||
@@ -1369,11 +1396,13 @@ class testtaskModel extends model
|
||||
|
||||
$relatedVersions = array();
|
||||
$runIdList = array();
|
||||
$nodeIdList = array();
|
||||
foreach($results as $result)
|
||||
{
|
||||
$runIdList[$result->run] = $result->run;
|
||||
$relatedVersions[] = $result->version;
|
||||
$runCaseID = $result->case;
|
||||
if(!empty($result->node)) $nodeIdList[] = $result->node;
|
||||
}
|
||||
$relatedVersions = array_unique($relatedVersions);
|
||||
|
||||
@@ -1386,6 +1415,9 @@ class testtaskModel extends model
|
||||
->leftJoin(TABLE_TESTTASK)->alias('t2')->on('t1.task=t2.id')
|
||||
->where('t1.id')->in($runIdList)
|
||||
->fetchPairs();
|
||||
$nodes = $this->dao->select('id,name')->from(TABLE_ZAHOST)
|
||||
->where('id')->in(array_unique($nodeIdList))
|
||||
->fetchPairs();
|
||||
|
||||
$this->loadModel('file');
|
||||
$files = $this->dao->select('*')->from(TABLE_FILE)
|
||||
@@ -1412,7 +1444,14 @@ class testtaskModel extends model
|
||||
{
|
||||
$result->stepResults = unserialize($result->stepResults);
|
||||
$result->build = $result->run ? zget($runs, $result->run, 0) : 0;
|
||||
$result->files = zget($resultFiles, $resultID, array()); //Get files of case result.
|
||||
$result->nodeName = $result->node ? zget($nodes, $result->node, '') : '';
|
||||
|
||||
if(!empty($result->ZTFResult))
|
||||
{
|
||||
$result->ZTFResult = $this->formatZtfLog($result->ZTFResult, $result->stepResults);
|
||||
}
|
||||
|
||||
$result->files = zget($resultFiles, $resultID, array()); //Get files of case result.
|
||||
if(isset($relatedSteps[$result->version]))
|
||||
{
|
||||
$relatedStep = $relatedSteps[$result->version];
|
||||
@@ -1431,11 +1470,68 @@ class testtaskModel extends model
|
||||
}
|
||||
|
||||
/* Get files of step result. */
|
||||
foreach($result->stepResults as $stepID => $stepResult) $result->stepResults[$stepID]['files'] = isset($stepFiles[$resultID][$stepID]) ? $stepFiles[$resultID][$stepID] : array();
|
||||
if(!empty($result->stepResults)) foreach($result->stepResults as $stepID => $stepResult) $result->stepResults[$stepID]['files'] = isset($stepFiles[$resultID][$stepID]) ? $stepFiles[$resultID][$stepID] : array();
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format ztf log.
|
||||
*
|
||||
* @param string $log
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function formatZtfLog($result, $stepResults)
|
||||
{
|
||||
$logObj = json_decode($result);
|
||||
$logs = empty($logObj->log) ? '' : $logObj->log;
|
||||
if(empty($logs)) return '';
|
||||
|
||||
$logs = str_replace(array("\r", "\n", "\r\n"), "\n", $logs);
|
||||
$logList = explode("\n", $logs);
|
||||
$logHtml = "";
|
||||
|
||||
foreach($logList as $log)
|
||||
{
|
||||
$log = preg_replace("/^[\d\-:.\x20]+/", '', $log);
|
||||
$log = trim($log);
|
||||
if(empty($log)) continue;
|
||||
|
||||
$failHtml = ': <span class="result-testcase fail">' . $this->lang->testtask->fail . '</span>';
|
||||
$passHtml = ': <span class="result-testcase pass">' . $this->lang->testtask->pass . '</span>';
|
||||
|
||||
$log = preg_replace(array("/:\x20失败/", "/:\x20fail/", "/:\x20成功/", "/:\x20pass/"), array($failHtml, $failHtml, $passHtml, $passHtml), $log);
|
||||
|
||||
$logHtml .= "<li>" . $log . "</li>";
|
||||
}
|
||||
|
||||
if(!empty($stepResults))
|
||||
{
|
||||
$total = count($stepResults);
|
||||
$failCount = $passCount = 0;
|
||||
|
||||
foreach($stepResults as $step)
|
||||
{
|
||||
if($step['result'] == 'pass')
|
||||
{
|
||||
$passCount++;
|
||||
}
|
||||
elseif($step['result'] == 'fail')
|
||||
{
|
||||
$failCount++;
|
||||
}
|
||||
}
|
||||
|
||||
$caseResult = $passCount ? 'pass':'fail';
|
||||
$logHtml .= "<li class='result-testcase {$caseResult}'>"
|
||||
. sprintf($this->lang->testtask->stepSummary, $total, $passCount, $failCount)
|
||||
. "</li>";
|
||||
}
|
||||
|
||||
return $logHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge an action is clickable or not.
|
||||
*
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach($cases as $caseID => $case):?>
|
||||
<?php if($case->auto == 'auto' and $confirm == 'yes') continue;?>
|
||||
<?php if($case->status == 'wait') continue;?>
|
||||
<?php if(!$productID) echo html::hidden("caseIDList[$case->id]", $caseID); ?>
|
||||
<tr class='text-center'>
|
||||
@@ -37,7 +38,9 @@
|
||||
<td class='text-left'><?php echo "<span title='" . $moduleOptionMenu[$case->module] . "'>" . $moduleOptionMenu[$case->module] . "</span>"?></td>
|
||||
<td class='text-left wordwrap'><?php echo "<span title='{$case->title}'>{$case->title}</span>"?></td>
|
||||
<td class='text-left precondition wordwrap'><?php echo "<span title='{$case->precondition}'>{$case->precondition}</span>"?></td>
|
||||
<td class='text-left'><?php echo html::radio("results[$caseID]", $this->lang->testcase->resultList, 'pass', "onclick='showAction(this.value,\".action$caseID\")'", 'block')?></td>
|
||||
<td class='text-left'>
|
||||
<?php echo html::radio("results[$caseID]", $this->lang->testcase->resultList, 'pass', "onclick='showAction(this.value,\".action$caseID\")'", 'block')?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if(!empty($steps[$caseID])):?>
|
||||
<table class='table table-fixed'>
|
||||
|
||||
@@ -19,21 +19,6 @@
|
||||
#action-divider{display: inline-block; line-height: 0px; border-right: 2px solid #ddd}
|
||||
</style>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div id="sidebar" class="side-col">
|
||||
<div class="sidebar-toggle">
|
||||
<i class="icon icon-angle-left"></i>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class='panel-body'>
|
||||
<div class='list-group'>
|
||||
<?php foreach($lang->testtask->unitTag as $key => $label):?>
|
||||
<?php echo html::a(inlink('browseUnits', "productID=$productID&browseType=$key&orderBy=$orderBy"), "<span class='text'>$label</span>", '', "id='{$key}UnitTab' class='btn btn-link' data-app='{$this->app->tab}'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-col main-table">
|
||||
<?php if(empty($tasks)):?>
|
||||
<div class="table-empty-tip">
|
||||
@@ -94,8 +79,7 @@
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#<?php echo $browseType?>UnitTab').addClass('selected');
|
||||
$('#browseunitsTab').addClass('btn-active-text');
|
||||
$('#<?php echo $browseType?>UnitTab').addClass('btn-active-text');
|
||||
})
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
<?php js::set('taskCaseBrowseType', ($browseType == 'bymodule' and $this->session->taskCaseBrowseType == 'bysearch') ? 'all' : $this->session->taskCaseBrowseType);?>
|
||||
<?php js::set('browseType', $browseType);?>
|
||||
<?php js::set('moduleID', $moduleID);?>
|
||||
<?php js::set('automation', !empty($automation) ? $automation->id : 0);?>
|
||||
<?php $this->app->loadLang('zanode');?>
|
||||
<?php js::set('runCaseConfirm', $lang->zanode->runCaseConfirm);?>
|
||||
<?php js::set('confirmURL', $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=id_desc&from=testcase&taskID=$taskID&confirm=yes"));?>
|
||||
<?php js::set('cancelURL', $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=id_desc&from=testcase&taskID=$taskID&confirm=no"));?>
|
||||
<div id='mainContent' class='main-row fade'>
|
||||
<div class='side-col' id='sidebar'>
|
||||
<div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
|
||||
@@ -70,7 +75,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($runs as $run):?>
|
||||
<tr data-id='<?php echo $run->id?>'>
|
||||
<tr data-id='<?php echo $run->id?>' data-auto='<?php echo $run->auto;?>'>
|
||||
<?php foreach($setting as $key => $value) $this->testtask->printCell($value, $run, $users, $task, $branches, $useDatatable ? 'datatable' : 'table');?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
@@ -131,8 +136,7 @@
|
||||
<?php
|
||||
if($canBatchRun)
|
||||
{
|
||||
$actionLink = inLink('batchRun', "productID=$productID&orderBy=id_desc&from=testtask&taskID=$taskID");
|
||||
echo html::commonButton($lang->testtask->runCase, "onclick=\"setFormAction('$actionLink')\"");
|
||||
echo html::commonButton($lang->testtask->runCase, "onclick=\"confirmAction()\"");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -163,5 +167,54 @@ if($shortcut.size() > 0)
|
||||
$(function(){$('#casesForm').table();})
|
||||
<?php endif;?>
|
||||
$("thead").find('.c-assignedTo').attr('class', '');
|
||||
function runAutocase()
|
||||
{
|
||||
var caseIDList = [];
|
||||
$.each($('input[name^=caseIDList]:checked'),function(){
|
||||
caseIDList.push($(this).val());
|
||||
});
|
||||
|
||||
var url = createLink('zanode', 'ajaxRunZTFScript', 'scriptID=' + automation)
|
||||
|
||||
var postData = {'caseIDList' : caseIDList.join(',')};
|
||||
|
||||
var response = true;
|
||||
$.post(url, postData, function(result)
|
||||
{
|
||||
if(result.result == 'fail')
|
||||
{
|
||||
alert(result.message);
|
||||
response = false;
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
function confirmAction(obj)
|
||||
{
|
||||
var autoRun = 'no';
|
||||
$.each($('input[name^=caseIDList]:checked'),function(){
|
||||
var dataAuto = $(this).parents('tr').attr('data-auto');
|
||||
if(dataAuto == 'auto') autoRun = dataAuto;
|
||||
});
|
||||
|
||||
if(autoRun == 'no' || !automation)
|
||||
{
|
||||
setFormAction(cancelURL, '', '#caseList');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(confirm(runCaseConfirm))
|
||||
{
|
||||
var result = runAutocase();
|
||||
if(result) setFormAction(confirmURL, '', '#caseList');
|
||||
}
|
||||
else
|
||||
{
|
||||
setFormAction(cancelURL, '', '#caseList');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -42,12 +42,23 @@
|
||||
if($class != 'success') $failCount++;
|
||||
$fileCount = '(' . count($result->files) . ')';
|
||||
?>
|
||||
<tr class='result-item' id='result-<?php echo $class?>' style='cursor: pointer'>
|
||||
<tr class='result-item' data-id='<?php echo $result->id?>' data-status='<?php echo $result->node > 0 && empty($result->ZTFResult) ? 'running': 'ready';?>' id='result-<?php echo $class?>' style='cursor: pointer'>
|
||||
<td class='w-120px'> #<?php echo $result->id?></td>
|
||||
<td class='w-180px'><?php echo $result->date;?></td>
|
||||
<?php if($result->node > 0):?>
|
||||
<td><?php echo sprintf($lang->testtask->runNode, zget($users, $result->lastRunner), $result->nodeName, $lang->testtask->runCase) . " <span class=\"label label-badge\">{$lang->testtask->auto}</span>";?></td>
|
||||
<?php else:?>
|
||||
<td><?php echo zget($users, $result->lastRunner) . ' ' . $lang->testtask->runCase;?></td>
|
||||
<?php endif;?>
|
||||
<td class='w-150px'><?php echo zget($builds, $result->build, '');?></td>
|
||||
<td class='w-50px text-right'><strong class='result-testcase <?php echo $result->caseResult;?>'><?php echo $lang->testcase->resultList[$result->caseResult]?></strong></td>
|
||||
<td class='w-50px text-right'>
|
||||
<?php if($result->node == 0 || !empty($result->ZTFResult)):?>
|
||||
<strong class='result-testcase <?php echo $result->caseResult;?>'><?php echo $lang->testcase->resultList[$result->caseResult];?></strong>
|
||||
<?php endif;?>
|
||||
<?php if($result->node > 0 and empty($result->ZTFResult)):?>
|
||||
<strong class='span-warning'><?php echo $lang->testtask->running;?></strong>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<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>
|
||||
<td class='w-50px text-center'><i class='collapse-handle icon-angle-down text-muted'></i></td>
|
||||
</tr>
|
||||
@@ -132,6 +143,15 @@
|
||||
<td><?php echo html::commonButton($lang->testcase->createBug, "onclick='createBug(this)'", "btn btn-primary createBtn");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if(!empty($result->ZTFResult) && $result->node>0):?>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<p></p>
|
||||
<p><?php echo $lang->testtask->runningLog;?></p>
|
||||
<p><?php echo $result->ZTFResult;?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
@@ -151,6 +171,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($result->stepResults)):?>
|
||||
<?php foreach($result->stepResults as $stepID => $stepResult):?>
|
||||
<div class="modal fade" id="stepResult<?php echo $result->id . '-' .$stepID;?>">
|
||||
<div class="modal-dialog">
|
||||
@@ -164,6 +185,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<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>
|
||||
<style>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<?php include '../../common/view/form.html.php';?>
|
||||
<?php js::set('caseResultSave', $lang->save);?>
|
||||
<?php js::set('tab', $app->tab);?>
|
||||
<?php js::set('confirm', $confirm);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='main-header'>
|
||||
<h2>
|
||||
@@ -27,6 +28,7 @@
|
||||
<tr>
|
||||
<td colspan='5' style='word-break: break-all;'><strong><?php echo $lang->testcase->precondition;?></strong><br/><?php echo nl2br($run->case->precondition);?></td>
|
||||
</tr>
|
||||
<?php if($confirm != 'yes'):?>
|
||||
<tr>
|
||||
<th class='w-50px'><?php echo $lang->testcase->stepID;?></th>
|
||||
<th class='w-p30'><?php echo $lang->testcase->stepDesc;?></th>
|
||||
@@ -34,7 +36,9 @@
|
||||
<th class='w-100px'><?php echo $lang->testcase->result;?></th>
|
||||
<th><?php echo $lang->testcase->real;?></th>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</thead>
|
||||
<?php if($confirm != 'yes'):?>
|
||||
<?php
|
||||
if(empty($run->case->steps))
|
||||
{
|
||||
@@ -81,11 +85,12 @@
|
||||
</tr>
|
||||
<?php $childId ++;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<tr class='text-center'>
|
||||
<td colspan='5' class='form-actions'>
|
||||
<?php
|
||||
if($preCase) echo html::a(inlink('runCase', "runID={$preCase['runID']}&caseID={$preCase['caseID']}&version={$preCase['version']}"), $lang->testtask->pre, '', "id='pre' class='btn btn-wide'");
|
||||
if($run->case->status != 'wait') echo html::submitButton();
|
||||
if($run->case->status != 'wait' and $confirm != 'yes') echo html::submitButton();
|
||||
if($nextCase) echo ' ' . html::a(inlink('runCase', "runID={$nextCase['runID']}&caseID={$nextCase['caseID']}&version={$nextCase['version']}"), $lang->testtask->next, '', "id='next' class='btn btn-wide'");
|
||||
echo html::hidden('case', $run->case->id);
|
||||
echo html::hidden('version', $run->case->currentVersion);
|
||||
@@ -115,12 +120,20 @@
|
||||
</div>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
loadResult();
|
||||
});
|
||||
function loadResult()
|
||||
{
|
||||
$('#resultsContainer').load("<?php echo $this->createLink('testtask', 'results', "runID={$runID}&caseID=$caseID&version=$version");?> #casesResults", function()
|
||||
{
|
||||
$('.result-item').click(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
if($this.data('status') == 'running')
|
||||
{
|
||||
return;
|
||||
}
|
||||
$this.toggleClass('show-detail');
|
||||
var show = $this.hasClass('show-detail');
|
||||
$this.next('.result-detail').toggleClass('hide', !show);
|
||||
@@ -128,8 +141,34 @@ $(function()
|
||||
});
|
||||
|
||||
$('#casesResults table caption .result-tip').html($('#resultTip').html());
|
||||
|
||||
if($('.result-item:first').data('status') == 'running')
|
||||
{
|
||||
var times = 0;
|
||||
var id = $('.result-item:first').data('id')
|
||||
var link = createLink('testtask', 'ajaxGetResult', 'resultID=' + id);
|
||||
|
||||
var resultInterval = setInterval(() => {
|
||||
times++;
|
||||
if(times > 600)
|
||||
{
|
||||
clearInterval(resultInterval);
|
||||
}
|
||||
|
||||
$.get(link, function(task)
|
||||
{
|
||||
task = JSON.parse(task);
|
||||
task = task.data;
|
||||
if(task.ZTFResult != '')
|
||||
{
|
||||
clearInterval(resultInterval);
|
||||
loadResult();
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
var sessionString = '<?php echo session_name() . '=' . session_id();?>';
|
||||
</script>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user