* [task#128686,doing,2h,h] Add function.

This commit is contained in:
yulujie
2024-09-26 08:31:40 +08:00
committed by 曹延义
parent 355d5b662f
commit 8123e227d2
@@ -3,50 +3,75 @@ include dirname(__FILE__, 5) . '/test/lib/ui.php';
class StoryEstimateTester extends tester
{
/**
* 需求估算。
* Story estimate.
* 表单内容。
* Input form.
*
* @param array $estimate
* @param array $estimate
* @access public
* @return void
*/
public function storyEstimate($estimate)
public function InputForm($estimate)
{
$form = $this->initForm('execution', 'story', array('execution' => '2'), 'appIframe-execution');
$form->dom->xpath['firstEstimateBtn'] = "//a[@title = '{$this->lang->execution->storyEstimate}']";
$form->dom->firstEstimateBtn->click();
if(is_object($form->dom->reestimate)) $form->dom->reestimate->click();
if(isset($estimate[0])) $form->dom->estimateA->setValue($estimate[0]);
if(isset($estimate[1])) $form->dom->estimateB->setValue($estimate[1]);
if(isset($estimate[2])) $form->dom->estimateC->setValue($estimate[2]);
$form->wait(1);
$form->dom->estimateA->setValue($estimate[0]);
$form->dom->estimateB->setValue($estimate[1]);
$form->dom->estimateC->setValue($estimate[2]);
$averageA = $form->dom->average->attr('value');
$form->dom->submitBtn->click();
}
$a = $form->dom->estimateA->getValue();
$b = $form->dom->estimateB->getValue();
$c = $form->dom->estimateC->getValue();
$aveA = $form->dom->average->attr('value');
if($a != $estimate[0] || $b != $estimate[1] || $c != $estimate[2] || $aveA != $averageA || $aveA != $estimate['avergeA']) return $this->failed('第1轮估算失败');
/**
* 需求估算。
* Story estimate.
*
* @param array $estimate
* @param string $time
* @access public
* @return void
*/
public function storyEstimate($estimate, $time)
{
$this->InputForm($estimate);
$form = $this->loadPage();
$round = sprintf($this->lang->story->estimateRound, $time);
$form->dom->round->picker($round);
$form->wait(1);
$form->dom->reestimate->click();
$a = $form->dom->estimateA->getValue();
$b = $form->dom->estimateB->getValue();
$c = $form->dom->estimateC->getValue();
$ave = $form->dom->average->attr('value');
$form->dom->newEstimateA->setValue($estimate[3]);
$form->dom->newEstimateB->setValue($estimate[4]);
$form->dom->newEstimateC->setValue($estimate[5]);
$averageB = $form->dom->newAverage->attr('value');
$form->dom->submitBtn->click();
$roundB = sprintf($this->lang->story->storyRound, '2');
$form->dom->round->picker($roundB);
$form->wait(1);
$d = $form->dom->newEstimateA->getValue();
$e = $form->dom->newEstimateB->getValue();
$f = $form->dom->newEstimateC->getValue();
$aveB = $form->dom->newAverage->attr('value');
if($d != $estimate[3] || $e != $estimate[4] || $f != $estimate[5] || $aveB != $averageB || $aveB != $estimate['avergeB']) return $this->failed('第2轮估算失败');
if($a != $estimate[0] || $b != $estimate[1] || $c != $estimate[2] || $ave != $estimate['averge']) return $this->failed('估算失败');
return $this->success('估算成功');
}
/**
* 需求估算值为非数字。
* Story estimate value is not a number.
*
* @param array $estimate
* @param string $type notNumber|negative
* @access public
* @return void
*/
public function checkErrorInfo($estimate, $type)
{
$this->inputForm($estimate);
$form = $this->loadPage();
$form->wait(1);
if($type == 'notNumber')
{
if($form->dom->estimateTip->getText() == $this->lang->story->estimateMustBeNumber) return $this->success('估算值为非数字提示成功');
return $this->failed('估算值为非数字提示失败');
}
else
{
if($form->dom->estimateTip->getText() == $this->lang->story->estimateMustBePlus) return $this->success('估算值为负数提示成功');
return $this->failed('估算值为负数提示失败');
}
}
}