* Finish task #78647.

This commit is contained in:
tanghucheng
2022-12-15 10:00:48 +08:00
parent e5ad70caca
commit ef3f7a32d2
9 changed files with 81 additions and 23 deletions
+7 -1
View File
@@ -1313,15 +1313,20 @@ 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)
{
if($confirm == 'yes') $this->post->set('node', $automation->node);
$this->testtask->batchRun($from, $taskID);
$this->loadModel('action');
foreach(array_keys($this->post->results) as $caseID) $this->action->create('case', $caseID, 'run', '', $taskID);
@@ -1406,6 +1411,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();
}
+2
View File
@@ -1320,6 +1320,7 @@ class testtaskModel extends model
$postReals = $postData->reals[$caseID];
$caseResult = $result ? $result : 'pass';
if($postData->node) $caseResult = '';
$stepResults = array();
if($dbSteps)
{
@@ -1350,6 +1351,7 @@ class testtaskModel extends model
$result->stepResults = serialize($stepResults);
$result->lastRunner = $this->app->user->account;
$result->date = $now;
if(isset($postData->node)) $result->node = $postData->node;
$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();
+7 -1
View File
@@ -37,7 +37,13 @@
<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 if($confirm == 'yes'):?>
<?php echo html::hidden("results[$caseID]", '');?>
<?php else:?>
<?php echo html::radio("results[$caseID]", $this->lang->testcase->resultList, 'pass', "onclick='showAction(this.value,\".action$caseID\")'", 'block')?>
<?php endif;?>
</td>
<td>
<?php if(!empty($steps[$caseID])):?>
<table class='table table-fixed'>
+19 -2
View File
@@ -17,6 +17,10 @@
<?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 $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>
@@ -131,8 +135,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 +166,19 @@ if($shortcut.size() > 0)
$(function(){$('#casesForm').table();})
<?php endif;?>
$("thead").find('.c-assignedTo').attr('class', '');
function confirmAction()
{
if(confirm(runCaseConfirm))
{
setFormAction(confirmURL, '', '#caseList');
}
else
{
setFormAction(cancelURL, '', '#caseList');
}
return false;
}
</script>
</script>
<?php include '../../common/view/footer.html.php';?>