*[task#122980,doing,5h,1h] Add ui test files of creating scrum project.

This commit is contained in:
lihuifang
2024-07-12 10:23:30 +08:00
committed by 曹延义
parent 9ea7b1bb59
commit bae7875e67
4 changed files with 99 additions and 0 deletions
@@ -0,0 +1,57 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/ui.php';
class createScrumTester extends tester
{
/**
* Check the page jump after creating the product.
*
* @param string $scrum
* @access public
* @return object
*/
public function checkLocating($scrum = array())
{
$form = $this->initForm('project', 'create', array('model' => 'scrum'));
$form->dom->noproduct->click();
$form->dom->name->setValue($scrum['noproduct']);
$form->dom->end->datePicker($scrum['end']);
$form->dom->PM->picker($scrum['PM']);
$form->dom->btn($this->lang->save)->click();
$form->wait(1);
return $this->response();
}
/**
* Create the scrum project.
*
* @param string $scrum
* @access public
* @return object
*/
public function createScrum($scrum = array())
{
$form = $this->initForm('project', 'create', array('model' => 'scrum'));
$form->dom->name->setValue($scrum);
$form->dom->longTime->click();
$form->dom->btn($this->lang->save)->click();
$form->wait(1);
if($this->response('method') != 'browse')
{
if($this->checkFormTips('project')) return $this->success('创建敏捷项目表单页提示信息正确');
return $this->failed('创建敏捷项目表单页提示信息不正确');
}
/* 跳转到项目列表页面,点击列表页项目名称进入项目,再点击设置菜单查看项目概况页面。 */
$browsePage = $this->loadPage('project', 'browse');
$browsePage->dom->scrumName->click();
$browsePage->dom->settings->click();
$viewPage = $this->loadPage('project', 'view');
$form->wait(1);
if($viewPage->dom->viewProjectName->getText() != $scrum) return $this->failed('名称错误');
$categoryLang = (array)$this->lang->project->projectTypeList;
if($viewPage->dom->category->getText() != $categoryLang['1']) return $this->failed('类型错误');
return $this->success();
}
}
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env php
<?php
/**
title=创建敏捷项目测试
timeout=0
cid=73
- 缺少产品名称,创建失败
- 测试结果 @创建产品表单页提示信息正确
- 最终测试状态 @SUCCESS
- 使用默认选项创建产品 最终测试状态 @SUCCESS
- 创建重复名称的产品 测试结果 @创建产品表单页提示信息正确
- 创建正常产品后的跳转链接检查
- 属性module @product
- 属性method @browse
- 创建正常产品成功 最终测试状态 @SUCCESS
*/
chdir(__DIR__);
include '../lib/createscrum.ui.class.php';
zendata('project')->loadYaml('project', false, 2)->gen(10);
$tester = new createScrumTester();
$tester->login();
$scrum = array();
$scrum['null'] = '';
$scrum['hasproduct'] = '一个产品型项目'.time();
$scrum['noproduct'] = '一个项目型项目'.time();
$scrum['end'] = date("Y-m-d",strtotime("+1 month"));
$scrum['PM'] = 'admin';
r($tester->createScrum($scrum['null'])) && p('message') && e('创建敏捷项目表单页提示信息正确'); // 缺少项目名称,创建失败
r($tester->createScrum($scrum['hasproduct'])) && p('status') && e('SUCCESS'); // 创建产品型项目
r($tester->createScrum($scrum['hasproduct'])) && p('message') && e('创建敏捷项目表单页提示信息正确'); // 创建重复名称的产品
r($tester->checkLocating($scrum) ) && p('module,method') && e('project,browse'); // 创建项目型敏捷项目后的跳转链接检查
$tester->closeBrowser();
+1
View File
@@ -9,6 +9,7 @@ class browsePage extends page
'settings' => "//*[@id='navbar']//a[@data-id='settings']/span",
'editBtn' => "//*[@id='table-project-browse']/div[2]/div[3]/div/div[1]/div/nav/a[2]/i",
'projectName' => "//*[@id='table-project-browse']/div[2]/div[1]/div/div[2]/div/a",
'scrumName' => "//*[@id='mainContent']/div[2]/div/div/div[2]/div/div/div[2]/div/a",
);
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
}
+1
View File
@@ -6,6 +6,7 @@ class createPage extends page
parent::__construct($webdriver);
$xpath = array(
'settings' => "//*[@id='navbar']/menu/li[14]/a/span",
'noproduct' => "//*[@id='mainContent']/div/div[2]/div/form/div[2]/div/div[2]/label",
);
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
}