Merge branch 'release/21.7.5' of https://gitfox.zcorp.cc/git/zentao/zentaopms into release/21.7.5
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/ui.php';
|
||||
class editSceneTester extends tester
|
||||
{
|
||||
/**
|
||||
* 编辑场景。
|
||||
* Create scene.
|
||||
*
|
||||
* @param array $scene
|
||||
* @access public
|
||||
*/
|
||||
public function editScene($scene = array())
|
||||
{
|
||||
$form = $this->initForm('testcase', 'browse', array('productID' => '1'), 'appIframe-qa');
|
||||
$form->wait(1);
|
||||
$form->dom->onlyScene->click();
|
||||
$Page = $this->loadPage('testcase', 'browseScene');
|
||||
$Page->dom->editBtn->click();
|
||||
|
||||
$editPage = $this->loadPage('testcase', 'editScene');
|
||||
$editPage->wait(1);
|
||||
if(isset($scene['module'])) $editPage->dom->module->picker($scene['module']);
|
||||
if(isset($scene['scene'])) $editPage->dom->title->setValue($scene['scene']);
|
||||
$editPage->dom->btn($this->lang->save)->click();
|
||||
|
||||
/* 检查编辑场景页面必填和重复校验提示信息是否正确 */
|
||||
if(is_object($form->dom->titleTip))
|
||||
{
|
||||
$nameTipform = $form->dom->titleTip->getText();
|
||||
$requiredTip = sprintf($this->lang->error->notempty, $this->lang->scene->title);
|
||||
$repeatTip = sprintf($this->lang->error->unique, $this->lang->scene->title, $scene['scene']);
|
||||
if($nameTipform == $requiredTip) return $this->success('编辑场景必填提示信息正确');
|
||||
if($nameTipform == $repeatTip) return $this->success('编辑场景名称重复时提示信息正确');
|
||||
return $this->failed('编辑场景提示信息错误');
|
||||
}
|
||||
|
||||
/* 断言检查场景是否创建成功 */
|
||||
else if(!is_object($form->dom->titleTip) && $this->response('method') != 'createScene')
|
||||
{
|
||||
$browsePage = $this->loadPage('testcase', 'browse');
|
||||
$form->wait(2);
|
||||
$browsePage->dom->onlyScene->click();
|
||||
|
||||
$browseScenePage = $this->loadPage('testcase', 'browseScene');
|
||||
$browseScenePage->wait(1);
|
||||
$sceneName = $browseScenePage->dom->getElement("//*[@id='scenes']/div[2]/div[1]/div/div[2]/div")->element->getText();
|
||||
|
||||
if($sceneName != $scene['scene']) return $this->failed('场景名称错误');
|
||||
return $this->success('场景编辑成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=建场景
|
||||
timeout=0
|
||||
cid=73
|
||||
|
||||
- 编辑场景必填信息检查
|
||||
- 测试结果 @编辑场景必填提示信息正确
|
||||
- 最终测试状态 @SUCCESS
|
||||
- 编辑场景名称重复时提示信息检查
|
||||
- 测试结果 @编辑场景名称重复时提示信息正确
|
||||
- 最终测试状态 @SUCCESS
|
||||
- 编辑场景
|
||||
- 测试结果 @场景编辑成功
|
||||
- 最终测试状态 @SUCCESS
|
||||
|
||||
*/
|
||||
chdir(__DIR__);
|
||||
include '../lib/editscene.ui.class.php';
|
||||
|
||||
$module = zenData('module');
|
||||
$module->gen(0);
|
||||
|
||||
$scene = zenData('scene');
|
||||
$scene->gen(0);
|
||||
|
||||
$product = zenData('product');
|
||||
$product->id->range('1');
|
||||
$product->program->range('0');
|
||||
$product->name->range('产品1');
|
||||
$product->shadow->range('0');
|
||||
$product->bind->range('0');
|
||||
$product->acl->range('open');
|
||||
$product->createdBy->range('admin');
|
||||
$product->vision->range('rnd');
|
||||
$product->gen(1);
|
||||
|
||||
$scene = zenData('scene');
|
||||
$scene->id->range('1,2');
|
||||
$scene->module->range('1');
|
||||
$scene->title->range('场景1,场景2');
|
||||
$scene->sort->range('1,2');
|
||||
$scene->openedBy->range('admin');
|
||||
$scene->grade->range('1,1');
|
||||
$scene->path->range(',1,',',2,');
|
||||
$scene->gen(2);
|
||||
|
||||
$module = zenData('module');
|
||||
$module->id->range('1,2');
|
||||
$module->root->range('1,1');
|
||||
$module->name->range('模块1,模块2');
|
||||
$module->parent->range('0');
|
||||
$module->path->range(',1,',',2,');
|
||||
$module->grade->range('1,1');
|
||||
$module->type->range('case');
|
||||
$module->order->range('10,20');
|
||||
$module->gen(2);
|
||||
|
||||
$tester = new editSceneTester();
|
||||
$tester->login();
|
||||
|
||||
//设置数据
|
||||
$scene = array(
|
||||
'0' => array(
|
||||
'scene' => '',
|
||||
),
|
||||
'1' => array(
|
||||
'scene' => '场景2',
|
||||
),
|
||||
'2' => array(
|
||||
'module' => '模块2',
|
||||
'scene' => '场景--编辑',
|
||||
),
|
||||
);
|
||||
|
||||
r($tester->editScene($scene['0'])) && p('message,status') && e('编辑场景必填提示信息正确,SUCCESS'); // 编辑场景必填信息检查
|
||||
r($tester->editScene($scene['1'])) && p('message,status') && e('编辑场景名称重复时提示信息正确,SUCCESS'); // 编辑场景名称重复时提示信息检查
|
||||
r($tester->editScene($scene['2'])) && p('message,status') && e('场景编辑成功,SUCCESS'); // 编辑场景
|
||||
|
||||
$tester->closeBrowser();
|
||||
@@ -16,9 +16,10 @@ class browsePage extends page
|
||||
'exportMenu' => "//button[@type='button' and contains(@zui-toggle-dropdown,'export')]/i",
|
||||
'exportCaseButton' => "//menu/li/a[contains(@href,'=export&')]",
|
||||
'automation' => "//a[contains(@href,'automation')]",
|
||||
'batchEdit' => "//span[text()='编辑']"
|
||||
'batchEdit' => "//span[text()='编辑']",
|
||||
'onlyScene' => "//*[@id='featureBar']/menu/li[7]/a"
|
||||
);
|
||||
|
||||
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ class browseScenePage extends page
|
||||
{
|
||||
parent::__construct($webdriver);
|
||||
$xpath = array(
|
||||
'editBtn' => "//*[@id='scenes']/div[2]/div[3]/div/div/div/nav/a[1]",
|
||||
);
|
||||
|
||||
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class editScenePage extends page
|
||||
{
|
||||
public function __construct($webdriver)
|
||||
{
|
||||
parent::__construct($webdriver);
|
||||
$xpath = array(
|
||||
);
|
||||
|
||||
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user