* Fix issue #3455.

This commit is contained in:
zhaoke
2023-07-11 16:54:44 +08:00
parent 397a955e41
commit 78aa4d2cd3
3 changed files with 16 additions and 2 deletions
+4
View File
@@ -555,6 +555,9 @@ class testtask extends control
/* Append bugs and results. */
$runs = $this->testcase->appendData($runs, 'run');
$case2RunMap = array();
foreach($runs as $run) $case2RunMap[$run->case] = $run->id;
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases;
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testtask->common;
@@ -564,6 +567,7 @@ class testtask extends control
$this->view->productName = $this->products[$productID];
$this->view->task = $task;
$this->view->runs = $runs;
$this->view->case2RunMap = $case2RunMap;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|qafirst|noletter');
$this->view->assignedToList = $assignedToList;
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, 'case', 0, array('treeModel', 'createTestTaskLink'), $taskID, $task->branch);
+4 -1
View File
@@ -17,6 +17,7 @@
<?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('case2RunMap', $case2RunMap);?>
<?php js::set('automation', !empty($automation) ? $automation->id : 0);?>
<?php $this->app->loadLang('zanode');?>
<?php js::set('runCaseConfirm', $lang->zanode->runCaseConfirm);?>
@@ -170,13 +171,15 @@ $("thead").find('.c-assignedTo').attr('class', '');
function runAutocase()
{
var caseIDList = [];
var runIDList = [];
$.each($('input[name^=caseIDList]:checked'),function(){
caseIDList.push($(this).val());
runIDList.push(case2RunMap[$(this).val()]);
});
var url = createLink('zanode', 'ajaxRunZTFScript', 'scriptID=' + automation)
var postData = {'caseIDList' : caseIDList.join(',')};
var postData = {'caseIDList' : caseIDList.join(','), 'runIDList' : runIDList.join(',')};
var response = true;
$.post(url, postData, function(result)
+8 -1
View File
@@ -617,13 +617,20 @@ class zanode extends control
if($_POST)
{
$caseIDList = $_POST['caseIDList'];
$runIDList = $_POST['runIDList'];
$script = $this->zanode->getAutomationByID($scriptID);
$cases = $this->loadModel('testcase')->getByList($caseIDList);
$caseIDListArray = explode(',', $caseIDList);
$runIDListArray = explode(',', $runIDList);
$case2RunMap = array();
foreach($caseIDListArray as $index => $caseID) $case2RunMap[$caseID] = $runIDListArray[$index];
foreach($cases as $id => $case)
{
if($case->auto != 'auto') continue;
$resultID = $this->loadModel('testtask')->initResult(0, $id, $case->version, $script->node);
$resultID = $this->loadModel('testtask')->initResult($case2RunMap[$id], $id, $case->version, $script->node);
if(!dao::isError()) $this->zanode->runZTFScript($script->id, $id, $resultID);
}