+ [task#142429,doing,0.1h,1.5h] Add xpath of element on lite.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/ui.php';
|
||||
class createProjectLiteTester extends tester
|
||||
{
|
||||
/**
|
||||
* 创建项目时检查页面输入。
|
||||
* Check the page input when creating the project.
|
||||
*
|
||||
* @param array $project
|
||||
* @access public
|
||||
*/
|
||||
public function checkInput($project = array())
|
||||
{
|
||||
$form = $this->loadPage('project', 'browse');
|
||||
$this->switchVision('lite');
|
||||
$form = $this->initForm('project', 'create', array('model' => 'kanban'));
|
||||
if(isset($project['name'])) $form->dom->name->setValue($project['name']);
|
||||
if(isset($project['end'])) $form->dom->end->datepicker($project['end']);
|
||||
if(isset($project['PM'])) $form->dom->PM->picker($project['PM']);
|
||||
|
||||
$form->dom->btn($this->lang->save)->click();
|
||||
$form->wait(5);
|
||||
return $this->checkResult($project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建项目后结果检查。
|
||||
* Check the result after creating the project.
|
||||
*
|
||||
* @param string $project
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function checkresult($project = array())
|
||||
{
|
||||
/* 检查创建页面时的提示信息 */
|
||||
$form = $this->loadpage('project', 'create');
|
||||
if(!is_object($form->dom->tip))
|
||||
{
|
||||
if($this->checkformtips('project')) return $this->success('创建项目表单页提示信息正确');
|
||||
if($form->dom->endtip)
|
||||
{
|
||||
/* 检查结束日期不能为空 */
|
||||
$endtiptext = $form->dom->endtip->gettext();
|
||||
$endtip = sprintf($this->lang->copyproject->endtip,'');
|
||||
return ($endtiptext == $endtip) ? $this->success('创建项目表单页提示信息正确') : $this->failed('创建项目表单页提示信息不正确');
|
||||
form->wait(1);
|
||||
}
|
||||
return $this->failed('创建项目表单页提示信息不正确');
|
||||
}
|
||||
/* 检查创建成功后的提示信息 */
|
||||
if(is_object($form->dom->tip))
|
||||
{
|
||||
/* 跳转到项目列表页面,按照项目名称进行搜索 */
|
||||
$browsepage = $this->initform('project', 'browse');
|
||||
$browsepage->dom->search($searchlist = array("项目名称,包含, {$project['name']}"));
|
||||
$browsepage->wait(2);
|
||||
|
||||
/* 断言检查名称是否正确 */
|
||||
if($browsepage->dom->projectnamelite->gettext() != $project['name']) return $this->failed('名称错误');
|
||||
return $this->success('创建项目成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=创建运营界面项目
|
||||
timeout=0
|
||||
cid=23
|
||||
|
||||
- 创建项目缺少项目名称
|
||||
- 测试结果 @创建项目表单页提示信息正确
|
||||
- 最终测试状态 @SUCCESS
|
||||
- 创建项目计划完成时间置空
|
||||
- 测试结果 @创建项目表单页提示信息正确
|
||||
- 最终测试状态 @SUCCESS
|
||||
- 创建有日期的项目
|
||||
- 测试结果 @创建项目成功
|
||||
- 最终测试状态 @SUCCESS
|
||||
|
||||
*/
|
||||
chdir(__DIR__);
|
||||
include '../lib/createprojectlite.ui.class.php';
|
||||
|
||||
zendata('project')->gen(0);
|
||||
$tester = new createProjectLiteTester();
|
||||
$tester->login();
|
||||
|
||||
//设置项目数据
|
||||
$project = array(
|
||||
array('name' => '', 'end' => date('Y-m-d', strtotime('+30 days'))),
|
||||
array('name' => '运营看板项目'.time(), 'end' => ''),
|
||||
array('name' => '运营看板项目'.time(), 'end' => date('Y-m-d', strtotime('+1 month')), 'PM' => 'admin'),
|
||||
);
|
||||
|
||||
r($tester->checkInput($project['0'])) && p('message,status') && e('创建项目表单页提示信息正确,SUCCESS'); // 创建项目缺少项目名称
|
||||
r($tester->checkInput($project['1'])) && p('message,status') && e('创建项目表单页提示信息正确,SUCCESS'); // 创建项目计划完成时间置空
|
||||
r($tester->checkInput($project['2'])) && p('message,status') && e('创建项目成功,SUCCESS'); // 创建项目
|
||||
|
||||
$tester->closeBrowser();
|
||||
@@ -52,7 +52,9 @@ class browsePage extends page
|
||||
'num' => "//*[@id='table-project-browse']/div[3]/div[2]/strong",
|
||||
'delayedNum' => "//*[@id='featureBar']/menu/li[5]/a/span[2]",
|
||||
/*创建看板项目*/
|
||||
'kanbanName' => "//*[@id='mainContent']/div[2]/div/div/div[2]/div[1]/div/div[2]/div/a"
|
||||
'kanbanName' => "//*[@id='mainContent']/div[2]/div/div/div[2]/div[1]/div/div[2]/div/a",
|
||||
/*运营界面项目列表*/
|
||||
'projectNameLite' => "//*[@id='table-project-browse']/div[2]/div[1]/div/div[2]/div/a",
|
||||
);
|
||||
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user