From bc75edfc667bafce64bbb0070db9c008afe4f5c0 Mon Sep 17 00:00:00 2001 From: lixiaoyu Date: Tue, 24 Sep 2024 09:40:10 +0800 Subject: [PATCH] *[task#129121,doing,1h,2h] add function of create branch --- .../branch/test/lib/createbranch.ui.class.php | 53 +++++++++++++++++-- module/branch/test/ui/createbranch.php | 11 +++- module/branch/test/ui/page/manage.php | 5 +- 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/module/branch/test/lib/createbranch.ui.class.php b/module/branch/test/lib/createbranch.ui.class.php index 5ed5ca60f1..838e5419e1 100644 --- a/module/branch/test/lib/createbranch.ui.class.php +++ b/module/branch/test/lib/createbranch.ui.class.php @@ -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('创建分支成功'); + } +*/ } } diff --git a/module/branch/test/ui/createbranch.php b/module/branch/test/ui/createbranch.php index c3d3b26644..605f834841 100644 --- a/module/branch/test/ui/createbranch.php +++ b/module/branch/test/ui/createbranch.php @@ -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(); diff --git a/module/branch/test/ui/page/manage.php b/module/branch/test/ui/page/manage.php index c6e5e2c7cd..df52826e42 100755 --- a/module/branch/test/ui/page/manage.php +++ b/module/branch/test/ui/page/manage.php @@ -1,11 +1,12 @@ "//*[@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); }