diff --git a/module/execution/test/lib/closeinlite.ui.class.php b/module/execution/test/lib/closeinlite.ui.class.php new file mode 100644 index 0000000000..a5f3d643d2 --- /dev/null +++ b/module/execution/test/lib/closeinlite.ui.class.php @@ -0,0 +1,95 @@ +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('关闭执行表单页提示信息不正确'); + } +} diff --git a/module/execution/test/lib/delete.ui.class.php b/module/execution/test/lib/delete.ui.class.php new file mode 100644 index 0000000000..2081d717f9 --- /dev/null +++ b/module/execution/test/lib/delete.ui.class.php @@ -0,0 +1,28 @@ +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('删除执行失败'); + } +} diff --git a/module/execution/test/lib/editexecution.ui.class.php b/module/execution/test/lib/editexecution.ui.class.php index 37a68c764b..59e717a0bf 100644 --- a/module/execution/test/lib/editexecution.ui.class.php +++ b/module/execution/test/lib/editexecution.ui.class.php @@ -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() { diff --git a/module/execution/test/ui/closeinlite.php b/module/execution/test/ui/closeinlite.php new file mode 100644 index 0000000000..0d1de37b60 --- /dev/null +++ b/module/execution/test/ui/closeinlite.php @@ -0,0 +1,81 @@ +#!/usr/bin/env php +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(); diff --git a/module/execution/test/ui/delete.php b/module/execution/test/ui/delete.php new file mode 100644 index 0000000000..114c0c5b85 --- /dev/null +++ b/module/execution/test/ui/delete.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +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(); diff --git a/module/execution/test/ui/page/all.php b/module/execution/test/ui/page/all.php index fb828cca47..1ae8f0506c 100755 --- a/module/execution/test/ui/page/all.php +++ b/module/execution/test/ui/page/all.php @@ -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", diff --git a/module/execution/test/ui/page/kanban.php b/module/execution/test/ui/page/kanban.php index 320968b383..aef9bcaba9 100755 --- a/module/execution/test/ui/page/kanban.php +++ b/module/execution/test/ui/page/kanban.php @@ -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); } diff --git a/module/execution/test/ui/page/view.php b/module/execution/test/ui/page/view.php index 15aa3a7033..1b5d3ba566 100755 --- a/module/execution/test/ui/page/view.php +++ b/module/execution/test/ui/page/view.php @@ -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']",