* [task#137029,doing,0.2h,1.5h] Modify cases for uitest of report function.
This commit is contained in:
@@ -7,33 +7,58 @@ class reportTester extends tester
|
||||
* Check report data.
|
||||
*
|
||||
* @param string $report 报表名称
|
||||
* @param array $itemNum 查看的报表条目
|
||||
* @param array $data 报表条目、值、百分比
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function check($report, $itemNum = 'a', $data)
|
||||
{
|
||||
$form = $this->initForm('testtask', 'report', array('productID' => '1', 'taskID' => '1', 'browseType' => 'all', 'chartType' => 'pie'), 'appIframe-qa');
|
||||
$form->dom->$report->click();
|
||||
$form->dom->createBtn->click();
|
||||
$form->wait(1);
|
||||
$types = array('pie', 'bar', 'line');
|
||||
foreach($types as $type)
|
||||
{
|
||||
$form->dom->$type->click();
|
||||
$message = $this->checkReport($report, $type, $itemNum, $data);
|
||||
if($message == 'titleError') return $this->failed($type . '报表' . $itemNum . '行显示名称错误');
|
||||
if($message == 'itemError') return $this->failed($type . '报表' . $itemNum . '显示条目错误');
|
||||
if($message == 'valueError') return $this->failed($type . '报表' . $itemNum . '显示值错误');
|
||||
if($message == 'percentError') return $this->failed($type . '报表' . $itemNum . '显示百分比错误');
|
||||
$form->wait(2);
|
||||
}
|
||||
if($message == 'success') return $this->success($report . '报表' . $itemNum . '行数据正确');
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查不同报表数据。
|
||||
* Check different report data.
|
||||
*
|
||||
* @param string $report 报表名称
|
||||
* @param string $type 报表类型
|
||||
* @param array $itemNum 查看的报表条目
|
||||
* @param array $data 报表条目、值、百分比
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkReport($report, $type, $itemNum = 'a', $data)
|
||||
public function checkReport($report, $type, $itemNum, $data)
|
||||
{
|
||||
$form = $this->initForm('testtask', 'report', array('productID' => '1', 'taskID' => '1', 'browseType' => 'all', 'chartType' => 'pie'), 'appIframe-qa');
|
||||
$form->dom->$report->click();
|
||||
$form->wait(1);
|
||||
$form->dom->createBtn->click();
|
||||
$form->wait(1);
|
||||
$form->dom->$type->click();
|
||||
$form->wait(1);
|
||||
if($form->dom->title->getText() != $this->lang->testtask->report->charts->$report) return $this->failed('显示报表错误');
|
||||
$form = $this->loadPage();
|
||||
if($form->dom->title->getText() != $this->lang->testtask->report->charts->$report) return 'titleError';
|
||||
|
||||
$item = 'item' . $itemNum;
|
||||
$value = 'value' . $itemNum;
|
||||
$percent = 'percent' . $itemNum;
|
||||
/* 从测试数据中提取对应的子数组,子数组中为此行的条目、值、百分比 */
|
||||
$key = array_search($form->dom->$item->getText(), array_column($data, $this->config->default->lang));
|
||||
if($key === false) return $this->failed('报表中无此行数据');
|
||||
if($key === false) return 'itemError';
|
||||
$result = $data[$key];
|
||||
|
||||
if($form->dom->$value->getText() != $result['value']) return $this->failed('显示报表值错误');
|
||||
if($form->dom->$percent->getText() != $result['percent']) return $this->failed('显示报表百分比错误');
|
||||
return $this->success('报表数据正确');
|
||||
if($form->dom->$value->getText() != $result['value']) return 'valueError';
|
||||
if($form->dom->$percent->getText() != $result['percent']) return 'percentError';
|
||||
return 'success';
|
||||
$form->wait(2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user