*[task#123780,doing,2h,5h] Add ui test files of start and suppend project.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/ui.php';
|
||||
class startProjectTester extends tester
|
||||
{
|
||||
/**
|
||||
* 开始项目
|
||||
* Start a project.
|
||||
*
|
||||
* @param array $project
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function startProject(array $project)
|
||||
{
|
||||
$form = $this->initForm('project', 'browse', 'appIframe-project');
|
||||
$featureBar = (array)$this->lang->project->featureBar;
|
||||
$featureBar['browse'] = (array)$featureBar['browse'];
|
||||
$form->dom->btn($featureBar['browse']['wait'])->click();
|
||||
$title = $form->dom->projectName->getText();
|
||||
$form->dom->startBtn->click();
|
||||
$form->wait(1);
|
||||
/*点击启动*/
|
||||
$form->dom->startProject->click();
|
||||
$form->wait(1);
|
||||
|
||||
/*重新进入项目列表,按照项目名称搜索项目*/
|
||||
$form = $this->initForm('project', 'browse', 'appIframe-project');
|
||||
$browsePage = $this->loadPage('project', 'browse');
|
||||
$form->dom->search(array("项目名称,=,{$title}"));
|
||||
$form->wait(1);
|
||||
//搜索的项目状态为进行中,说明启动成功
|
||||
$featureBar['index'] = (array)$featureBar['index'];
|
||||
if($form->dom->browseStatus->getText() != $featureBar['index']['doing']) return $this->fail('启动项目失败');
|
||||
return $this->success('启动项目成功');
|
||||
}
|
||||
|
||||
/*
|
||||
* 挂起项目
|
||||
* Suspend a project.
|
||||
*
|
||||
* @param array $project
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function suspendProject(array $project)
|
||||
{
|
||||
$form = $this->initForm('project', 'browse', 'appIframe-project');
|
||||
$featureBar = (array)$this->lang->project->featureBar;
|
||||
$featureBar['browse'] = (array)$featureBar['browse'];
|
||||
$form->dom->btn($featureBar['browse']['doing'])->click();
|
||||
$title = $form->dom->projectName->getText();
|
||||
$form->dom->moreBtn->click();
|
||||
$form->dom->suspendBtn->click();
|
||||
$form->wait(1);
|
||||
|
||||
$form->dom->suspendProject->click();
|
||||
$form->wait(1);
|
||||
|
||||
/*重新进入项目列表,按照项目名称搜索项目*/
|
||||
$form = $this->initForm('project', 'browse', 'appIframe-project');
|
||||
$browsePage = $this->loadPage('project', 'browse');
|
||||
$form->dom->search(array("项目名称,=,{$title}"));
|
||||
$form->wait(1);
|
||||
//搜索的项目状态为挂起,说明挂起成功
|
||||
$featureBar['index'] = (array)$featureBar['index'];
|
||||
if($form->dom->browseStatus->getText() != $featureBar['index']['suspended']) return $this->fail('挂起项目失败');
|
||||
return $this->success('挂起项目成功');
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,21 @@ class browsePage extends page
|
||||
parent::__construct($webdriver);
|
||||
|
||||
$xpath = array(
|
||||
'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",
|
||||
'moreBtn' => "//*[@id='table-project-browse']/div[2]/div[3]/div/div[1]/div/nav/button[1]/span",
|
||||
'closeBtn' => "//*[@class='icon item-icon icon-off']",
|
||||
'closeProject' => "//*[@class='modal modal-async load-indicator modal-trans show in']/div/div/div[3]/div/div/form/div[3]/div/button",
|
||||
'closed' => "//*[@id='more']/menu/menu/li[2]/a/div",
|
||||
'activeBtn' => "//*[@id='table-project-browse']/div[2]/div[3]/div/div/div/nav/a[1]/i",
|
||||
'activeProject' => "//*[@class='modal modal-async load-indicator modal-trans show in']/div/div/div[3]/div/div/form/div[3]/div/button",
|
||||
'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",
|
||||
'moreBtn' => "//*[@id='table-project-browse']/div[2]/div[3]/div/div[1]/div/nav/button[1]/span",
|
||||
'closeBtn' => "//*[@class='icon item-icon icon-off']",
|
||||
'closeProject' => "//*[@class='modal modal-async load-indicator modal-trans show in']/div/div/div[3]/div/div/form/div[3]/div/button",
|
||||
'closed' => "//*[@id='more']/menu/menu/li[2]/a/div",
|
||||
'activeBtn' => "//*[@id='table-project-browse']/div[2]/div[3]/div/div/div/nav/a[1]/i",
|
||||
'activeProject' => "//*[@class='modal modal-async load-indicator modal-trans show in']/div/div/div[3]/div/div/form/div[3]/div/button",
|
||||
'startBtn' => "//*[@id='table-project-browse']/div[2]/div[3]/div/div/div/nav/a",
|
||||
'startProject' => "//*[@class='modal-content']/div[3]/div/div/form/div[3]/div/button/span",
|
||||
'suspendBtn' => "//*[@class='popover show fade dropdown in']/menu/menu/li/a",
|
||||
'suspendProject' => "//*[@class='modal-content']/div[3]/div/div/form/div[2]/div/button",
|
||||
'browseStatus' => "//*[@id='table-project-browse']/div[2]/div[2]/div/div/div/span",
|
||||
);
|
||||
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
|
||||
}
|
||||
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=启动和挂起项目测试
|
||||
timeout=0
|
||||
cid=73
|
||||
|
||||
- 启动项目成功 测试结果 @启动项目成功
|
||||
- 挂起项目成功 测试结果 @挂起项目成功
|
||||
|
||||
*/
|
||||
chdir(__DIR__);
|
||||
include '../lib/startproject.ui.class.php';
|
||||
|
||||
$tester = new startProjectTester();
|
||||
$tester->login();
|
||||
|
||||
$project = array();
|
||||
|
||||
r($tester->startProject($project)) && p('message') && e('启动项目成功'); //启动项目
|
||||
r($tester->suspendProject($project)) && p('message') && e('挂起项目成功'); //挂起项目
|
||||
|
||||
$tester->closeBrowser();
|
||||
Reference in New Issue
Block a user