*[task#129121,doing,1h,2h] add function of create branch

This commit is contained in:
lixiaoyu
2024-09-26 15:14:46 +08:00
committed by 李阳
parent c791388cf8
commit bc75edfc66
3 changed files with 62 additions and 7 deletions
@@ -2,12 +2,57 @@
include dirname(__FILE__, 5) . '/test/lib/ui.php';
class createBranchTester extends tester
{
/**
* 创建分支
* Create branch
*
* @param $branch
* @param array $branchurl
*
* @return mixed
*/
public function createBranch($branch, $branchurl)
{
$form = $this->initForm('branch', 'manage', $branchurl, 'appIframe-product');
$form->dom->btn($this->lang->branch->create)->click();
if (isset($branch->name)) $form->dom->name->setValue($branch->name);
if (isset($branch->desc)) $form->dom->desc->setValue($branch->desc);
$form->dom->save->click();
$form->dom->btn($this->lang->branch->createAction)->click();
$form->wait(2);
//设置表单字段
//$form = $this->loadPage();
//var_dump($form->dom->branchName);
if ($form->dom->branchName === false)
{
var_dump('没找到分支名称输入框');
}
else
{
var_dump('找到了');
}
$form->wait(3);
$form->dom->branchName->click();
try{
if (isset($branch->name))
{
$form->dom->branchName->setValue($branch->name);
}
}
catch (Exception $e){
echo 'Error: ' . $e->getMessage();
}
// $form->dom->branchName->setValue('fenzhi');
//if (isset($branch->desc)) $form->dom->desc->setValue($branch->desc);
//$form->dom->save111->click();
$form->wait(2);
/*
if ($form->dom->createBranchForm)
{
var_dump($this->page->dom->getFormTips());
if ($this->checkFormTips('branch')) return $this->success('创建分支表单页提示信息正确');
return $this->failed('创建分支表单页提示信息不正确');
}
else
{
return $this->success('创建分支成功');
}
*/
}
}
+10 -1
View File
@@ -4,7 +4,7 @@ chdir(__DIR__);
include '../lib/createbranch.ui.class.php';
$product = zenData('product');
$product->id->range('12');
$product->id->range('11');
$product->name->range('多分支产品');
$product->status->range('normal');
$product->type->range('branch');
@@ -15,6 +15,15 @@ $tester->login();
$productID['productID'] = 11;
$branch = new stdClass();
$branch->name = '';
r($tester->createBranch($branch, $productID)) && p('message,status') && e('创建分支提示信息正确,SUCCESS');
$branch->name = '分支01';
$branch->desc = '分支描述01';
r($tester->createBranch($branch, $productID)) && p('message,status') && e('创建分支成功,SUCCESS');
$branch->name = '分支01';
r($tester->createBranch($branch, $productID)) && p('message,status') && e('创建分支提示信息正确,SUCCESS');
$tester->closeBrowser();
+3 -2
View File
@@ -1,11 +1,12 @@
<?php
class createPage extends page
class managePage extends page
{
public function __construct($webdriver)
{
parent::__construct($webdriver);
$xpath = array(
'save' => "//*[@id='zin_branch_create_form']/div[3]/div/button",
'branchName' => "//*[@id='createForm']/div/input",
'save111' => "//*[@id='zin_branch_create_form']/div[3]/div/button",
);
$this->dom->xpath = array_merge($this->dom->xpath, $xpath);
}