diff --git a/module/testtask/control.php b/module/testtask/control.php index d8c42e3113..417e2816a4 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -561,8 +561,52 @@ class testtask extends control $sort = common::appendOrder($orderBy, 't2.id'); /* Get test cases. */ - $runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task); - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); + $runs = array(); + $pager->pageID = $pageID; // 场景和用例混排,$pageID 可能大于场景分页后的总页数。在 pager 构造函数中会被设为 1,这里要重新赋值。 + + $scenes = $this->testcase->getSceneGroups($productID, $task->branch, $moduleID, '', $orderBy, $pager); // 获取包含子场景和用例的顶级场景树。 + $recPerPage = $pager->recPerPage; + $sceneTotal = $pager->recTotal; + $sceneCount = count($scenes); + + /* 场景条数小于每页记录数,继续获取用例。 */ + if($sceneCount < $recPerPage) + { + /* 重置 $pager 属性,只获取需要的用例条数。*/ + $pager->recTotal = 0; + $pager->pageID = 1; // 查询用例时的分页起始偏移量单独计算,每次查询的页码都设为 1 即可,后面会重新设置页码。 + $pager->recPerPage = $recPerPage - $sceneCount; // 可能存在场景没排满一页,需要用例补全的情况。这里只查询需要补全的记录数。 + + if($sceneCount == 0) $pager->offset = $recPerPage * ($pageID - 1) - $sceneTotal; // 场景数为 0 表示本页查询只显示用例,需要计算用例分页的起始 + + $runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task); + + /* Process case for check story changed. */ + $runs = $this->loadModel('story')->checkNeedConfirm($runs); + $runs = $this->testcase->appendData($runs, 'run'); + foreach($runs as $runID => $run) + { + unset($runs[$runID]); + if($run->task != $taskID and $run->scene) continue; + + $run->id = 'case_' . $run->case; // Add a prefix to avoid duplication with the scene ID. + $run->parent = 0; + $run->grade = 1; + $run->path = ',' . $run->case . ','; + $run->isScene = false; + $runs[$run->id] = $run; + } + + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); + } + + /* 合并场景和用例的总记录数,并重新计算总页数和当前页码。*/ + $pager->recTotal = $sceneTotal + count($runs); + $pager->recPerPage = $recPerPage; + $pager->pageTotal = ceil($pager->recTotal / $recPerPage); + $pager->pageID = $pageID; + + $sceneRuns = $this->testcase->processSearchedData($scenes, $runs); /* Build the search form. */ $this->loadModel('testcase'); @@ -584,22 +628,16 @@ class testtask extends control $this->loadModel('search')->setSearchParams($this->config->testcase->search); /* Append bugs and results. */ - $runs = $this->testcase->appendData($runs, 'run'); - $case2RunMap = array(); foreach($runs as $run) $case2RunMap[$run->case] = $run->id; $showModule = $this->loadModel('setting')->getItem("owner={$this->app->user->account}&module=datatable§ion=testtaskCases&key=showModule"); - $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; - $this->view->position[] = $this->lang->testtask->cases; - + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; + $this->view->runs = $sceneRuns; $this->view->productID = $productID; $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; diff --git a/module/testtask/css/cases.css b/module/testtask/css/cases.css index 07ce91ae3e..8c106240e3 100644 --- a/module/testtask/css/cases.css +++ b/module/testtask/css/cases.css @@ -14,3 +14,63 @@ td .warning {color: red;} #modules .active {font-weight: bolder;} .tree li > a.active {color: #0c64eb;} + +body {margin-bottom: 25px;} +.w-220px {width: 220px;} +.w-170px {width: 170px;} + +#createActionMenu .dropdown-menu {width: 100%;} +#caseForm table tbody tr td {overflow: hidden; white-space: nowrap;} +#caseForm .setting {height: 25px;} +#caseForm table tbody .c-name {overflow: hidden; padding-right: 65px;} +#caseForm table tbody .c-name a:first-child {overflow: hidden; display: inline-block; max-width: 100%;} + +.dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;} +.dropdown-menu > .menu-search .input-group {width: 100%;} +.dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666;} +.dropdown-menu > .menu-search .form-control {border: none !important; box-shadow: none !important; border-top: 1px solid #ddd !important;} +.dropdown-list {display: block; padding: 0; max-height: 270px; overflow-y: auto;} +.dropdown-list > li > a {display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.53846154; color: #141414; white-space: nowrap;} +.dropdown-list > li > a:hover, +.dropdown-list > li > a:focus {color: #1a4f85; text-decoration: none; background-color: #ddd;} + +.pl-5px {padding-left: 5px;} + +tbody > tr > td > .btn-icon {margin-right: 3px;} +tbody > tr > td .icon-share {font-size: 9px;} + +.table td.c-title > a:first-child {display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} + +#importToLib .select-lib {width: 100px; text-align: right;} +#subHeader #currentBranch + #dropMenu .col-left {padding-bottom: 30px;} +.status-blocked {left: -5px;} + +#mainMenu .pull-left .dividing-line {margin: 7px 5px 0 0;} +.btn-toolbar>.btn, .btn-toolbar>.btn-group, .btn-toolbar>.dropdown {margin-right: 5px;} + +#mainMenu > .btn-toolbar > .checkbox-primary{float: left;} + +.table-nest-icon { cursor: pointer; } + +.tr-moving { opacity: 0.3; } +.tr-acceptable { border: 2px solid rgba(255,0,0,0.5); } +.none-select { -webkit-user-select: none; -moz-user-select: none; -moz-user-select: none; user-select: none; } + +.table-nest-toggle { vertical-align: middle; } +.table-nest-title .icon-test { pointer-events: none; } + +.icon-test:after,.icon-ztf:after { border: 0px solid!important; } + +#caseTableList.sortable-sorting > tr {opacity: 0.7} +#caseTableList.sortable-sorting > tr.drag-row {opacity: 1;} +#caseTableList > tr.drop-not-allowed {opacity: 0.1!important} +#caseList .c-actions {overflow: visible;} +#caseList > thead > tr > th .table-nest-toggle-global {top: 6px} +#caseList > thead > tr > th .table-nest-toggle-global:before {color: #a6aab8;} +#caseTableList > tr:last-child .c-actions .dropdown-menu {top: auto; bottom: 100%; margin-bottom: -5px;} +#caseTableList .icon-common:before {width: 22px; height: 22px; background: none; color: rgb(166, 170, 184); top: 0; line-height: 22px; margin-right: 2px; font-size: 14px} +#caseTableList .icon-project:before {content: '\e99c';} +#caseTableList .icon-test:before {content: '\e956';} +#caseTableList .icon-ztf:before {content: '\e9dd';} +#caseTableList .icon-waterfall:before {content: '\e9a4';} +#caseTableList .icon-kanban:before {content: '\e983';} diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index e40e9450c7..b4ceb4ea77 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -11,7 +11,7 @@ */ ?> - + testtask->confirmUnlinkCase)?> session->taskCaseBrowseType == 'bysearch') ? 'all' : $this->session->taskCaseBrowseType);?> @@ -45,7 +45,8 @@ $datatableId = $this->moduleName . ucfirst($this->methodName); $useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable'); ?> -