Merge branch release/21.7.3 of zentao/zentaopms (#10218)

This commit is contained in:
李阳
2025-07-07 15:16:33 +08:00
committed by Gitfox
8 changed files with 255 additions and 4 deletions
@@ -0,0 +1,95 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/ui.php';
class closeExecutionTester extends tester
{
/**
* 关闭执行弹窗中输入实际完成日期。
* Input fields.
*
* @param string $realEnd
* @param string $executionId
* @access public
*/
public function inputFields($realEnd, $executionId)
{
$this->switchVision('lite');
$viewForm = $this->initForm('execution', 'view', array('execution' => $executionId), 'appIframe-project');
$viewForm->wait(1);
$realBegan = $viewForm->dom->realBeganView->getText();
$form = $this->initForm('execution', 'kanban', array('execution' => $executionId), 'appIframe-project');
$form->wait(1);
$form->dom->kanbanSettingInLite->click();
$form->wait(1);
$form = $this->loadPage();
$form->wait(1);
$form->dom->btn($this->lang->execution->close)->click();
$form->wait(1);
$form = $this->loadPage();
$form->wait(1);
if(isset($realEnd)) $form->dom->realEnd->datePicker($realEnd);
$form->wait(1);
$form->dom->closeSubmitInLite->click();
$form->wait(1);
return $realBegan;
}
/**
* 正常关闭执行。
* Close execution.
*
* @param string $realEnd
* @param string $executionId
* @access public
* @return bool
*/
public function close($realEnd, $executionId)
{
$this->inputFields($realEnd, $executionId);
$form = $this->initForm('execution', 'view', array('execution' => $executionId), 'appIframe-project');
$form->wait(1);
if($form->dom->status->getText() != $this->lang->execution->statusList->closed) return $this->failed('执行状态错误');
if($form->dom->realEndView->getText() != $realEnd) return $this->failed('执行实际完成日期错误');
return $this->success('关闭执行成功');
}
/**
* 实际完成日期大于当前日期。
* The real end date is greater than the current date.
*
* @param string $realEnd
* @param string $executionId
* @access public
* @return bool
*/
public function closeWithGreaterDate($realEnd, $executionId)
{
$this->inputFields($realEnd, $executionId);
$form = $this->loadPage();
$field = $form->dom->realEndField->getText();
$text = $form->dom->realEndTip->getText();
$info = sprintf($this->lang->error->le, $field, date('Y-m-d'));
if($text == $info) return $this->success('关闭执行表单页提示信息正确');
return $this->failed('关闭执行表单页提示信息不正确');
}
/**
* 实际完成日期小于实际开始日期。
* The real end date is less than the real start date.
*
* @param string $realEnd
* @param string $executionId
* @access public
* @return bool
*/
public function closeWithLessDate($realEnd, $executionId)
{
$realBegan = $this->inputFields($realEnd, $executionId);
$form = $this->loadPage();
$form->wait(1);
$field = $form->dom->realEndField->getText();
$text = $form->dom->realEndTip->getText();
$info = sprintf($this->lang->execution->ge, $field, $realBegan);
if($text == $info) return $this->success('关闭执行表单页提示信息正确');
return $this->failed('关闭执行表单页提示信息不正确');
}
}
@@ -0,0 +1,28 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/ui.php';
class deleteExecutionTester extends tester
{
/**
* 删除执行。
* Delete execution.
*
* @access public
* @return object
*/
public function delete()
{
$viewForm = $this->initForm('execution', 'view', array('execution' => '2'), 'appIframe-execution');
$viewForm->wait(1);
$executionName = $viewForm->dom->executionName->getText();
$viewForm->dom->deleteBtn->click();
$viewForm->wait(1);
$viewForm->dom->alertModal();
$form = $this->initForm('execution', 'all', 'appIframe-execution');
$form->wait(1);
$form->dom->search(array(",=,{$executionName}"));
$form->wait(1);
if(is_object($form->dom->tips) && $form->dom->tips->getText() == $this->lang->execution->noExecutions) return $this->success('删除执行成功');
return $this->failed('删除执行失败');
}
}
@@ -31,7 +31,7 @@ class editExecutionTester extends tester
*
* @param string $type sprint|stage|kanban
* @access public
* @return bool
* @return object
*/
public function checkRepeatInfo($type = 'sprint')
{
@@ -57,7 +57,7 @@ class editExecutionTester extends tester
*
* @param string $dateType begin|end
* @access public
* @return bool
* @return object
*/
public function checkDateInfo($dateType = 'end')
{
@@ -92,7 +92,7 @@ class editExecutionTester extends tester
* Get error info of manage products.
*
* @access public
* @return bool
* @return object
*/
public function checkManageProductsInfo()
{
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env php
<?php
/**
title=运营界面关闭看板
timeout=0
cid=1
- 执行tester模块的closeWithGreaterDate方法,参数是$realEnd[0], '2'▫
- 最终测试状态 @SUCCESS
- 测试结果 @关闭执行表单页提示信息正确
- 执行tester模块的closeWithLessDate方法,参数是$realEnd[2], '2'▫
- 最终测试状态 @SUCCESS
- 测试结果 @关闭执行表单页提示信息正确
- 执行tester模块的close方法,参数是$realEnd[1], '2'▫
- 最终测试状态 @SUCCESS
- 测试结果 @关闭执行成功
*/
chdir(__DIR__);
include '../lib/closeinlite.ui.class.php';
$product = zenData('product');
$product->id->range('1');
$product->name->range('产品1');
$product->shadow->range('1');
$product->type->range('normal');
$product->vision->range('lite');
$product->gen(1);
$project = zenData('project');
$project->id->range('1-5');
$project->project->range('0');
$project->model->range('kanban');
$project->type->range('project');
$project->auth->range('extend');
$project->storytype->range('[]');
$project->path->range('`,1,`');
$project->grade->range('1');
$project->name->range('项目1');
$project->hasProduct->range('1');
$project->begin->range('(-2M)-(-M):1D')->type('timestamp')->format('YY/MM/DD');
$project->end->range('(+2M)-(+3M):1D')->type('timestamp')->format('YY/MM/DD');
$project->status->range('doing');
$project->acl->range('open');
$project->vision->range('lite');
$project->gen(1);
$execution = zenData('project');
$execution->id->range('2');
$execution->project->range('1');
$execution->type->range('kanban');
$execution->parent->range('1');
$execution->path->range('`,1,2,`');
$execution->grade->range('1');
$execution->name->range('测试关闭看板');
$execution->hasProduct->range('1');
$execution->begin->range('(-5D)-(-4D):1D')->type('timestamp')->format('YY/MM/DD');
$execution->end->range('(+M)-(+2M):1D')->type('timestamp')->format('YY/MM/DD');
$execution->realBegan->range('(-3D)-(-2D):1D')->type('timestamp')->format('YY/MM/DD');
$execution->status->range('doing');
$execution->vision->range('lite');
$execution->gen(1, false);
$projectProduct = zenData('projectproduct');
$projectProduct->project->range('1-5');
$projectProduct->product->range('1');
$projectProduct->gen(2);
zenData('task')->gen(0);
$tester = new closeExecutionTester();
$tester->login();
$realEnd = array(date('Y-m-d', strtotime('+20 days')), date('Y-m-d'), date('Y-m-d', strtotime('-4 days')));
r($tester->closeWithGreaterDate($realEnd[0], '2')) && p('status,message') && e('SUCCESS,关闭执行表单页提示信息正确');
r($tester->closeWithLessDate($realEnd[2], '2')) && p('status,message') && e('SUCCESS,关闭执行表单页提示信息正确');
r($tester->close($realEnd[1], '2')) && p('status,message') && e('SUCCESS,关闭执行成功');
$tester->closeBrowser();
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
/**
title=删除执行
timeout=0
cid=1
- 执行tester模块的delete方法▫
- 最终测试状态 @SUCCESS
- 测试结果 @删除执行成功
*/
chdir(__DIR__);
include '../lib/delete.ui.class.php';
$project = zenData('project');
$project->id->range('1-100');
$project->project->range('0, 1{2}');
$project->model->range('scrum, []{2}');
$project->type->range('project, sprint{2}');
$project->auth->range('extend, []{2}');
$project->storyType->range('story, []{2}');
$project->parent->range('0, 1{2}');
$project->path->range('`,1,`, `,1,2,`, `,1,3,`');
$project->grade->range('1');
$project->name->range('项目, 执行1, 执行2');
$project->begin->range('(-2M)-(-M):1D')->type('timestamp')->format('YY/MM/DD');
$project->end->range('(+2M)-(+3M):1D')->type('timestamp')->format('YY/MM/DD');
$project->openedBy->range('user1');
$project->acl->range('open');
$project->status->range('wait');
$project->gen(3);
$tester = new deleteExecutionTester();
$tester->login();
r($tester->delete()) && p('status,message') && e('SUCCESS,删除执行成功');
$tester->closeBrowser();
+2
View File
@@ -19,6 +19,8 @@ class allPage extends page
'suspendedTab' => "//*[@id='featureBar']/menu/li[5]/a",
'delayedTab' => "//*[@id='featureBar']/menu/li[6]/a",
'closedTab' => "//*[@id='featureBar']/menu/li[7]/a",
/* 搜索不到执行数据的提示信息 */
'tips' => "//*[@id='table-execution-all']/div/div/div",
/* 批量编辑状态 */
'statusBtn' => "//*[@id='table-execution-all']/div[3]/nav[1]/button",
'wait' => "//*[@data-page='execution-all']/div[2]/menu/menu/li[1]/a",
+3
View File
@@ -16,6 +16,9 @@ class kanbanPage extends page
'putoffSubmitInLite' => "//form[contains(@id,'zin_execution_putoff')]//button",
/* 挂起看板弹窗中的提交按钮 */
'suspendSubmitInLite' => "//form[contains(@id,'zin_execution_suspend')]//button",
/* 关闭看板弹窗中的元素 */
'realEndField' => "//div[@data-name='realEnd']/label/span",
'closeSubmitInLite' => "//form[contains(@id,'zin_execution_close')]//button",
);
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
}
+2 -1
View File
@@ -18,7 +18,8 @@ class viewPage extends page
'plannedEnd' => "//*[@id='mainContent']/div[2]/div[1]/div/table[3]/tbody/tr/td/div/div[2]/span[2]",
'realBeganView' => "//*[@id='mainContent']/div[2]/div[1]/div/table[3]/tbody/tr/td/div/div[3]/span[2]",
'realEndView' => "//*[@id='mainContent']/div[2]/div[1]/div/table[3]/tbody/tr/td/div/div[4]/span[2]",
'edit' => "//*[@id='mainContent']/div[3]/div/a[last()-1]",
'editBtn' => "//*[@id='mainContent']/div[3]/div/a[last()-1]",
'deleteBtn' => "//*[@id='mainContent']/div[3]/div/a[last()]",
'linckedProducta' => "//*[@id='mainContent']/div[2]/div[1]/div/table[1]/tbody/tr[1]/td[1]",
'linckedProductb' => "//*[@id='mainContent']/div[2]/div[1]/div/table[1]/tbody/tr[2]/td[1]",
'productsNev' => "//*[@data-id='products']",