+ [test,done,0.5h,0h] add function comments.
This commit is contained in:
@@ -3,6 +3,15 @@
|
||||
include dirname(__FILE__, 5) . '/test/lib/ui.php';
|
||||
class confirmBugTester extends tester
|
||||
{
|
||||
/**
|
||||
* 确认bug。
|
||||
* Confirm a bug.
|
||||
*
|
||||
* @param array $project
|
||||
* @param array $bug
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function confirmBug($project = array(), $bug = array())
|
||||
{
|
||||
$this->login();
|
||||
@@ -24,10 +33,18 @@ class confirmBugTester extends tester
|
||||
$list->dom->btn($this->lang->bug->confirm)->click();
|
||||
$this->webdriver->wait(1);
|
||||
|
||||
return $this->bugAssert();
|
||||
|
||||
return $this->bugAssert($bugTitle, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决bug。
|
||||
* Resolve a bug.
|
||||
*
|
||||
* @param array $project
|
||||
* @param array $bug
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function resolveBug($project = array(), $bug = array())
|
||||
{
|
||||
$this->login();
|
||||
@@ -37,7 +54,6 @@ class confirmBugTester extends tester
|
||||
$list->dom->value1->picker($bug['isResolved']);
|
||||
$list->dom->searchButton->click();
|
||||
$this->webdriver->wait(1);
|
||||
return $this->bugAssert();
|
||||
$bugTitle = $list->dom->bugTitle->getText();
|
||||
$list->dom->resolveButton->click();
|
||||
$this->webdriver->wait(1);
|
||||
@@ -49,20 +65,24 @@ class confirmBugTester extends tester
|
||||
$list->dom->btn($this->lang->bug->resolve)->click();
|
||||
$this->webdriver->wait(1);
|
||||
|
||||
return $this->bugAssert();
|
||||
return $this->bugAssert($bugTitle, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给bug列表上的操作增加断言。
|
||||
* Add a assertion on bug list.
|
||||
*
|
||||
* @param string $bugTitle
|
||||
* @param object $list
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function bugAssert(string $bugTitle = '', object $list = null)
|
||||
{
|
||||
if(!isset($bugTitle) || !is_object($list)) return $this->failed('获取bug标题失败');
|
||||
|
||||
$bugTitleLists = $list->dom->bugTitleList->getElementList($list->dom->page->xpath['bugTitleList']);
|
||||
$bugList = [];
|
||||
foreach($bugTitleLists->element as $bugTitleList)
|
||||
{
|
||||
$bugList[] = $bugTitleList->getText();
|
||||
}
|
||||
|
||||
$bugList = array_map(function($element){return $element->getText();}, $bugTitleLists->element);
|
||||
if(!in_array($bugTitle, $bugList)) return $this->success('操作bug成功');
|
||||
return $this->failed('操作bug失败');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user